A
A
Andrey2014-11-22 09:27:45
Nginx
Andrey, 2014-11-22 09:27:45

Distribution of small statics. 1500 rps. How to speed up?

There is a need to distribute many thumbnails of pictures. Now the servers are suffocating, at rush hour there are big delays in the return of statics.
The size of pictures is 5-10kb.
Conducted testing with ab
result 1473 rps. In fact, it's worse because ab asked for the same picture, but in reality there are several million of them.
Do you think there is an opportunity to significantly increase the performance of servers? What can be tweaked in nginx and tcp / ip for a quick return on the picture?
nginx config

worker_processes 8;
events
{
  worker_connections 4096;
  multi_accept on;
} 

access_log off;
log_not_found off;
error_log /var/log/nginx-error.log warn; 

open_file_cache max=2000 inactive=20s;
open_file_cache_valid 60s;
open_file_cache_min_uses 5;
open_file_cache_errors off; 

client_max_body_size 50M;
client_body_buffer_size 1m;
client_body_timeout 15;
client_header_timeout 15;
keepalive_timeout 2 2;
send_timeout 15;
sendfile on;
tcp_nopush on;
tcp_nodelay on;

Server
Xeon E3-1230
RAM 16Gb
SATA drives via Software RAID 1
254f9b887b7246c59cebc6842921f148.png48aaa15ade764b9bb91f3832d8867124.pngbed4211b0f3043738bcb85af24951bd6.pngb6338faec84d4149b6318388a53bf237.png9ee4994c9a224e18b47cc06f7bd51ec1.pngee7257b23de54f458630707b5d2481db.png

Answer the question

In order to leave comments, you need to log in

4 answer(s)
N
neolink, 2014-11-22
@andreyvlru

if you requested 1500rps on an empty server, then this is not enough for one file for ab to be at least 5000rps (or did you run tests on a 100Mbps network?)
suffocate - what is it expressed in? cpu, io?
while it really looks more like that everything rests on Io,
but how do you have these 1k images on the disk (an example of the full path to 1 of them)?
well, the config in the studio

N
Nazar Mokrinsky, 2014-11-22
@nazarpc

What if you connect CloudFlare, set up headers when serving static from the server, and enjoy the free CDN?

R
Renat Ibragimov, 2014-11-22
@MpaK999

If there is memory or another server, then there are 2 options:
- balancer from nginx
- put varnish before nginx

D
Dan Ivanov, 2014-11-23
@ptchol

Turn on the caching of log records, in which data is written for image requests. Something like this:
access_log /var/log/nginx/access.log main buffer=32k;
Check the number of active connections on the machine.
Are there any messages in dmesg about nf_conntrack table overflowing?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question