2

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) :

enter image description here

I use the UTF8 default collation for my MySql Database :

enter image description here

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 ?

  • We spent some times to improve our API (optimize cache usage, limitate the scope of NHibernate Sessions, etc.) and we don't have this CPU problem anymore. I think that the encoding problem was a side effect. Thanks for your help. – Sébastien Ollivier Feb 07 '19 at 09:48

0 Answers0