-
Notifications
You must be signed in to change notification settings - Fork 706
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
fix: resolve blocking issue in redis_writer when off_reply=false #906
Conversation
- Improved the write handling logic in redis_standalone_writer, including added send bytes count and refined ticker logic. - Aligned the redis_standalone_writer buffer size with the reply buffer size for consistent behavior. - Increased the underlying TCP connection write buffer size in the Redis client to 128KiB to minimize short write errors.
之前的写法问题是什么?🤔 |
我这里标注了一下,主要还是reply channel满了,send协程的select阻塞在推入reply过程,无法进入其他case:#903 |
我看到你的改动较多,好像没必要引入锁:
此外:
|
理论上不应该存在性能差异,可能是 buffer 大小设置导致的。主要是 waitReply chan 的 buffer size,bufio 的 buffer size。 |
使用reply channel是否推得进去来flush感觉就像之前的计数send一样,实测确实是计量的方式性能好一点,也能像您之前说的一样避免大key导致的oom问题🤣 |
和计数是有区别的,不是数量到了才发送,是 bufio 的 size 写满后就会自动发送。所以不会有 OOM 问题。 |
懂了,我再调整调整代码😂 |
看起来是目的端关闭的,可能不是竞争导致的。 |
我一开始把他俩写分开了🤣,现在合在一起看着没毛病。我把replyChan大小设置为发送chan的2倍,尽量不触发计量flush,性能就正常了 |
|
第一点我是遇到过短写问题:short write,网上搜索通用的解决办法是增大系统tcp缓冲区,或重写Flush,将短写错误剩余未写入的数据再扔进tcp连接中; |
|
fix: resolve blocking issue in redis_writer when off_reply=false
fix: 修复redis_writer在off_reply=false时写入阻塞问题
issue:#905