I’m using spdlog library in my high-load service. Also my service is getting requests from another service by gRPC.
At this moment I can’t use streaming gRPC, and every call creates its own connection. As I know I can’t restrict threads count gRPC creating.
Now my service began to run into performance due to the fact that each thread writes to the same log file, which is blocked by a mutex inside the spdlog.
What are the solutions to this problem besides horizontal scaling (increasing the number of processes)
If I understand your requirements correctly, there is an application with multiple threads logging to a single archive synchronously using
spdlog.I answered a similar question about logging suggesting the use of a memory-mapped file which turned out to be about
100xfaster thanspdlogfor the prototype code posted in the answer.