简体   繁体   English

如何设置php-fpm多线程工作?

[英]How to set up php-fpm multithreading work?

php-fpm config : php-fpm 配置:

  pm = dynamic 
  pm.max_children = 50 
  pm.start_servers = 20 
  pm.min_spare_servers = 10

and this is nginx config:这是 nginx 配置:

    root /var/www/html;
    index index.html index.htm index.nginx-debian.html;
    server_name _;
    location / {
            try_files $uri $uri/ =404;
    }
    location ~ \.php$ {
            include snippets/fastcgi-php.conf;
            fastcgi_pass unix:/run/php/php7.0-fpm.sock;
    }

But When I send 50 requests at the same time, it is executed one by one.但是当我同时发送50个请求的时候,就一个一个的执行了。

在此处输入图片说明

在此处输入图片说明

This could be because of the sessions.这可能是因为会话。

By default php store sessions in files and during request block this file, so next request can be started only after previous is finished.默认情况下,php 将会话存储在文件中,并在请求期间阻止此文件,因此只有在前一个请求完成后才能启动下一个请求。

Try to store sessions in memcache or database.尝试将会话存储在内存缓存或数据库中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM