I have an API (ASPNET Core) which calls a Database (MySQL). I use NHibernate and the MySqlData connector.
When a lot of requests are sent to my API, I come accross some CPU problem (near to 100%) that lead to HTTP request errors.
I made a dump to analyse what is happenning and I found that most of my CPU time is spent in the MySql.Data.MySqlClient.CharSetMap::GetEncoding
method, as you can see below (7% CPU usage for a request that use 16% of CPU) :
I use the UTF8 default collation for my MySql Database :
I tried to set the encoding manually in my ASPNET Core API, so I could avoid the GetEncoding
cost, but I can't find how to do it (I even don't know if it's possible).
Any advice to improve my CPU usage ?