From ca586de0fd276fd2857213822b4a45c81345f3c8 Mon Sep 17 00:00:00 2001 From: Theo Schlossnagle Date: Thu, 12 Jul 2018 12:54:19 +0000 Subject: [PATCH] the same client connection should use the same offload queue for ordering rreasons --- fqd_dss.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/fqd_dss.c b/fqd_dss.c index d056b98..cf056f0 100644 --- a/fqd_dss.c +++ b/fqd_dss.c @@ -196,8 +196,7 @@ fqd_queue_message_process(remote_data_client *me, fq_msg *msg) { ck_fifo_spsc_t *work_queue = NULL; ck_fifo_spsc_entry_t *entry = NULL, *tofree = NULL; - int i = 0, tindex = 0; - uint32_t blmin = UINT_MAX; + int tindex = 0; struct incoming_message *m = malloc(sizeof(struct incoming_message)); m->client = me; @@ -206,15 +205,8 @@ fqd_queue_message_process(remote_data_client *me, fq_msg *msg) /* while we live in this queue, we ref the client so it can't be destroyed until the queue is cleared of it */ fqd_remote_client_ref((remote_client *) m->client); - /* find the least loaded queue */ - for ( ; i < worker_thread_count; i++) { - uint32_t x = work_queue_backlogs[i]; - if (x < blmin) { - blmin = x; - tindex = i; - } - } - + tindex = me->fd % worker_thread_count; + ck_pr_inc_32(&work_queue_backlogs[tindex]); work_queue = &work_queues[tindex]; ck_fifo_spsc_enqueue_lock(work_queue);