Open
Description
Based on the example provided I've tried to install library with the following steps:
- Added the Joystick client in the
ConfigureServices
:
// Joystick
builder.Services.AddJoystickClient();
builder.Services.AddOptions<JoystickClientConfig>()
.Bind(builder.Configuration.GetSection("JoystickConfig"));
And added appropriate configuration to appsettings.json
:
{
"JoystickConfig": {
"ApiKey": "...",
"CacheOptions": {
"CacheExpirationSeconds": 600
}
}
}
- Added client code for the controller (for test purposes);
var fullContent = await client.GetFullContentAsync(configName);
var fullContent2 = await client.GetFullContentAsync(configName);
var fullContent3 = await client.GetFullContentAsync(configName);
var fullContent4 = await client.GetFullContentAsync(configName);
var fullContent5 = await client.GetFullContentAsync(configName);
- Triggered new API endpoint with Postman perf test.
Every additional copy-pasted line drastically increases the response time of the specified API call.
Graph of response times over time for version where there's 1 call to Joystick library to get the same config:
Graph of response times over time for version where there're 5 calls to Joystick:
Sounds like the problem is related to cache.