サーバ:Intel® Core™ i7-3930K 6 core, 64 GB DDR3 RAM, 2 x 3 TB 6 Gb/s HDD SATA3
OS (名前 -a):Linux *** 3.2.0-4-amd64 #1 SMP Debian 3.2.65-1+deb7u1 x86_64 GNU/Linux
Redis server 2.8.19
サーバー上で Redis サーバーをスピンします。そのタスクは、2 つの PHP サーバーからの要求を処理することです。問題: サーバーがピーク時の負荷に対応できず、着信要求の処理を停止するか、処理が非常に遅くなります。
私が行ったサーバーを最適化する試み:
cat /etc/rc.local
echo never > /sys/kernel/mm/transparent_hugepage/enabled
ulimit -SHn 100032
echo 1 > /proc/sys/net/ipv4/tcp_tw_reuse
cat /etc/sysctl.conf
vm.overcommit_memory=1
net.ipv4.tcp_max_syn_backlog=65536
net.core.somaxconn=32768
fs.file-max=200000
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 1
cat /etc/redis/redis.conf
tcp-backlog 32768
maxclients 100000
redis.ioブログにある で見つけた設定は何ですか。
テスト
redis-benchmark -c 1000 -q -n 10 -t get,set
SET: 714.29 requests per second
GET: 714.29 requests per second
redis-benchmark -c 3000 -q -n 10 -t get,set
SET: 294.12 requests per second
GET: 285.71 requests per second
redis-benchmark -c 6000 -q -n 10 -t get,set
SET: 175.44 requests per second
GET: 192.31 requests per second
顧客の数を増やすことでクエリのパフォーマンスが低下し、最悪の場合、Redis-server が受信した要求の処理を停止し、PHP のサーバーには数十種類の例外があります
Uncaught exception 'RedisException' with message 'Connection closed' in [no active file]:0\n
Stack trace:\n
#0 {main}\n thrown in [no active file] on line 0
何をすべきか?他に何を最適化しますか? そのような機械はどのように顧客を引き付けることができますか?
ありがとうございました!