A
A
Anton B2015-02-12 11:21:06
linux
Anton B, 2015-02-12 11:21:06

How to optimize Redis server for high load?

Good afternoon.
Server : Intel® Core™ i7-3930K 6 cores, 64 GB DDR3 RAM, 2 x 3 TB 6 Gb/s HDD SATA3
OS (uname -a): Linux *** 3.2.0-4-amd64 #1 SMP Debian 3.2 .65-1+deb7u1 x86_64 GNU/Linux
Redis server 2.8.19
The server runs a Redis server, whose task is to serve requests from two PHP servers.
Problem : The server cannot cope with peak loads and stops processing incoming requests or does it very slowly.
What attempts to optimize the server I made:

cat /etc/rc.local
echo never > /sys/kernel/mm/transparent_hugepage/enabled
ulimit -n 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=100000

cat /etc/redis/redis.conf
tcp-backlog 32768
maxclients 100000

I found some settings on redis.io, some in blogs.
Tests
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

With an increase in the number of clients, the speed of processing requests decreases and, worst of all, the Redis server stops processing incoming requests and dozens of exceptions appear on PHP servers like
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

What to do? What else to optimize? How much in general can such a machine pull customers?
Thank you!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Ruslan Luxurious, 2015-02-12
@oshikuru

Dig towards Redis cluster

@
@mgyk, 2015-02-12
_

Check all the same ulimit
On my laptop without optimizations, the benchmark gives the best results

redis-benchmark -c 3000 -q -n 10 -t get,set
SET: 322.58 requests per second
GET: 357.14 requests per second

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question