Answer the question
In order to leave comments, you need to log in
What causes a lot of broken links when testing?
Добрый день,
Кто с таким сталкивался, скажите в чём может быть причина сбросов сервера
в 100 одновременных потоков?
На старом сервере Apache+Nginx если тестировать сайт в 100 потоков, "битых"
ссылок примерно в 100 раз меньше, чем на новом в связке Nginx+php-fpm?
Под битыми ссылками имеется в виду, сервер не ответил на этот запрос в данную
секунду времени. Если "битую" ссылку открыть в браузере, то работает
без проблем.
Конфигурационные файлы Nginx:
nginx.conf:
-----------------------------------------------------------------
user nginx;
worker_processes 4;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
server_names_hash_bucket_size 10240;
include /etc/nginx/conf.d/*.conf;
}
site.vhost:
-----------------------------------------------------------------
server {
listen *:80;
server_name site.com www.site.com;
root /var/www/site.com/web;
index index.php index.html index.htm;
#location ~ \.shtml$ {
# ssi on;
#}
error_log /var/log/ispconfig/httpd/site.com/error.log;
access_log /var/log/ispconfig/httpd/site.com/access.log combined;
location ~ /\. {
deny all;
access_log off;
log_not_found off;
}
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
# Static Contents
location ~* ^.+.(jpg|jpeg|gif|png|ico|zip |tgz|gz|rar
|bz2|doc|xls|pdf|ppt |txt|tar|mid|midi|wav|
bmp|rtf)$ {
access_log off;
log_not_found off;
expires 1y;
}
# CSS and JS
location ~* ^.+.(css|js)$ {
access_log off;
log_not_found off;
}
server_tokens off;
recursive_error_pages off;
fastcgi_intercept_errors on;
client_max_body_size 20m;
client_body_buffer_size 128k;
location ~ \.(tpl|log|sql)$ {deny all; access_log off; log_not_found off; }
# Pass PHP scripts to PHP-FPM
location ~* \.php$ {
if (!-e $document_root$document_uri){return 404;}
fastcgi_index index.php;
#fastcgi_pass 127.0.0.1:9000;
fastcgi_pass unix:/var/lib/php5-fpm/web2.sock;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
}
location / {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
#fastcgi_pass 127.0.0.1:9000;
fastcgi_pass unix:/var/lib/php5-fpm/web2.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
fastcgi_read_timeout 900s; # 15 minutes
access_log off;
root /var/www/site.com/web;
}
}
php-fpm.d/site.conf:
-----------------------------------------------------------------
[site]
listen = /var/lib/php5-fpm/web2.sock
listen.owner = web2
listen.group = client1
listen.mode = 0660
user = web2
group = client1
request_slowlog_timeout = 5s
slowlog = /var/log/php-fpm/slowlog-site.log
listen.allowed_clients = 127.0.0.1
pm = dynamic
pm.max_children = 9
pm.start_servers = 3
pm.min_spare_servers = 2
pm.max_spare_servers = 5
pm.max_requests = 200
listen.backlog = -1
pm.status_path = /status
request_terminate_timeout = 120s
rlimit_files = 131072
rlimit_core = unlimited
catch_workers_output = yes
env[HOSTNAME] = $HOSTNAME
chdir = /
php_admin_value[open_basedir] = /var/www/clients/client1/site
php_admin_value[session.save_path] = /var/www/clients/site/tmp
php_admin_value[upload_tmp_dir] = /var/www/clients/site/tmp
Answer the question
In order to leave comments, you need to log in
To mine the answer is quite obvious.
you used to use it exclusively as a proxy and it was enough.
Now you have increased the number of simultaneous connections
and uptime.
Increase both values and that's it.
Set fpm to a port, not a socket. It's strange, but this way it works more stable under heavy loads and a large number of requests.
It is also not recommended to use pm = dynamic for highload. It is better to calculate the approximate number of workers depending on the loads.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question