I have implemented a producer-consumer pattern to facilitate interaction between threads . But the contention of locking is only among producer threads and not between consumer and any of producer threads. Still the application works on maximum 50% of CPU usage with all threads being scheduled on a single core (it’s Windows 10 OS, not any server OS). It almost behaves like a serial process where consumer thread is waiting for it’s slice.
Can thread-safe logging be kind of bottleneck (because everything is logged to a single file in our web application) ?
My intention is atleast consumer thread should be able get slice in parallel to producer threads.