Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redis执行指令时候不是单线程执行的吗,为什么还要锁? #222

Open
zhuichen opened this issue Jun 20, 2024 · 4 comments
Open

Comments

@zhuichen
Copy link

请教一下,Redis执行指令时候不是单线程执行的吗,为什么还要锁?接收网络请求时候是多线程,但是指令的执行是在一个线程里面的吧,理论上来说不是应该不需要锁吗

@HDT3213
Copy link
Owner

HDT3213 commented Jun 21, 2024

redis 是单线程,但你看 godis 的代码像是串行的吗?

@zhuichen
Copy link
Author

redis 是单线程,但你看 godis 的代码像是串行的吗?

那godis实现时候为什么不参考redis的实现,单线程执行指令,性能是不是会更高?

@HDT3213
Copy link
Owner

HDT3213 commented Jun 25, 2024

单线程性能更高?您认真的?

@zhuichen
Copy link
Author

单线程性能更高?您认真的?
那为什么redis 最新的版本还是单线程执行指令,只是多线程接受网络数据,我看了一下redis,他是采用单线eventloop的方式处理指令的

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

No branches or pull requests

2 participants