API taking more than 3s for a simple contact search

Your software
My Mautic version is: 4.0.1
My PHP version is: 7.4.3
My Database type and version is: 5.7

Your problem
My problem is:
Currently i only have 3k contacts and using the API for a simple search, each request is taking more than 3s. Using the web interface it only takes milliseconds. I easly reach 100% CPU percentage executing multiple searchs at the same time, like 5 requests.
I’m using php-fpm and basic auth.
My server has 2 CPU and 4 GB of RAM.

If someone is facing the same issue or has any idea in how to solve this situation, i would really appreciate the help.

The problem seems to be related with the “Basic auth”. I have implemented the oAuth2.0 and the response times reduced to under 1s.