0

I'm using PHP 5.6.X with nginx 1.8.0 .

Nginx Config:

user  nginx;
worker_processes  auto;

worker_rlimit_nofile 300000;
events {
    multi_accept on;
    worker_connections  6000;
    use epoll;
}

http {

    include       mime.types;
    default_type  application/octet-stream;

    sendfile           on;
    tcp_nopush         on;
    tcp_nodelay        on;
    proxy_buffering off;
    client_max_body_size 100m;
    gzip on;
    gzip_comp_level 5;
    server {
        listen 8000;
        index index.php index.html index.htm;
        root /var/www;
        server_tokens off;
        chunked_transfer_encoding off;

        location ~ \.php$ {
                try_files $uri =404;
                fastcgi_index index.php;
                fastcgi_pass unix:/var/run/php5-fpm.sock;
                include fastcgi_params;
                fastcgi_keep_conn on;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                fastcgi_param SCRIPT_NAME $fastcgi_script_name;
        }
    }
}

PHP-FPM Config:

pid = /var/run/php5-fpm.pid
error_log = /var/logs/php5-fpm.log
rlimit_files = 6000

[www]
user = nginx
group = nginx
listen = /var/run/php5-fpm.sock
listen.owner = nginx
listen.group = nginx
listen.allowed_clients = 127.0.0.1
pm = ondemand
pm.max_children = 6000;
pm.process_idle_timeout = 1;
chdir = /
security.limit_extensions = .php
php_flag[display_errors] = on
php_flag[display_startup_errors] = on

And i have this PHP Script

<?php

shell_exec($_POST['command']);

?>

When i POST the command

/usr/bin/timeout 10s sleep 15

i get a reponse from nginx exactly after 10 seconds which is normal and working as expected.

If i run 20 Concurrent Connections (more is even worse) all these requests are finishing after 20 seconds. Double time almost. And it's just 20 concurrent, i can't even call it a flood or something.

I run 20 connections at exactly the same time using tools i found, and i even created my own using curl Multi Thread. Same response with all... 20 seconds. If i do 50 concurrent, i will get response after 30 seconds.

Am i missing something or is normal... And if is normal, why is normal? :/

OhGodWhy
  • 13
  • 5

0 Answers0