M B V R K
M B V R K
CC#
Created by M B V R K on 8/10/2024 in #help
Cache response time issue
22mb only one table
31 replies
CC#
Created by M B V R K on 8/10/2024 in #help
Cache response time issue
From your experience, is there any other considerations or causes for this issue ?
31 replies
CC#
Created by M B V R K on 8/10/2024 in #help
Cache response time issue
aaaah
31 replies
CC#
Created by M B V R K on 8/10/2024 in #help
Cache response time issue
I heard before that there is a performance difference between Newtonsoft.Json and System.Text.Json, where Newtonsoft.Json has a good performance, but in my case I used System.Text.Json
31 replies
CC#
Created by M B V R K on 8/10/2024 in #help
Cache response time issue
:kekw:
31 replies
CC#
Created by M B V R K on 8/10/2024 in #help
Cache response time issue
lol sorry I meant 14GB
31 replies
CC#
Created by M B V R K on 8/10/2024 in #help
Cache response time issue
Maybe you are right about the potato, because currently I'm working on an I5 2nd generation with 14gb RAM
31 replies
CC#
Created by M B V R K on 8/10/2024 in #help
Cache response time issue
its 22mb
31 replies
CC#
Created by M B V R K on 8/10/2024 in #help
Cache response time issue
Massive thanks again <3
31 replies
CC#
Created by M B V R K on 8/10/2024 in #help
Cache response time issue
But please if there is an advice I'm here to get learned from your experiences
31 replies
CC#
Created by M B V R K on 8/10/2024 in #help
Cache response time issue
At this moment the good solution I found is to cache by Pagination (means caching each page separated with its own key), that solved my issue
31 replies
CC#
Created by M B V R K on 8/10/2024 in #help
Cache response time issue
After many diagnostics, mostly the issue because of the Deserialization, deserializing and mapping 10000 records take so much time, so at this moment the ideal solution is to not cache that amount of items (10000) bellow one key,
31 replies
CC#
Created by M B V R K on 8/10/2024 in #help
Cache response time issue
Please any help for this issue ?????
31 replies
CC#
Created by M B V R K on 8/10/2024 in #help
Cache response time issue
I test on that Candidates table which contains 10000 record, when data comes from the database it takes 3 seconds but when it comes from the cache it takes 30 seconds. (I used postman and StopWatch for calculating the time elapsed)
31 replies
CC#
Created by M B V R K on 8/10/2024 in #help
Cache response time issue
Example: I have this query handler:
public class GetCandidatesQueryHandler : BaseQueryHandler<GetCandidatesQuery, GetCandidatesQueryResult>
{
public GetCandidatesQueryHandler(IMapper mapper, IMediator mediator, AppDbContext dbContext, IDistributedCache distributedCache) : base(mapper, mediator, dbContext, distributedCache)
{
}

public override async Task<GetCandidatesQueryResult> Handle(GetCandidatesQuery query, CancellationToken cancellationToken)
{
try
{
var candidates = query.UseCacheIfAvailable && await _distributedCache.GetStringAsync(query.CacheKey, cancellationToken) is string cache ?
JsonSerializer.Deserialize<IEnumerable<GetCandidatesQueryResultDto>>(cache) :
_mapper.Map<IEnumerable<GetCandidatesQueryResultDto>>(await _dbContext.Candidates.ToListAsync(cancellationToken));

var queryResultDto = _mapper.Map<IEnumerable<GetCandidatesQueryResultDto>>(candidates);
var queryResult = GetCandidatesQueryResult.Succeeded(queryResultDto);

if (!query.UseCacheIfAvailable) return queryResult;

_mediator.Send(new SetQueryCacheEntry(query.CacheKey, queryResult.Value));

return queryResult;

}
catch (Exception ex)
{
return GetCandidatesQueryResult.Failed(ex);
}
}
}
public class GetCandidatesQueryHandler : BaseQueryHandler<GetCandidatesQuery, GetCandidatesQueryResult>
{
public GetCandidatesQueryHandler(IMapper mapper, IMediator mediator, AppDbContext dbContext, IDistributedCache distributedCache) : base(mapper, mediator, dbContext, distributedCache)
{
}

public override async Task<GetCandidatesQueryResult> Handle(GetCandidatesQuery query, CancellationToken cancellationToken)
{
try
{
var candidates = query.UseCacheIfAvailable && await _distributedCache.GetStringAsync(query.CacheKey, cancellationToken) is string cache ?
JsonSerializer.Deserialize<IEnumerable<GetCandidatesQueryResultDto>>(cache) :
_mapper.Map<IEnumerable<GetCandidatesQueryResultDto>>(await _dbContext.Candidates.ToListAsync(cancellationToken));

var queryResultDto = _mapper.Map<IEnumerable<GetCandidatesQueryResultDto>>(candidates);
var queryResult = GetCandidatesQueryResult.Succeeded(queryResultDto);

if (!query.UseCacheIfAvailable) return queryResult;

_mediator.Send(new SetQueryCacheEntry(query.CacheKey, queryResult.Value));

return queryResult;

}
catch (Exception ex)
{
return GetCandidatesQueryResult.Failed(ex);
}
}
}
The issue: The issue is when there is a cache available the application took a lot of time to get the data from the cache, but when there is no cache or the cache is expired (means the app should now select the data from the database then cache it) it took very less time.
31 replies
CC#
Created by M B V R K on 4/14/2024 in #help
Why Console App don't Auto Run at Windows Startup ?
Where to find that IWshRuntimeLibrary please???
8 replies
CC#
Created by M B V R K on 4/14/2024 in #help
Why Console App don't Auto Run at Windows Startup ?
Please is this any other efficient way ?
8 replies
CC#
Created by M B V R K on 4/4/2024 in #help
System.ComponentModel.Win32Exception: 'Access is denied'
that looks a good idea
15 replies
CC#
Created by M B V R K on 4/4/2024 in #help
System.ComponentModel.Win32Exception: 'Access is denied'
I don't even knowwhy I didn't make them work as a single app
15 replies
CC#
Created by M B V R K on 4/4/2024 in #help
System.ComponentModel.Win32Exception: 'Access is denied'
Massive thanks I really appreciate your time and help,
15 replies