Welcome! Log In Create A New Profile

Advanced

high sevrer load

Posted by maidos 
high sevrer load
January 03, 2011 08:18AM
top - 16:30:48 up 2 days, 13:39, 2 users, load average: 13.84, 15.46, 16.05
Tasks: 267 total, 11 running, 256 sleeping, 0 stopped, 0 zombie
Cpu0 : 22.3%us, 3.2%sy, 0.0%ni, 74.4%id, 0.1%wa, 0.0%hi, 0.0%si, 0.0%st
Cpu1 : 23.0%us, 3.3%sy, 0.0%ni, 73.6%id, 0.1%wa, 0.0%hi, 0.0%si, 0.0%st
Cpu2 : 23.1%us, 3.3%sy, 0.0%ni, 72.7%id, 0.8%wa, 0.0%hi, 0.0%si, 0.0%st
Cpu3 : 24.5%us, 3.5%sy, 0.0%ni, 71.8%id, 0.2%wa, 0.0%hi, 0.0%si, 0.0%st
Cpu4 : 29.1%us, 4.9%sy, 0.0%ni, 65.8%id, 0.1%wa, 0.0%hi, 0.0%si, 0.0%st
Cpu5 : 28.7%us, 4.8%sy, 0.0%ni, 66.4%id, 0.1%wa, 0.0%hi, 0.0%si, 0.0%st
Cpu6 : 28.4%us, 4.6%sy, 0.0%ni, 66.6%id, 0.3%wa, 0.0%hi, 0.0%si, 0.0%st
Cpu7 : 24.4%us, 4.1%sy, 0.0%ni, 70.3%id, 0.4%wa, 0.1%hi, 0.7%si, 0.0%st
Mem: 8127236k total, 5833088k used, 2294148k free, 278568k buffers
Swap: 16771840k total, 0k used, 16771840k free, 3861588k cached

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
6870 mysql 5 -10 480m 162m 4944 S 130.2 2.0 250:50.82 mysqld
15925 ye 16 0 334m 38m 21m S 29.4 0.5 0:43.68 php-fpm
16005 ye 15 0 334m 38m 20m S 29.4 0.5 0:10.47 php-fpm
16006 ye 15 0 334m 38m 21m S 29.4 0.5 0:10.87 php-fpm
15939 ye 15 0 334m 41m 23m S 28.4 0.5 0:43.67 php-fpm
15938 ye 16 0 330m 35m 21m S 27.4 0.4 0:43.76 php-fpm
15972 ye 16 0 330m 34m 20m S 27.4 0.4 0:27.34 php-fpm
15998 ye 16 0 334m 38m 21m S 26.4 0.5 0:16.19 php-fpm
15984 ye 16 0 334m 39m 21m S 25.5 0.5 0:26.21 php-fpm
16003 ye 16 0 329m 33m 20m S 25.5 0.4 0:12.02 php-fpm
16033 ye 16 0 329m 31m 18m S 25.5 0.4 0:00.55 php-fpm
15929 ye 16 0 329m 34m 21m S 20.6 0.4 0:42.11 php-fpm
15986 ye 16 0 334m 38m 20m R 20.6 0.5 0:21.93 php-fpm
15996 ye 16 0 330m 34m 21m S 20.6 0.4 0:16.39 php-fpm
15947 ye 15 0 334m 38m 21m S 19.6 0.5 0:35.69 php-fpm
15951 ye 16 0 334m 38m 21m S 19.6 0.5 0:35.52 php-fpm
16007 ye 16 0 334m 38m 20m R 19.6 0.5 0:10.60 php-fpm
15936 ye 16 0 335m 39m 21m R 18.6 0.5 0:40.00 php-fpm
15988 ye 16 0 334m 40m 22m S 18.6 0.5 0:23.23 php-fpm
15995 ye 16 0 331m 37m 22m R 17.6 0.5 0:16.27 php-fpm
15926 ye 16 0 330m 34m 21m R 16.6 0.4 0:43.60 php-fpm
15908 ye 16 0 336m 39m 22m R 14.7 0.5 0:50.33 php-fpm
15933 ye 16 0 334m 39m 21m S 9.8 0.5 0:41.90 php-fpm
16002 ye 16 0 334m 38m 21m S 9.8 0.5 0:12.24 php-fpm
15907 ye 15 0 337m 39m 21m R 7.8 0.5 0:48.16 php-fpm
15990 ye 15 0 334m 38m 21m S 4.9 0.5 0:24.83 php-fpm
16004 ye 16 0 349m 54m 20m S 4.9 0.7 0:10.69 php-fpm
16032 ye 16 0 328m 32m 20m S 4.9 0.4 0:00.91 php-fpm
15932 ye 16 0 335m 39m 21m R 2.9 0.5 0:44.92 php-fpm
15989 ye 16 0 329m 33m 21m S 2.9 0.4 0:23.48 php-fpm



heres settings of the php fpm
[quote]
;
; All relative paths in this config are relative to php's install prefix
;
;
; Include one or more files.
; If glob(3) exists, it's used to include a bunch of files from a glob(3) pattern
; This directive can be used everywhere in the file.
;
;include=/usr/php5-fpm/etc/fpm.d/*.conf
;
;

[global]
; Pid file
; default: none
;
pid = /var/run/php-fpm.pid

; Error log file
; default: /usr/php5-fpm/var/log/php-fpm.log
;
error_log = /var/log/php-fpm.log

; Log level
; alert, error, warning, notice, debug
; default: notice
;
log_level = error

; When this amount of php processes exited with SIGSEGV or SIGBUS ...
; 0 means 'Off'
; default: 0
;
emergency_restart_threshold = 0

; ... in a less than this interval of time, a graceful restart will be initiated.
; Useful to work around accidental curruptions in accelerator's shared memory.
; available units are s(econd), m(inute), h(hour), or d(day)
; default : 0s
;
emergency_restart_interval = 0s

; Time limit on waiting child's reaction on signals from master
; available units are s(econd), m(inute), h(hour), or d(day)
; default : 0s
;
process_control_timeout = 0s

; send fpm to backgound (default)
; set to 'no' to keep FPM in foreground for debugging
; default : yes
;
daemonize = yes

; Start a new pool named 'www'
; The name is used in logs and stats
; There is no limitation of the number of pool FPM can handle. Your system will tell you anyway :)
[www]

; Address to accept fastcgi requests on.
; Valid syntaxes are:
; - 'ip.ad.re.ss:port' to listen on a TCP scoket to the specific address on the specific port
; - 'port' to listen on a TCP socket to all addreses on the specific port
; - '/path/to/unix/socket' to listen on a unix socket
; it's mandatory
;
listen = /dev/shm/php5-fpm.sock

; Set listen(2) backlog
; -1 means unlimited
; default : -1
;
;listen.backlog = -1

; List of ipv4 addresses of FastCGI clients that allowed to connect.
; Equivalent to FCGI_WEB_SERVER_ADDRS environment in original php.fcgi (5.2.2+)
; Makes sense only with a tcp listening socket.
; Each addresses must be separated by a comma
; default: any
;
;listen.allowed_clients = 127.0.0.1

; Set permissions for unix socket, if one used.
; In Linux read/write permissions must be set in order to allow connections from web server.
; Many BSD-derrived systems allow connections regardless of permissions.
; default: user and group are set as the running user. Mode is set to 0666
;
listen.owner = apache
listen.group = apache
listen.mode = 0660

; Unix user/group of processes
; The user is mandatory. If the group is not set, the default user's group
; will be used
user = apache
group = apache

; Choose the process manager which control how processes are managed
; Two choices:
; - static : a fixed number (pm.max_children) of child processes
; - dynamic : The number of child processes are set up dynamically depending on the following directives
; - pm.max_children : the maximum number of children that can be alive at the same time
; - pm.start_servers : the number of children created on startup
; - pm.min_spare_servers : the minimum number of children in 'idle' state (waiting to precess).
; If the number of 'idle' processes is less than this number,
; some children will be created.
; - pm.max_spare_servers : the maximum number of children in 'idle' state (waiting to precess).
; If the number of 'idle' processes is greater than this number,
; some children will be killed;
; It's mandatory
pm = static

; Sets the limit on the number of simultaneous requests (children processes will be forked) that will be served.
; Equivalent to Apache MaxClients directive (with mpm_prefork).
; Equivalent to PHP_FCGI_CHILDREN environment in original php.fcgi
; Used with any pm.style.
; It's mandatory
;
pm.max_children = 100

; Sets the number of server processes created on startup.
; Used only with 'dynamic' pm.style
; default : min_spare + (max_spare - min_spare) / 2
;
pm.start_servers = 1

; Sets the desired minimum number of idle server processes.
; Used only with 'dynamic' pm.style
; It's mandatory when pm is set to dynamic
;
pm.min_spare_servers = 1

; Sets the desired maximum number of idle server processes.
; Used only with 'dynamic' pm.style
; It's mandatory when pm is set to dynamic
;
pm.max_spare_servers = 1

; How much requests each process should execute before respawn.
; Useful to work around memory leaks in 3rd party libraries.
; For endless request processing please specify 0
; Equivalent to PHP_FCGI_MAX_REQUESTS
; default : 0
;
pm.max_requests = 10000

; Sets the status URI to call to obtain php-fpm status page.
; If not set, no URI will be recognized as a status page.
; By default, it returns text/plain looking like:
; accepted conn: 12073
; pool: www
; process manager: static
; idle processes: 35
; active processes: 65
; total processes: 100
; "accepted conn" : the number of request accepted by the pool
; "pool" : the name of the pool
; "process manager": static or dynamic
; "idle processes": the number of idle processes
; "active processes": the number of active processes
; "total processes": idle + active
; The last three number are uptaded every second.
; The "accepted conn" is updated in real time
; *** Output ***
; By default it returns text/plain
; But passing as a query string html or json, it will returns
; the corresponding output syntax:
; http://www.foo.bar/status
; http://www.foo.bar/status?json
; http://www.foo.bar/status?html
; *** WARNING ***
; It has to start with a /. It could be named has you want.
; It's maybe not a good idea to use .php extension to be certain
; not to conflict with a real PHP file
;
; default: not set
;
;pm.status_path = /status

; Set the ping URI to call the monitoring page of php-fpm
; If not set, no URI will be recognized as a ping page.
; This could be used to test from outside that php-fpm
; is alive and responding:
; - have a graph of php-fpm availability (rrd or such)
; - remove a server from a pool if it's not responding (load balancing systems)
; - trigger alerts for the operating team (24/7)
; *** WARNING ***
; It has to start with a /. It could be named has you want.
; It's maybe not a good idea to use .php extension to be certain
; not to conflict with a real PHP file
;
; default: not set
;
;ping.path = /ping

; Set the response to custom the response of a ping request
; If 'pong' is not set, the default is "pong".
; The response is text/plain with a 200 response code
;
; default: pong
;
;ping.response = pong

; The timeout (in seconds) for serving a single request after which the worker process will be terminated
; Should be used when 'max_execution_time' ini option does not stop script execution for some reason
; '0' means 'off'
; available units are s(econd), m(inute), h(hour), or d(day)
; default: 0
;
request_terminate_timeout = 0s

; The timeout (in seconds) for serving of single request after which a php backtrace will be dumped to slow.log file
; '0s' means 'off'
; available units are s(econd), m(inute), h(hour), or d(day)
; default: 0
;
request_slowlog_timeout = 0s

; The log file for slow requests
; default: /usr/php5-fpm/var/log/php-fpm.log.slow
;
slowlog = /var/log/php-fpm.log.slow

; Set open file desc rlimit
; default: system defined value
;
;rlimit_files = 1024

; Set max core size rlimit
; It could be
; - unlimited
; - an integer greater or equal to 0
; default: system defined value
;
;rlimit_core = 0

; Chroot to this directory at the start, absolute path
; *** WARNING ***
; chrooting is a great security features and should be used whenever it's possible.
; However, all php path will be related to the chroot (error_log, sessions.save_path, ...)
; When not set, chroot is not used
; default: not set
;
;chroot =

; Chdir to this directory at the start, absolute path
; default: current directory or / when chroot
;
;chdir = /

; Redirect workers' stdout and stderr into main error log.
; If not set, they will be redirected to /dev/null, according to FastCGI specs
; default: no
;
catch_workers_output = yes

; Pass environment variables like LD_LIBRARY_PATH
; All $VARIABLEs are taken from current environment
; default: clean env
;
;env[HOSTNAME] = $HOSTNAME
;env[PATH] = /usr/local/bin:/usr/bin:/bin
;env[TMP] = /tmp
;env[TMPDIR] = /tmp
;env[TEMP] = /tmp

; Additional php.ini defines, specific to this pool of workers.
; These settings overwrite the values previously defined in the php.ini.
; The directives are the same as the php sapi:
; - php_value/php_flag: you can set classic ini defines which can be overwriten from PHP call 'ini_set'.
; - php_admin_value/php_admin_flag: those directives won't be overwriten by PHP call 'ini_set'
; For php_*flag, valid values are on, off, 1, 0, true, false, yes or no
;
; Defining 'extension' will load the corresponding shared extension from extension_dir.
; Defining 'disable_functions' or 'disable_classes' won't overwrite previously defined
; php.ini value, but the new value will be append.
;
; default: nothing is defined but the ones in php.ini and at startup with the -d arguement
;
php_flag[display_errors]=off
php_admin_value[error_log]=error_log
php_admin_flag[log_errors]=on

; pools
include=/etc/php-fpm.d/*conf

[/quote]
Re: high sevrer load
January 03, 2011 08:21AM
run latest version of nginx and mysql 5.5

nginx conf
[quote]
user apache;
worker_processes 8;
worker_cpu_affinity 00000001 00000010 00000100 00001000 00010000 00100000 01000000 10000000;
worker_rlimit_nofile 40960;

error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;

pid /var/run/nginx.pid;

events
{
worker_connections 80192;
# Linux kernel 2.6+
use epoll;
}

# Overrides for main Nginx directives
include nginx.custom.conf;

http
{
include 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" "$host"';

log_format bytes '$msec $bytes_sent .';

access_log /dev/null;
#access_log logs/access.log main;

# index pages
index index.html.var index.htm index.html index.shtml index.xhtml index.wml index.perl index.pl index.plx index.ppl index.cgi index.jsp index.js index.jp index.php6 index.php5 index.php4 index.php3 index.php index.phtml default.htm default.html home.htm Default.html Default.htm home.html;

# OBSOLETE limit rate, no longer used since 0.7.21, new format explained below
## limit rate memory buffer, allows up to 320,000 sessions
#limit_zone zoneone $binary_remote_addr 10m;
## limit rate memory buffer, allows up to 320,000 sessions
#limit_zone zonetwo $host 10m;
## 80 connections per IP
#limit_conn zoneone 80;
## 40 connections per $host, set for every server_name

# NEW limit rate should be added to nginx.http.custom.conf or set via own /etc/nginx/ directives.
# limit rate memory buffers, 10m allows up to 320,000 sessions
# 5 req/sec per IP with burst to 500 req in a row, then 503 error
limit_req_zone $binary_remote_addr zone=zoneone:10m rate=5r/s;
limit_req zone=zoneone burst=500 nodelay;
# 200req/sec per host with burst to 2000 req, then 503 error (does it work with per IP limits?)
limit_req_zone $host zone=zonetwo:10m rate=200r/s;

# connects to backend
connection_pool_size 128;

# DDoS protection
reset_timedout_connection on;

# increase number of buffers (to speed up closing connections to backend) and their size (for big cookies sent back to clients)
proxy_buffers 64 256k;
proxy_buffer_size 256k;
large_client_header_buffers 8 512k;

sendfile on;
#tcp_nopush on;
# direct access, speed up for big files
directio 1m;
directio_alignment 4k;

client_max_body_size 256m;

server_names_hash_max_size 262144;
server_names_hash_bucket_size 128;

#keepalive_timeout 0;
keepalive_timeout 10;

resolver_timeout 1s;

gzip on;
gzip_comp_level 9;
gzip_proxied any;
gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript image/x-icon image/png;
gzip_disable msie6;

# temp paths
client_body_temp_path /dev/shm/client_body_temp;
proxy_temp_path /dev/shm/proxy_temp 1 2;
fastcgi_temp_path /dev/shm/fastcgi_temp 1 2;

# fallback proxying (we have two upstream)
proxy_next_upstream error timeout invalid_header http_502 http_503 http_504;

# proxy cache
proxy_cache_path /dev/shm/proxy_cache levels=1:2 keys_zone=proxyone:10m inactive=10m max_size=100m;
proxy_cache_key $host$request_uri$http_authorization$http_cookie;
# if previous key doesn't work, then add cookie to the hash, it shouldn't be required as we have proxy_pass_header Set-Cookie, but...
#proxy_cache_key $host$request_uri$http_authorization$http_cookie;
proxy_cache_use_stale error timeout invalid_header http_502 http_503 http_504;
# proxy cache store policy
proxy_cache proxyone;
proxy_cache_min_uses 1;
proxy_cache_valid 301 1h;
proxy_cache_valid 200 302 10m;
proxy_cache_valid 500 502 503 504 1s;
# 404 should not be cached, otherwise server will timing out on cache responses!
proxy_cache_valid 404 0s;
proxy_cache_valid any 1m;
# fastcgi cache
fastcgi_cache_path /dev/shm/fastcgi_cache levels=1:2 keys_zone=fastcgione:10m inactive=10m max_size=100m;
fastcgi_cache_key $host$request_uri$http_authorization$http_cookie;
# this doesn't work!
#fastcgi_cache_key $host$request_uri;
# fastcgi cache store policy, do not cache 302 & any!
fastcgi_cache fastcgione;
fastcgi_cache_min_uses 1;
fastcgi_cache_valid 301 1h;
fastcgi_cache_valid 200 10m;
fastcgi_cache_valid 500 502 503 504 1s;
fastcgi_pass_header Set-Cookie;
# custom cache settings
include nginx.cache.custom.conf;

# file caching
open_file_cache max=100000 inactive=300s;
open_file_cache_valid 360s;
open_file_cache_min_uses 2;
open_file_cache_errors off;

# Overrides for http Nginx directives
include nginx.http.custom.conf;

# IP based proxying (inside could be either redirects for vhosts or complete configs), need to have at least one config file
include nginx.*.ip.conf;
# Nginx hosts (without Apache backend), need to have at least one config file
include nginx.*.host.conf;

# http end
}
[/quote]
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 289
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready