Skip to content

Enhance IO Threaded: use main thread to handle read/write work#6110

Merged
antirez merged 2 commits intoredis:unstablefrom
soloestoy:enhance-io-threaded
Jan 13, 2020
Merged

Enhance IO Threaded: use main thread to handle read/write work#6110
antirez merged 2 commits intoredis:unstablefrom
soloestoy:enhance-io-threaded

Conversation

@soloestoy
Copy link
Contributor

Hi @antirez , the Threaded IO feature has a good performance, but now it works in busy loop mode, that looks a bit wasteful, especially the main thread.

After main thread distributes IO jobs to IO threads, it can only wait until all jobs done, do nothing but loop, here I think we can use the main thread's loop time to handle the IO jobs, just take the main thread as an IO thread at this time.

I test this mode, in the write side can optimize 25% or more depends on the io-threads, but the read side doesn't optimize much, you know.

@soloestoy
Copy link
Contributor Author

Hi @antirez , please have a look about this PR, since we are near Redis 6 RC1 and I think threaded-io is an important feature.

@madolson
Copy link
Contributor

I agree this should be in RC1, it's low hanging fruit that further improves performance and is much more efficient.

@antirez
Copy link
Contributor

antirez commented Jan 13, 2020

Hello @soloestoy, @madolson, this is a great idea. And not just because we add a new thread to our pool, this moreover avoids that the main thread waits so much time in a busy loop, that can be a problem even from the POV of the kernel scheduler. I didn't check but I imagine that, after this change, we no longer have the problem that we had before, that is: when the configured number of threads exceeded the number of cores, it was likely for the threaded implementation to be slower. Merging it right now. Thanks!

@antirez antirez merged commit 2489642 into redis:unstable Jan 13, 2020
antirez added a commit that referenced this pull request Jan 13, 2020
antirez added a commit that referenced this pull request Jan 13, 2020
antirez added a commit that referenced this pull request Feb 4, 2020
antirez added a commit that referenced this pull request Feb 4, 2020
JackieXie168 pushed a commit to JackieXie168/redis that referenced this pull request Feb 20, 2020
Enhance IO Threaded: use main thread to handle read/write work
JackieXie168 pushed a commit to JackieXie168/redis that referenced this pull request Feb 20, 2020
JackieXie168 pushed a commit to JackieXie168/redis that referenced this pull request Feb 20, 2020
kasiawasiuta pushed a commit to kasiawasiuta/redis that referenced this pull request Mar 11, 2020
kasiawasiuta pushed a commit to kasiawasiuta/redis that referenced this pull request Mar 11, 2020
jschmieg pushed a commit to jschmieg/redis that referenced this pull request Mar 23, 2020
jschmieg pushed a commit to jschmieg/redis that referenced this pull request Mar 23, 2020
jschmieg pushed a commit to jschmieg/redis that referenced this pull request Mar 24, 2020
jschmieg pushed a commit to jschmieg/redis that referenced this pull request Mar 24, 2020
jschmieg pushed a commit to pmem/redis that referenced this pull request Mar 24, 2020
jschmieg pushed a commit to pmem/redis that referenced this pull request Mar 24, 2020
jschmieg pushed a commit to pmem/redis that referenced this pull request Apr 29, 2020
jschmieg pushed a commit to pmem/redis that referenced this pull request Apr 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants