<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div id="fenix-user-content">
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'NokiaPureTextLight';">Proti tomu se musim ohradit.</span></p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'NokiaPureTextLight';"><br></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'NokiaPureTextLight';">Hostuju weby z alexa 15 000 a se spravnou konfiguraci a slusne napsanou aplikaci s tim neni jedinej problem.</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'NokiaPureTextLight';"> </span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'NokiaPureTextLight';">--</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'NokiaPureTextLight';"> </span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'NokiaPureTextLight';">Sent from my Nokia N9</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'NokiaPureTextLight';"> </span></p></div><br><div id="fenix-reply-header"><p>On 02.12.2015 10:23 Zlatko Fedor wrote:<br></p></div><div id="fenix-quoted-body">Ahoj.<div class=""><br class=""></div><div class="">Pred par mesiacmi som mal podobny problem.</div><div class="">Skusil som naozaj vsetko. Milion nastaveni no stale to robilo to iste s mensim alebo vecsim opakovanim.</div><div class="">Skusal som unix sockery, tcp sokety, rozne cache, dynamic/static childs proste setko co som nasiel. Precital som celu dokumentaciu takze som presne vedel co robim.</div><div class="">Po pol roku som to vzdal a prepisal vsetko do node.js. Podla mojho nazoru je PHP-FPM uplne zabagovane.</div><div class="">Predtym som pouzival apache s php a nemal som jediny problem. Ale asi ako ty aj ja som narazil vtedy na jeho limity.</div><div class=""><br class=""></div><div class="">Viem ze som ti asi nepomohol len ta chcem pripravit aj na moznost ze PHP FPM nieje kvalitny softver.</div><div class=""><br class=""></div><div class="">S pozdravom </div><div class="">Zlatko Fedor</div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On 02 Dec 2015, at 09:56, Branislav Viest <<a href="mailto:info@branoviest.com" class="">info@branoviest.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class=""><div style="font-family: arial, helvetica, sans-serif; font-size: 12pt;" class=""><div class="">tohle je vytezek z php-fpm logu<br class=""></div><div class=""><br data-mce-bogus="1" class=""></div><div class="">[02-Dec-2015 09:54:39.867720] WARNING: pid 5043, fpm_request_check_timed_out(), line 269: [pool web1] child 24945, script 'xxxwww//index.php' (request: "GET /index.php") executing too slow (5.799737 sec), logging # to je jasny<br class="">[02-Dec-2015 09:54:39.867981] DEBUG: pid 5043, fpm_got_signal(), line 76: received SIGCHLD<br class="">[02-Dec-2015 09:54:39.868499] NOTICE: pid 5043, fpm_children_bury(), line 227: child 24945 stopped for tracing<br class="">[02-Dec-2015 09:54:39.868508] NOTICE: pid 5043, fpm_php_trace(), line 144: about to trace 24945<br class="">[02-Dec-2015 09:54:39.868731] NOTICE: pid 5043, fpm_php_trace(), line 172: finished trace of 24945<br class="">[02-Dec-2015 09:54:39.869145] NOTICE: pid 5043, fpm_children_bury(), line 227: child 28359 stopped for tracing<br class="">[02-Dec-2015 09:54:39.869161] NOTICE: pid 5043, fpm_php_trace(), line 144: about to trace 28359<br class="">[02-Dec-2015 09:54:39.869415] NOTICE: pid 5043, fpm_php_trace(), line 172: finished trace of 28359<br class="">[02-Dec-2015 09:54:39.869893] NOTICE: pid 5043, fpm_children_bury(), line 227: child 33445 stopped for tracing<br class="">[02-Dec-2015 09:54:39.869904] NOTICE: pid 5043, fpm_php_trace(), line 144: about to trace 33445<br class="">[02-Dec-2015 09:54:39.870101] NOTICE: pid 5043, fpm_php_trace(), line 172: finished trace of 33445<br class="">[02-Dec-2015 09:54:39.870602] NOTICE: pid 5043, fpm_children_bury(), line 227: child 36581 stopped for tracing<br class="">[02-Dec-2015 09:54:39.870615] NOTICE: pid 5043, fpm_php_trace(), line 144: about to trace 36581<br class="">[02-Dec-2015 09:54:39.870884] NOTICE: pid 5043, fpm_php_trace(), line 172: finished trace of 36581<br class="">[02-Dec-2015 09:54:39.871187] NOTICE: pid 5043, fpm_children_bury(), line 227: child 37001 stopped for tracing<br class="">[02-Dec-2015 09:54:39.871195] NOTICE: pid 5043, fpm_php_trace(), line 144: about to trace 37001<br class="">[02-Dec-2015 09:54:39.871460] NOTICE: pid 5043, fpm_php_trace(), line 172: finished trace of 37001<br class="">[02-Dec-2015 09:54:39.872162] DEBUG: pid 5043, fpm_got_signal(), line 76: received SIGCHLD<br class="">[02-Dec-2015 09:54:39.872582] DEBUG: pid 5043, fpm_got_signal(), line 76: received SIGCHLD<br class="">[02-Dec-2015 09:54:39.872950] DEBUG: pid 5043, fpm_got_signal(), line 76: received SIGCHLD<br class="">[02-Dec-2015 09:54:39.873295] DEBUG: pid 5043, fpm_got_signal(), line 76: received SIGCHLD<br class="">[02-Dec-2015 09:54:39.873616] DEBUG: pid 5043, fpm_event_loop(), line 424: event module triggered 1 events<br class=""></div><div class=""><br class=""></div><div data-marker="__SIG_PRE__" class="">S pozdravem<br class="">Branislav Viest<br class=""><br class=""></div><br class=""><hr id="zwchr" data-marker="__DIVIDER__" class=""><div data-marker="__HEADERS__" class=""><b class="">Od: </b>"Věroslav Kaplan" <<a href="mailto:veros.kaplan@gmail.com" class="">veros.kaplan@gmail.com</a>><br class=""><b class="">Komu: </b>"vpsFree.cz Community list" <<a href="mailto:community-list@lists.vpsfree.cz" class="">community-list@lists.vpsfree.cz</a>><br class=""><b class="">Odoslané: </b>streda, 2. december 2015 9:48:22<br class=""><b class="">Predmet: </b>{Disarmed} [vpsFree.cz: community-list] {Disarmed} Re: php pro nginx high load<br class=""></div><br class=""><div data-marker="__QUOTED_TEXT__" class=""><div dir="ltr" class=""><div class="gmail_default" style="font-size: small;" data-mce-style="font-size: small;">Ahoj,</div><div class="gmail_default" style="font-size: small;" data-mce-style="font-size: small;"><br class=""></div><div class="gmail_default" style="font-size: small;" data-mce-style="font-size: small;">Tohle vypadá, že PHP-FPM z nějakého důvodu zavře to fcgi spojení. Dokážeš vytáhnout nějaké podezřelé logy z toho PHP-FPM a zkusit uhodnout, proč to dělá ?</div><div class="gmail_default" style="font-size: small;" data-mce-style="font-size: small;"><br class=""></div><div class="gmail_default" style="font-size: small;" data-mce-style="font-size: small;">--Věroš Kaplan</div><div class="gmail_default" style="font-size: small;" data-mce-style="font-size: small;"><a href="http://veroskaplan.cz/" target="_blank" class="">http://veroskaplan.cz/</a></div><div class="gmail_default" style="font-size: small;" data-mce-style="font-size: small;">Školíme Ansible: <a href="http://ansible.cz/" target="_blank" class="">http://ansible.cz/</a></div></div><div class="gmail_extra"><br class=""><div class="gmail_quote">2015-12-02 8:25 GMT+01:00 Branislav Viest <span dir="ltr" class=""><<a href="mailto:info@branoviest.com" target="_blank" class="">info@branoviest.com</a>></span>:<br class=""><blockquote class="gmail_quote" style="margin: 0 0 0 .8ex; border-left: 1px #ccc solid; padding-left: 1ex;" data-mce-style="margin: 0 0 0 .8ex; border-left: 1px #ccc solid; padding-left: 1ex;"><div class=""><div style="font-family: arial, helvetica, sans-serif; font-size: 12pt;" data-mce-style="font-family: arial,helvetica,sans-serif; font-size: 12pt; color: #000000;" class=""><div class="">Ahoj,</div><br class=""><div class="">mám tady jeden server kde je cca 35k lidí za vteřinu. Běží tu nginx + php fpm a mysql db. V nginxu jsem rozjel microcache, což hodně ulevilo zátěži serveru. Nicméně, mám problém s PHPkem. FPM běží přes TCP (zkoušel jsem i unix socket nicméně bylo to pomalější a docházelo ke stejnému problému). Dle error logu dochází k těmto chybám:</div><br class=""><div class="">2015/12/01 23:26:56 [error] 27043#0: *122476 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 188.114.98.51, server: xxx request: "GET /xxx/xxxx/xxx HTTP/1.1", upstream: "fastcgi://<a href="http://127.0.0.1:9000/" target="_blank" class=""><span data-mce-style="color: red;" style="color: red;" class=""><b class="">MailScanner has detected a possible fraud attempt from "127.0.0.1:9000" claiming to be</b></span> <span data-mce-style="color: red;" style="color: red;" class=""><b class="">MailScanner warning: numerical links are often malicious:</b></span> 127.0.0.1:9000</a>", host: "xxxx", referrer: "<a href="http://xxxxx/" target="_blank" class=""><span data-mce-style="color: red;" style="color: red;" class=""><b class="">MailScanner has detected a possible fraud attempt from "xxxxx" claiming to be</b></span> http://xxxxx</a>"<br class="">2015/12/01 23:26:56 [error] 27032#0: *124368 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 188.114.99.50, server: xxxxxx, request: "GET /xxxxx/xxxxx HTTP/1.1", upstream: "fastcgi://<a href="http://127.0.0.1:9000/" target="_blank" class=""><span data-mce-style="color: red;" style="color: red;" class=""><b class="">MailScanner has detected a possible fraud attempt from "127.0.0.1:9000" claiming to be</b></span> <span data-mce-style="color: red;" style="color: red;" class=""><b class="">MailScanner warning: numerical links are often malicious:</b></span> 127.0.0.1:9000</a>", host: "xxxxx", referrer: "xxxxx"</div><br class=""><div class="">a sype to tam docela drsně. Jak vypnu kešování v nginxu load vyskočí, třeba i na 500, těch chyb PHPka je méně ale jsou tam pořád. </div><br class=""><div class="">Konfigurace FPM pro pool toho webu je:</div><br class=""><div class="">[web1]<br class=""><br class="">listen = <a href="http://127.0.0.1:9000/" target="_blank" class=""><span data-mce-style="color: red;" style="color: red;" class=""><b class="">MailScanner has detected a possible fraud attempt from "127.0.0.1:9000" claiming to be</b></span> <span data-mce-style="color: red;" style="color: red;" class=""><b class="">MailScanner warning: numerical links are often malicious:</b></span> 127.0.0.1:9000</a><br class="">listen.allowed_clients = 127.0.0.1<br class="">listen.owner = web1<br class="">listen.group = client0<br class="">listen.mode = 0660<br class="">listen.backlog = 65536<br class=""><br class="">user = web1<br class="">group = client0<br class=""><br class="">request_slowlog_timeout = 5s<br class="">slowlog = /var/log/php-fpm/slowlog-web1.log<br class=""><br class="">pm = dynamic<br class="">pm.max_children = 7000<br class="">pm.start_servers = 4000<br class="">pm.min_spare_servers = 2000<br class="">pm.max_spare_servers = 4000<br class="">pm.max_requests = 100<br class=""><br class="">request_terminate_timeout = 60s<br class="">rlimit_files = 500000<br class="">rlimit_core = unlimited<br class="">catch_workers_output = yes<br class=""><br class="">pm.status_path = /php-status<br class=""><br class="">chdir = /<br class=""></div><br class=""><div class="">+ openbasedir, sessions save path. atp.</div><br class=""><div class="">S těma hodnotama jsem se zkoušel různě hrát, nicméně to k vyřešení tohoto problému nepomohlo. Zkoušel jsem upravit i nějaké parametry jádra (local port range, tcp ack timeouty atp.) ale výsledek stejný. Dělá to i u unix socketu, což je mi právě zvláštní. Nginx konfigurace je:</div><div class="">user www-data;<br class="">worker_processes 80;<br class="">pid /run/nginx.pid;<br class=""># set open fd limit to 50000<br class="">worker_rlimit_nofile 100000;<br class=""><br class="">events {<br class=""> worker_connections 1024;<br class=""> multi_accept on;<br class=""> use epoll;<br class="">}<br class=""></div><br class=""><div class="">ve vhostu nic zvlastniho, jenom pro php:</div><br class=""><div class=""> fastcgi_split_path_info ^(.+\.php)(/.+)$;<br class=""> fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;<br class=""> include /etc/nginx/fastcgi_params;<br class=""> fastcgi_pass <a href="http://127.0.0.1:9000/" target="_blank" class=""><span data-mce-style="color: red;" style="color: red;" class=""><b class="">MailScanner has detected a possible fraud attempt from "127.0.0.1:9000" claiming to be</b></span> <span data-mce-style="color: red;" style="color: red;" class=""><b class="">MailScanner warning: numerical links are often malicious:</b></span> 127.0.0.1:9000</a>;<br class=""> fastcgi_index index.php;<br class=""> fastcgi_intercept_errors on;<br class=""> fastcgi_read_timeout 4m;<br class=""></div><br class=""><div class="">Dnes bude k tomuto server nový, pro rozdělení zátěže, ale jako fakt nevím jestli to má smysl ve stejné konfiguraci, kvůli těm php chybám. Nenapadá Vás kluci, co s tím? Nebo případně návrh řešení, kterým bych nahradil tohle, při dvou serverech ? Přemýšlím nad MySQL M - M replikací, v DNS round robin a GlusterFS pro data. Ale to phpko mi nedá spát. A dnes večer to už další nápor asi nedá.</div><br class=""><div class="">Díky za rady a konzultace.</div><br class=""><div class="">S pozdravem<span class="HOEnZb"><span data-mce-style="color: #888888;" style="color: #888888;" class=""><br class="">Branislav Viest<br class=""></span></span></div></div></div><br class="">_______________________________________________<br class="">
Community-list mailing list<br class="">
<a href="mailto:Community-list@lists.vpsfree.cz" target="_blank" class="">Community-list@lists.vpsfree.cz</a><br class="">
<a href="http://lists.vpsfree.cz/listinfo/community-list" rel="noreferrer" target="_blank" class="">http://lists.vpsfree.cz/listinfo/community-list</a><br class="">
<br class=""></blockquote></div><br class=""><br clear="all" class=""><br class="">-- <br class=""><div class="gmail_signature"><div dir="ltr" class="">--V.Kaplan</div></div>
</div>
<br class="">_______________________________________________<br class="">Community-list mailing list<br class=""><a href="mailto:Community-list@lists.vpsfree.cz" class="">Community-list@lists.vpsfree.cz</a><br class="">http://lists.vpsfree.cz/listinfo/community-list<br class=""></div></div></div>_______________________________________________<br class="">Community-list mailing list<br class=""><a href="mailto:Community-list@lists.vpsfree.cz" class="">Community-list@lists.vpsfree.cz</a><br class="">http://lists.vpsfree.cz/listinfo/community-list<br class=""></div></blockquote></div><br class=""></div></div><br></body></html>