MXS-1948: Do round-robin worker assignment

Due to the skewed accept distribution without SO_REUSEPORT, we use
round-robin assignment of workers for new client connections. This
provides better performance as work is more likely to be evenly
distributed across all threads.

Using a least-busy-worker algorithm would provide a more stable result but
this is not trivially simple to implement. For this reason, the
round-robin based approach was chosen for 2.2.
This commit is contained in:
Markus Mäkelä
2018-07-02 11:02:04 +03:00
parent e455e7f15d
commit fb1c28c702
3 changed files with 32 additions and 11 deletions

View File

@ -495,6 +495,13 @@ public:
*/
static void set_maxwait(unsigned int maxwait);
/**
* Get next Worker's ID
*
* @return The ID of the worker where work should be assigned
*/
static int pick_worker_id();
private:
Worker(int id,
int epoll_fd);