Skip to content

Commit 7673b7d

Browse files
authored
Merge pull request Snailclimb#1882 from NoctisZhao/patch-2
Update redis-questions-01.md
2 parents 7ca4754 + be91dc0 commit 7673b7d

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

docs/database/redis/redis-questions-01.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -364,17 +364,21 @@ Redis 通过 **IO 多路复用程序** 来监听来自客户端的大量连接
364364

365365
虽然,Redis6.0 引入了多线程,但是 Redis 的多线程只是在网络数据的读写这类耗时操作上使用了,执行命令仍然是单线程顺序执行。因此,你也不需要担心线程安全问题。
366366

367-
Redis6.0 的多线程默认是禁用的,只使用主线程。如需开启需要修改 redis 配置文件 `redis.conf`
367+
Redis6.0 的多线程默认是禁用的,只使用主线程。如需开启需要设置IO线程数 > 1,需要修改 redis 配置文件 `redis.conf`
368368

369369
```bash
370-
io-threads-do-reads yes
370+
io-threads 4 #设置1的话只会开启主线程,官网建议4核的机器建议设置为2或3个线程,8核的建议设置为6个线程
371371
```
372+
另外:
373+
- io-threads的个数一旦设置,不能通过config动态设置
374+
- 当设置ssl后,io-threads将不工作
372375

373-
开启多线程后,还需要设置线程数,否则是不生效的。同样需要修改 redis 配置文件 `redis.conf` :
376+
开启多线程后,默认只会使用多线程进行IO写入writes,即发送数据给客户端,如果需要开启多线程IO读取reads,同样需要修改 redis 配置文件 `redis.conf` :
374377

375378
```bash
376-
io-threads 4 #官网建议4核的机器建议设置为2或3个线程,8核的建议设置为6个线程
379+
io-threads-do-reads yes
377380
```
381+
但是官网描述开启多线程读并不能有太大提升,因此一般情况下并不建议开启
378382

379383
相关阅读:
380384

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy