Welcome! Log In Create A New Profile

Advanced

Re: nginx потребляет процессор больше чем php-fpm

Denis Kot
March 03, 2011 08:32AM
С памятью как раз таки проблем нет.

Вот вывод от обоих воркеров:
# strace -cfp 19970
Process 19970 attached - interrupt to quit
^CProcess 19970 detached
% time seconds usecs/call calls errors syscall
------ ----------- ----------- --------- --------- ----------------
63.93 0.471126 565 834 close
20.61 0.151870 657 231 epoll_wait
4.62 0.034029 45 748 1 writev
4.03 0.029704 59 503 write
2.72 0.020017 50 403 epoll_ctl
1.36 0.010000 88 114 accept
1.36 0.010000 37 271 getsockopt
1.36 0.010000 43 232 gettimeofday
0.01 0.000069 1 124 124 connect
0.01 0.000063 0 129 open
0.00 0.000009 0 124 socket
0.00 0.000000 0 7 4 stat
0.00 0.000000 0 129 fstat
0.00 0.000000 0 238 ioctl
0.00 0.000000 0 93 pread
0.00 0.000000 0 311 readv
0.00 0.000000 0 1073 347 recvfrom
0.00 0.000000 0 116 getsockname
0.00 0.000000 0 94 setsockopt
------ ----------- ----------- --------- --------- ----------------
100.00 0.736887 5774 476 total

# strace -cfp 19969
Process 19969 attached - interrupt to quit
^CProcess 19969 detached
% time seconds usecs/call calls errors syscall
------ ----------- ----------- --------- --------- ----------------
63.62 0.297918 187 1597 close
19.22 0.090000 113 794 epoll_wait
5.51 0.025806 13 1968 592 recvfrom
4.90 0.022959 55 417 7 readv
4.16 0.019473 21 934 write
1.42 0.006664 21 320 getsockopt
1.02 0.004757 4 1308 epoll_ctl
0.07 0.000305 1 427 socket
0.05 0.000213 0 795 gettimeofday
0.03 0.000149 0 958 1 writev
0.01 0.000061 0 427 427 connect
0.00 0.000000 0 73 open
0.00 0.000000 0 18 9 stat
0.00 0.000000 0 73 fstat
0.00 0.000000 0 844 ioctl
0.00 0.000000 0 60 pread
0.00 0.000000 0 417 accept
0.00 0.000000 0 1 shutdown
0.00 0.000000 0 416 getsockname
0.00 0.000000 0 127 setsockopt
------ ----------- ----------- --------- --------- ----------------
100.00 0.468305 11974 1036 total


Denis Kot


3 марта 2011 г. 15:24 пользователь Александр Усов <ooshro@ooshro.org> написал:
> При наличии проблемы нужно не гадать и тыкаться, а диагностировать.
>
> Для анализа использования памяти, можно использовать pmap. Запускаешь pmap
> на первом сервере и на втором, и анализируй карты памяти. Пример:
>
> pmap `pgrep nginx`
> 1208:   nginx: master process /usr/sbin/nginx
> 0000000000400000    592K r-x--  /usr/sbin/nginx
> 0000000000693000      4K r----  /usr/sbin/nginx
> 0000000000694000     64K rw---  /usr/sbin/nginx
> 00000000006a4000     56K rw---    [ anon ]
> 00000000021e7000    268K rw---    [ anon ]
> ....
> 00007f7bc6946000      4K r----  /lib/ld-2.11.1.so
> 00007f7bc6947000      4K rw---  /lib/ld-2.11.1.so
> 00007f7bc6948000      4K rw---    [ anon ]
> 00007fff88492000     84K rw---    [ stack ]
> 00007fff885ff000      4K r-x--    [ anon ]
> ffffffffff600000      4K r-x--    [ anon ]
>  total            17420K
>
> По процесору, для начала можно пыпытатся strace -cfp PID:
>
> strace -cfp 1209
> Process 1209 attached - interrupt to quit
> ^CProcess 1209 detached
> % time     seconds  usecs/call     calls    errors syscall
> ------ ----------- ----------- --------- --------- ----------------
>  67.36    0.000097           1        83           writev
>  19.44    0.000028           1        42           write
>  13.19    0.000019           0        54           epoll_ctl
>   0.00    0.000000           0        43           close
>   0.00    0.000000           0        48           ioctl
>   0.00    0.000000           0       639       285 readv
>
> Дальше можно google-perftool, OProfile и т.д.
>
> 3 марта 2011 г. 16:46 пользователь Denis Kot <denis.kot@gmail.com> написал:
>>
>> Перенес сайт на новый сервер. На старом стоял CentOS и nginx + php-fpm
>> 5.2.11 собранные из сырцов. На новом сервер Gentoo и nginx естественно
>> собран из сырцов так же.
>> На новом сервере nginx постоянно находится в самом верху вывода команды
>> top.
>>
>> Старый сервер:
>> # nginx -V
>> nginx version: nginx/0.8.29
>> TLS SNI support disabled
>> configure arguments: --prefix=/usr --conf-path=/etc/nginx/nginx.conf
>> --http-log-path=/var/log/nginx/access_log
>> --error-log-path=/var/log/nginx/error_log
>> --pid-path=/var/run/nginx.pid
>> --http-client-body-temp-path=/var/tmp/nginx/client
>> --http-proxy-temp-path=/var/tmp/nginx/proxy
>> --http-fastcgi-temp-path=/var/tmp/nginx/fastcgi --with-md5-asm
>> --with-md5=/usr/include --with-sha1-asm --with-sha1=/usr/include
>> --with-http_addition_module --with-http_realip_module
>> --with-http_ssl_module --with-http_perl_module
>> --with-http_stub_status_module --without-mail_pop3_module
>> --without-mail_smtp_module --without-mail_imap_module
>>
>> PHP 5.2.11
>>
>> Новый сервер:
>> # nginx -V
>> nginx version: nginx/0.8.53
>> TLS SNI support enabled
>> configure arguments: --prefix=/usr --sbin-path=/usr/sbin/nginx
>> --conf-path=/etc/nginx/nginx.conf
>> --error-log-path=/var/log/nginx/error_log
>> --pid-path=/var/run/nginx.pid --lock-path=/var/lock/nginx.lock
>> --user=nginx --group=nginx --with-cc-opt=-I/usr/include
>> --with-ld-opt=-L/usr/lib --http-log-path=/var/log/nginx/access_log
>> --http-client-body-temp-path=/var/tmp/nginx/client
>> --http-proxy-temp-path=/var/tmp/nginx/proxy
>> --http-fastcgi-temp-path=/var/tmp/nginx/fastcgi
>> --http-scgi-temp-path=/var/tmp/nginx/scgi
>> --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi --with-file-aio
>> --with-aio_module --with-pcre --without-http_auth_basic_module
>> --without-http_autoindex_module --without-http_browser_module
>> --without-http_empty_gif_module --without-http_geo_module
>> --without-http_limit_req_module --without-http_limit_zone_module
>> --without-http_map_module --without-http_memcached_module
>> --without-http_referer_module --without-http_scgi_module
>> --without-http_ssi_module --without-http_split_clients_module
>> --without-http_userid_module --without-http_uwsgi_module
>> --with-http_addition_module --with-http_gzip_static_module
>> --with-http_realip_module --with-http_stub_status_module
>> --with-http_realip_module --with-http_ssl_module
>> --without-mail_imap_module --without-mail_pop3_module
>> --without-mail_smtp_module
>>
>> PHP 5.3.5-pl0-gentoo
>>
>> Конфиг nginx перенесен со старого сервера без правок.
>>
>> Вывод top такой:
>>  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
>> 19970 nginx     20   0  124m  36m  864 S   28  0.9  18:02.17 nginx
>> 19969 nginx     20   0  129m  41m  864 R   26  1.0  19:09.88 nginx
>> 24247 nginx     20   0  216m  16m   9m R   15  0.4   0:03.00 php-fpm
>> 24289 nginx     20   0  215m  12m 7552 R    9  0.3   0:00.99 php-fpm
>> 24262 nginx     20   0  218m  25m  18m R    9  0.6   0:02.14 php-fpm
>>
>> Иногда CPU у nginx доходит до 50%
>>
>>
>> Как посмотреть чем занят nginx?
>> Может ли влиять TLS SNI support enabled/disabled?
>>
>> Denis Kot
>>
>> _______________________________________________
>> nginx-ru mailing list
>> nginx-ru@nginx.org
>> http://nginx.org/mailman/listinfo/nginx-ru
>
>
> _______________________________________________
> nginx-ru mailing list
> nginx-ru@nginx.org
> http://nginx.org/mailman/listinfo/nginx-ru
>
>

_______________________________________________
nginx-ru mailing list
nginx-ru@nginx.org
http://nginx.org/mailman/listinfo/nginx-ru
Subject Author Posted

nginx потребляет процессор больше чем php-fpm

Denis Kot March 03, 2011 06:48AM

Re: nginx потребляет процессор больше чем php-fpm

Александр Усов March 03, 2011 08:26AM

Re: nginx потребляет процессор больше чем php-fpm

Denis Kot March 03, 2011 08:32AM

Re: nginx потребляет процессор больше чем php-fpm

Александр Усов March 03, 2011 09:38AM

Re: nginx потребляет процессор больше чем php-fpm

Denis Kot March 03, 2011 09:46AM

Re: nginx потребляет процессор больше чем php-fpm

Александр Усов March 03, 2011 09:58AM

Re: nginx потребляет процессор больше чем php-fpm

Denis Kot March 03, 2011 10:08AM

Re: nginx потребляет процессор больше чем php-fpm

Александр Усов March 03, 2011 10:24AM

Re: nginx потребляет процессор больше чем php-fpm

Denis Kot March 03, 2011 10:36AM

Re: nginx потребляет процессор больше чем php-fpm

Александр Усов March 03, 2011 10:44AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 245
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