I have simple application that has 2 endpoints, one of the endpoints uses data in memory, second uses Redis cache (IDistributedCache). This application is hosted on the kubernetes. Works on .net 6, has about 40 req/s and works on 2 instances. The application responses usually in 1-6 milisecnds (95 percentile is 6 ms).
The problem is, that when I declare cpu request 200 Mi and limit 400Mi, then about 4% requests returns 499 code (my clients have timeout 500ms). The kubectl top pods shows that both apps use less than 50m CPU and 170Mi of memory. When I set request 500Mi and limit 2500Mi then it works without timeouts, but for the lowe limits (eg. 1500Mi) works without timeouts just for 5min-5h - I cannot find correlation.
The application is published externally by the nginx. I sue this image mcr.microsoft.com/dotnet/aspnet:6.0. The same situation is with alpine.
I have no idea why this app requires so many CPU limit? I don't see throttling in grafafna when I set limits on 1000Mi.
What can be reason of this problems? Thanks.