27 февраля 2016 г., 19:07 пользователь Roman Arutyunyan <arut@nginx.com>
написал:
> Можете прислать всю конфигурацию?
>
>
# configuration file /etc/nginx/nginx.conf:
user nginx;
worker_processes 32;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
worker_rlimit_nofile 1048576;
#thread_pool pool_ssd01 threads=32;
#thread_pool pool_ssd02 threads=32;
events {
worker_connections 8196;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
access_log /var/log/nginx/access.log;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
include /etc/nginx/vhosts.d/*.conf;
}
# configuration file /etc/nginx/mime.types:
types {
....
}
# configuration file /etc/nginx/vhosts.d/<server_name>.conf:
map $upstream_hostname $allowed {
<host1> 1;
<host2> 1;
default 0;
}
log_format cache_video '$time_iso8601 $remote_addr "$request" $status
$bytes_sent $upstream_cache_status';
proxy_cache_path /disks/ssd01 levels=1:2 keys_zone=cache_ssd01:32m
use_temp_path=off inactive=7d max_size=210G;
proxy_cache_path /disks/ssd02 levels=1:2 keys_zone=cache_ssd02:32m
use_temp_path=off inactive=7d max_size=210G;
split_clients $request_uri $disk {
50% ssd01;
50% ssd02;
}
server {
listen <server_ip> default_server;
access_log /var/log/nginx/<server_name>-cache.log cache_video;
access_log /var/log/nginx/<server_name>-access.log;
error_log /var/log/nginx/<server_name>-error.log info;
root /var/www/vhosts/<server_name>;
resolver <resolver_ip>;
proxy_max_temp_file_size 0;
location /streams/ {
location ~
^/streams/(?<upstream_hostname>[^/]+)/(?<upstream_uri>.*)$ {
if ($allowed = 0) {
return 403;
}
#aio threads=pool_$disk;
#sendfile on;
slice 10m;
limit_rate 1M;
limit_rate_after 2M;
proxy_pass http://
$upstream_hostname/$upstream_uri$is_args$args;
proxy_set_header Host $upstream_hostname;
proxy_set_header Range $slice_range;
proxy_cache_min_uses 10;
proxy_cache cache_$disk;
proxy_cache_key
$upstream_hostname$upstream_uri$slice_range;
proxy_cache_revalidate on;
proxy_cache_bypass $arg_start;
proxy_no_cache $arg_start;
proxy_cache_lock on;
proxy_cache_use_stale error timeout invalid_header
updating http_500 http_502 http_503 http_504 http_403;
}
}
}
> Кроме того, можете проследить открытые дескрипторы у воркеров nginx и их
> изменение со временем? В особенности, растет ли их число и, если растет,
> то
> за счет чего именно.
>
Поставил
#!/bin/bash
DIR="/var/log/nginx-lsof"
STAMP=`date +"%Y%m%d%H%M"`
out_dir="$DIR/$STAMP"
[ ! -d "$out_dir" ] && mkdir -p "$out_dir"
/bin/ps wwho pid,args -C nginx-debug | cut -f 1,3 -d ' ' | while read pid
type
do
out_file="$out_dir/nginx-$type-$pid.log"
lsof -p "$pid" > $out_file
done
в крон раз в 5 минут. Посмотрим.
_______________________________________________
nginx-ru mailing list
nginx-ru@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-ru