diff options
author | Eric Wong <normalperson@yhbt.net> | 2012-03-14 05:32:35 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2012-03-14 05:59:14 +0000 |
commit | d0cfc6df71befc100b72a4c56300131c7d71ee4f (patch) | |
tree | 480ac90a75982faa15f1d937a2afac7a2feb9bde /http.c | |
parent | e054e939255af90f2164318742db55517231e15b (diff) | |
download | cmogstored-d0cfc6df71befc100b72a4c56300131c7d71ee4f.tar.gz |
We want to avoid global resources like the active queue as much as possible. Unnecesarly bouncing of clients between different threads and contention for the active queue lock hurts concurrency. This contention is witnessed when parallel MD5 requests are serviced during parallel fsck runs.
Diffstat (limited to 'http.c')
-rw-r--r-- | http.c | 14 |
1 files changed, 8 insertions, 6 deletions
@@ -189,19 +189,20 @@ err400: return MOG_NEXT_CLOSE; } -void mog_http_queue_step(struct mog_fd *mfd) +struct mog_fd *mog_http_queue_step(struct mog_fd *mfd) { struct mog_queue *q = mfd->as.http.svc->queue; /* centralize all queue transitions here: */ switch (http_queue_step(mfd)) { - case MOG_NEXT_CLOSE: http_close(mfd); return; - case MOG_NEXT_ACTIVE: mog_activeq_push(q, mfd); return; - case MOG_NEXT_WAIT_RD: mog_idleq_push(q, mfd, MOG_QEV_RD); return; - case MOG_NEXT_WAIT_WR: mog_idleq_push(q, mfd, MOG_QEV_WR); return; + case MOG_NEXT_CLOSE: http_close(mfd); break; + case MOG_NEXT_ACTIVE: return mfd; + case MOG_NEXT_WAIT_RD: mog_idleq_push(q, mfd, MOG_QEV_RD); break; + case MOG_NEXT_WAIT_WR: mog_idleq_push(q, mfd, MOG_QEV_WR); break; case MOG_NEXT_IGNORE: assert(0 && "refused to put HTTP client into ignore state"); } + return NULL; } /* called during graceful shutdown instead of mog_http_queue_step */ @@ -236,7 +237,8 @@ void mog_http_post_accept(int fd, struct mog_svc *svc) struct mog_http *http = &mfd->as.http; mog_http_init(http, svc); - mog_http_queue_step(mfd); + if (mog_http_queue_step(mfd)) + mog_activeq_push(svc->queue, mfd); } /* |