nginx status: reading 100-200, writing 1-5. Как побороть?

mikhal123 nginx-forum at nginx.us
Tue Sep 18 13:15:03 UTC 2012


Подскажите, как бороться с тем что большое количество запросов висит в
статуcе reading? На сайте немало мелких файлов, поэтому запросов на чтение
много. Но проблема почему-то не в отдаче (после соединения отдается
практически мгновенно), а в установке самого соединения. Соединение
временами по 300-500 мс устанавливается, что совсем не радует.
worker_processes менял в промежутке от 8 до 32, но как-то особо не влияет.

Сервер не особо загруженный (la < 0.5-0.7), процессор и диск шустрые,
оперативной памяти навалом.
----------------------
http://coolsite.ru/nginx-status

Active connections: 1319 
server accepts handled requests
 25124 25124 46243 
Reading: 128 Writing: 1 Waiting: 1190 
----------------------
nginx -v

nginx version: nginx/1.2.3
----------------------
cat nginx.conf

user www-data;

timer_resolution			100ms;
worker_priority			-5;
worker_processes			16;
worker_rlimit_nofile			65536;
worker_rlimit_sigpending		32768;

pid					/var/run/nginx.pid;

events {
	worker_connections		8192;
	use				epoll;
}

http {
	include			/etc/nginx/mime.types;
	default_type			application/octet-stream;
	server_names_hash_bucket_size	128;

	log_format			main '$remote_addr = $time_local = $request_time =
$body_bytes_sent = "$status" = "$request" = "$http_referer" =
"$http_user_agent"';
	access_log			/dev/null;
	error_log			/var/log/nginx/error.log error;

	client_header_timeout	10;
	client_body_timeout		15;
	client_max_body_size		20m;
	client_header_buffer_size	16k;
	large_client_header_buffers	8 64k;
	send_timeout			10;

	proxy_read_timeout		15s;
	proxy_connect_timeout	15s;
	proxy_send_timeout		15s;
	proxy_buffers			16 64k;
	proxy_buffer_size		32k;

	msie_padding			on;
	ignore_invalid_headers	on;

	gzip				on;
	gzip_static			on;
	gzip_vary			on;
	gzip_min_length		2048;
	gzip_comp_level		5;
	gzip_buffers			16 8k;
	gzip_types			text/plain text/css text/xml text/javascript
application/x-javascript;

	directio			4m;
	sendfile			on;
	sendfile_max_chunk		256k;
	tcp_nopush			on;
	tcp_nodelay			on;
	reset_timedout_connection	on;

	output_buffers 		16 512k;
	postpone_output		1460;

	keepalive_timeout		30 15;
	#optimize_server_names	off;
	server_name_in_redirect	off;

	index				index.php;

	open_file_cache		max=8192	inactive=600s;
	open_file_cache_valid	600s;
	open_file_cache_min_uses	3;
	open_file_cache_errors	on;

	server_tokens			off;

	client_body_temp_path	/var/lib/nginx/body;
	proxy_temp_path		/var/lib/nginx/proxy;
	fastcgi_temp_path		/var/lib/nginx/fastcgi;
	fastcgi_buffers		8 16k;
	fastcgi_buffer_size		32k;
	fastcgi_cache_path		/var/lib/nginx/cache levels=
keys_zone=main_site_zone:32m inactive=5m max_size=1024m;

	server {
		listen				80 default_server sndbuf=512k;
		server_name			coolsite.ru www.coolsite.ru;
		root				/var/www/vhosts/coolsite.ru/httpdocs;
		index				index.php;
		fastcgi_index			index.php;

		location = /_.gif {
			empty_gif;
			expires		30d;
		}

		location ~ \.php$ {
			fastcgi_pass		127.0.0.1:9000;
			fastcgi_param		SCRIPT_FILENAME
/var/www/vhosts/coolsite.ru/httpdocs$fastcgi_script_name;
			include		/etc/nginx/fastcgi_params;

			access_log			/var/log/nginx/access.log main;
		}
	}
}

Posted at Nginx Forum: http://forum.nginx.org/read.php?21,230814,230814#msg-230814



Подробная информация о списке рассылки nginx-ru