userver icon indicating copy to clipboard operation
userver copied to clipboard

Update moodycamel to control MAX_SEMA_SPINS

Open itrofimow opened this issue 2 years ago • 2 comments

You see, moodycamel::BlockingConcurrentQueue spins here before going to kernel semaphore and although it's preferable for maximum throughput in benchmarks, it wastes CPU cycles in some real-life scenarios.

Since this commit there is a way to control this spinning behavior, which was very noticeable in some perfs, remember @apolukhin?

itrofimow avatar Jul 21 '22 02:07 itrofimow

We've updated the moodycamel.

Now we have three different opinions on MAX_SEMA_SPINS proper value: 0|1, 16, default|10000. We need to do some experiments on production service...

apolukhin avatar Jul 31 '22 07:07 apolukhin

We've updated the moodycamel.

Now we have three different opinions on MAX_SEMA_SPINS proper value: 0|1, 16, default|10000. We need to do some experiments on production service...

I feel more like ~1000, but that is based purely on feeling.

This definitely requires some experementation, but having a possibility to control that is already a pleasant enhancement, thank you for that!

itrofimow avatar Jul 31 '22 10:07 itrofimow

I'll close this for now. Experiments with MAX_SEMA_SPINS would be done in a few months

apolukhin avatar Aug 30 '22 11:08 apolukhin