Redis 优化之 tcp-backlog

本文介绍如何调整TCP backlog及somaxconn参数以提高服务器处理高并发请求的能力。默认情况下,这些参数的值可能不足以应对高负载情况,通过增大它们的值可以有效提升系统性能。

默认值 511

tcp-backlog:511

此参数确定了TCP连接中已完成队列(完成三次握手之后)的长度, 当然此值必须不大于Linux系统定义的/proc/sys/net/core/somaxconn值,默认是511,而Linux的默认参数值是128。当系统并发量大并且客户端速度缓慢的时候,可以将这二个参数一起参考设定。

建议修改为 2048

修改somaxconn

该内核参数默认值一般是128,对于负载很大的服务程序来说大大的不够。一般会将它修改为2048或者更大。

echo 2048 > /proc/sys/net/core/somaxconn 但是这样系统重启后保存不了

在/etc/sysctl.conf中添加如下

net.core.somaxconn = 2048

然后在终端中执行

sysctl -p

 

 

 

转自:https://my.oschina.net/TOW/blog/684914

转载于:https://www.cnblogs.com/z-books/p/7279218.html

简述以下 redis 参数作用 timeout 1500 port 9030 tcp-keepalive 1000 masterauth rI0DncoAFMSXOEnBCQbCUIlSV0j22Ewv client-output-buffer-limit normal 0 0 0 slave 0 0 0 pubsub 33554432 8388608 60 requirepass rI0DncoAFMSXOEnBCQbCUIlSV0j22Ewv maxmemory 15884901888 zset-max-ziplist-entries 128 min-slaves-max-lag 10 active-defrag-cycle-max 75 replica-read-only yes pidfile /home/dba/redis9030/pay-redis-bn/data/redis.pid hz 10 aof-use-rdb-preamble yes bind 10.67.68.10 repl-diskless-sync-delay 5 hash-max-ziplist-value 64 slave-ignore-maxmemory yes list-compress-depth 0 databases 16 latency-monitor-threshold 0 hash-max-ziplist-entries 512 proto-max-bulk-len 536870912 maxclients 4096 lazyfree-lazy-eviction no hll-sparse-max-bytes 3000 active-defrag-threshold-lower 10 stream-node-max-entries 100 slowlog-max-len 128 zset-max-ziplist-value 64 cluster-slave-no-failover no unixsocket cluster-announce-bus-port 0 lua-time-limit 5000 cluster-replica-validity-factor 10 appendonly no slowlog-log-slower-than 10000 save active-defrag-ignore-bytes 104857600 cluster-slave-validity-factor 10 cluster-announce-ip activerehashing yes stream-node-max-bytes 4096 slave-lazy-flush no rdb-save-incremental-fsync yes list-max-ziplist-size -2 replica-announce-port 0 daemonize yes cluster-replica-no-failover no activedefrag no aof-load-truncated yes no-appendfsync-on-rewrite yes min-replicas-max-lag 10 repl-disable-tcp-nodelay yes loglevel notice cluster-migration-barrier 1 maxmemory-policy allkeys-lfu aof-rewrite-incremental-fsync yes slave-announce-port 0 lfu-decay-time 1 min-replicas-to-write 0 replica-lazy-flush no maxmemory-samples 5 stop-writes-on-bgsave-error yes dir /home/dba/redis9030/pay-redis-bn/data dbfilename dump.rdb min-slaves-to-write 0 repl-diskless-sync no syslog-facility local0 repl-timeout 60 dynamic-hz yes repl-ping-replica-period 10 replica-priority 100 slave-read-only yes auto-aof-rewrite-percentage 100 logfile /home/dba/redis9030/pay-redis-bn/log/redis.log cluster-require-full-coverage yes slaveof notify-keyspace-events rdbcompression yes lfu-log-factor 10 tcp-backlog 511 protected-mode yes lazyfree-lazy-expire no replica-announce-ip slave-serve-stale-data yes unixsocketperm 0 repl-ping-slave-period 10 replica-ignore-maxmemory yes appendfsync always watchdog-period 0 cluster-node-timeout 5000 repl-backlog-size 50000000 lazyfree-lazy-server-del no active-defrag-threshold-upper 100 active-defrag-max-scan-fields 1000 replica-serve-stale-data yes auto-aof-rewrite-min-size 67108864 client-query-buffer-limit 1073741824 rdbchecksum yes slave-announce-ip cluster-announce-port 0 repl-backlog-ttl 3600 slave-priority 100 supervised no set-max-intset-entries 512 active-defrag-cycle-min 5
最新发布
09-17
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值