- Abp 6.6.1
- Angular
- .NET5
Hi,
I'm getting very long request issues with GetProfilePictureByUserId endpoint. Sometimes more than 1 min ! Here is an example from Azure insights :
As you can see, a lot of time is "waste" before accessing database (which is very short time access).
I slightly change GetProfilePictureByUserId to implement a cache mechanism. Here is the code :
public async Task<GetProfilePictureOutput> GetProfilePictureByUserId(long userId)
{
//Get from cache first
var outputFromCache = await _cacheManager.GetCache(UserPictureByUserIdCacheName).GetOrDefaultAsync(userId.ToString()) as GetProfilePictureOutput;
if (outputFromCache != null)
return outputFromCache;
else
{
var user = await UserManager.GetUserByIdAsync(userId);
if (user.ProfilePictureId == null)
{
return new GetProfilePictureOutput(string.Empty);
}
var output = await GetProfilePictureById(user.ProfilePictureId.Value);
//Set cache
await _cacheManager.GetCache(UserPictureByUserIdCacheName).SetAsync(userId.ToString(), output);
return output;
}
}
When testing this code, it runs very fast. But on production, a lot of requests gets stuck sometimes. I'm using Redis cache with azure app service in 2 instances.
I have the same issues with other endpoints like :
- TokenAuth/Authenticate
- signalr/negociate
All this seems to be linked with cache management. This is frustrating because the app can be very slow time to time and frustrating lots of users.
I tried to use AbpPerRequestRedisCache but it is throwing exceptions at the moment...
How can I fix this ?
5 Answer(s)
-
0
Hi @ricavir
I will provide feedback about the AbpPerRequestRedisCache usage problem this week to you.
-
0
Thank you @ismcagdas
-
0
Hi @ricavir
I hope that this problem will be solved via https://github.com/aspnetboilerplate/aspnetboilerplate/pull/6334. We will release 6.6.2 tomorrow, you can try it out.
-
0
Hi @ismcagdas, thank you for this. I will try it and provide feedback on all related issues.
-
0
Hi @ricavir
Thanks, we will release it today.