summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzhaozhao.zz <zhaozhao.zz@alibaba-inc.com>2019-05-21 11:42:10 +0800
committerzhaozhao.zz <zhaozhao.zz@alibaba-inc.com>2019-05-21 11:42:10 +0800
commit1398fac3f1bd190c572a695aa898d71d1573f7e5 (patch)
tree241393aad51834dc7cf0ccc9013575a3c5d70787
parent8b33975944397a0522f6d05d0776d9871a7c6be0 (diff)
downloadredis-1398fac3f1bd190c572a695aa898d71d1573f7e5.tar.gz
Threaded IO: use main thread to handle read work
-rw-r--r--src/networking.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/networking.c b/src/networking.c
index 4da762a15..c2ae35181 100644
--- a/src/networking.c
+++ b/src/networking.c
@@ -2755,7 +2755,7 @@ int handleClientsWithPendingReadsUsingThreads(void) {
int item_id = 0;
while((ln = listNext(&li))) {
client *c = listNodeValue(ln);
- int target_id = item_id % server.io_threads_num;
+ int target_id = item_id % (server.io_threads_num+1);
listAddNodeTail(io_threads_list[target_id],c);
item_id++;
}
@@ -2768,6 +2768,13 @@ int handleClientsWithPendingReadsUsingThreads(void) {
io_threads_pending[j] = count;
}
+ listRewind(io_threads_list[server.io_threads_num],&li);
+ while((ln = listNext(&li))) {
+ client *c = listNodeValue(ln);
+ readQueryFromClient(NULL,c->fd,c,0);
+ }
+ listEmpty(io_threads_list[server.io_threads_num]);
+
/* Wait for all threads to end their work. */
while(1) {
unsigned long pending = 0;