Jinnrry
Jinnrry

Reputation: 445

How to set up php-fpm multithreading work?

php-fpm config :

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

and this is nginx config:

    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.

enter image description here

enter image description here

Upvotes: 2

Views: 5086

Answers (1)

Alex
Alex

Reputation: 141

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.

Try to store sessions in memcache or database.

Upvotes: 4

Related Questions