一些网路相关的问题

1.   redis/mysql这类pconnect链接 对方关闭了链接以后,如果不发FIN, 会发生什么呢,如果是connect呢?

2.   php-fpm进程如果执行sleep的脚本,此时怎么能看到其他请求是否被积压呢?(都是通过一个端口监听过来的,但是实际通信的是其他端口,其他端口可以通过lsof看到在变), 另外如果积压了,那么php-fpm是以什么方式来触发对新的socket链接的处理的呢? 这个是否可以想象下epoll的具体流程?? pm.status_patch=/matrix_monitor_page  的实现是怎么样的

  1 server {
  2     listen 8666;
  3     root /data0/www/htdocs/test;
  4     access_log /data0/www/logs/test-access_log main;
  5     error_log  /data0/www/logs/test-error_log;
  6     index index.php;
  7
  8     if ( $uri ~ "^/matrix_monitor_page" ){ break; }
  9
 10     location ~ /matrix_monitor_page {
 11         include tengine.fastcgi_params;
 12         fastcgi_param  SCRIPT_FILENAME "$document_root/robots.php";
 13         fastcgi_pass 127.0.0.1:9888;
 14     }
 15
 16     location / {
 17         root /data0/www/htdocs/test;
 18         index  index.php index.html index.htm;
 19     }
 20
 21     location ~ \.php$ {
 22         root /data0/www/htdocs/test;
 23         fastcgi_pass   127.0.0.1:9888;
 24         fastcgi_index  index.php;
 25         set $real_script_name $fastcgi_script_name;
 26         fastcgi_param  SCRIPT_FILENAME  $document_root$real_script_name;
 27         include        tengine.fastcgi_params;
 28     }
 29
 30 }

php-fpm status字段的含义:

pool php-fpm pool的名称,大多数情况下为www
process manager 进程管理方式,现今大多都为dynamic,不要使用static
start time php-fpm上次启动的时间
start since php-fpm已运行了多少秒
accepted conn pool接收到的请求数
listen queue 处于等待状态中的连接数,如果不为0,需要增加php-fpm进程数
max listen queue 从php-fpm启动到现在处于等待连接的最大数量
listen queue len 处于等待连接队列的套接字大小
idle processes 处于空闲状态的进程数
active processes 处于活动状态的进程数
total processess 进程总数
max active process 从php-fpm启动到现在最多有几个进程处于活动状态
max children reached 当pm试图启动更多的children进程时,却达到了进程数的限制,达到一次记录一次,如果不为0,需要增加php-fpm pool进程的最大数
slow requests 当启用了php-fpm slow-log功能时,如果出现php-fpm慢请求这个计数器会增加,一般不当的Mysql查询会触发这个值

3.     粘包问题

https://github.com/ljt1018168/phpredis_fix_pconnect_protocol_error/blob/develop/test_redis.php

posted on 2020-05-12 14:43  出发的兰彻  阅读(153)  评论(0编辑  收藏  举报

导航