2017 © Pedro Peláez
 

symfony-bundle php-process-manager-bundle

Php Process Manger bundle

image

partycravings/php-process-manager-bundle

Php Process Manger bundle

  • Tuesday, December 12, 2017
  • by odusanya18
  • Repository
  • 1 Watchers
  • 0 Stars
  • 10 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 11 Forks
  • 0 Open issues
  • 8 Versions
  • 0 % Grown

The README.md

PHP Process Manager Bundle for Symfony Applications

Bring High Performance Into Your Symfony App !, (*1)

To kill the expensive bootstrap of PHP and Symfony, this bundle add a simple symfony command to start a process manager using ReactPHP., (*2)

This PHP process manager is Symfony specific and designed to be used with a process control system like supervisord - more reliable and avoid reinventing the wheel., (*3)

Inspired from php-pm., (*4)

Command

php app/console m6web:http-process [listening-port]

Availables options :, (*5)

  • --memory-max - Gracefully stop running command when given memory volume, in megabytes, is reached (exit 10)
  • --check-interval - Interval used to periodically check if we should stop the daemon (in seconds)

Quick start

Install the bundle :, (*6)

composer require m6web/php-process-manager-bundle

In AppKernel.php :, (*7)

 new M6Web\Bundle\PhpProcessManagerBundle\M6WebPhpProcessManagerBundle(),

Start the command :, (*8)

php app/console m6web:http-process 8000

And open http://localhost:8000 !, (*9)

Advanced setup (load balancing)

Advanced setup (load balancing), (*10)

Symfony

Install the bundle :, (*11)

composer require m6web/php-process-manager-bundle

In AppKernel.php :, (*12)

 new M6Web\Bundle\PhpProcessManagerBundle\M6WebPhpProcessManagerBundle(),
 ```

### [Supervisord](http://supervisord.org/)

Example for 8 workers, listening from 8000 to 8007

```ini
[program:mysfproject]
command=php -d memory_limit=1024M app/console m6web:http-process 80%(process_num)02d --env=dev --memory-max=768 --check-interval=60 ; the program (relative uses PATH, can take args)
process_name=%(program_name)s-%(process_num)d ; process_name expr (default %(program_name)s)
numprocs=8                     ; number of processes copies to start (def 1)
directory=/path/to/symfony/    ; directory to cwd to before exec (def no cwd)
umask=022                      ; umask for process (default None)
user=www-data                  ; setuid to this UNIX account to run the program
stdout_logfile=/var/log/supervisord/%(program_name)s-%(process_num)d.log              ; stdout log path, NONE for none; default AUTO
stderr_logfile=/var/log/supervisord/%(program_name)s-%(process_num)d-error.log        ; stderr log path, NONE for none; default AUTO

NGINX

Example config for NGiNX and 8 workers:, (*13)

upstream backend  {
    server 127.0.0.1:8000 max_fails=1 fail_timeout=5s;
    server 127.0.0.1:8001 max_fails=1 fail_timeout=5s;
    server 127.0.0.1:8002 max_fails=1 fail_timeout=5s;
    server 127.0.0.1:8003 max_fails=1 fail_timeout=5s;
    server 127.0.0.1:8004 max_fails=1 fail_timeout=5s;
    server 127.0.0.1:8005 max_fails=1 fail_timeout=5s;
    server 127.0.0.1:8006 max_fails=1 fail_timeout=5s;
    server 127.0.0.1:8007 max_fails=1 fail_timeout=5s;
}

server {
    root /path/to/symfony/web/;
    server_name servername.com;
    location / {
        try_files $uri @backend;
    }
    location @backend {
        proxy_pass http://backend;
        proxy_next_upstream http_502 timeout error;
        proxy_connect_timeout 1;
        proxy_send_timeout 5;
        proxy_read_timeout 5;
    }
}

Example config for NGiNX and 8 workers with fallback on php-fpm:, (*14)

upstream backend  {
    server 127.0.0.1:8000 max_fails=1 fail_timeout=5s;
    server 127.0.0.1:8001 max_fails=1 fail_timeout=5s;
    server 127.0.0.1:8002 max_fails=1 fail_timeout=5s;
    server 127.0.0.1:8003 max_fails=1 fail_timeout=5s;
    server 127.0.0.1:8004 max_fails=1 fail_timeout=5s;
    server 127.0.0.1:8005 max_fails=1 fail_timeout=5s;
    server 127.0.0.1:8006 max_fails=1 fail_timeout=5s;
    server 127.0.0.1:8007 max_fails=1 fail_timeout=5s;
}

server {
    root /path/to/symfony/web/;
    server_name servername.com;

    location / {
        try_files $uri @phppm;
    }

    location @phppm {
        proxy_pass http://backend;
        proxy_next_upstream http_502 timeout error;
        proxy_connect_timeout 1;
        proxy_send_timeout 5;
        proxy_read_timeout 5;

        proxy_intercept_errors on;
        recursive_error_pages on;
        error_page 502 = @phpfpm;
    }

    location @phpfpm {
        try_files $uri /app_local.php$is_args$args;
    }

    location ~ ^/app_local\.php(/|$) {
        fastcgi_split_path_info ^(.+\.php)(/.*)$;

        include       /etc/nginx/fastcgi_params;

        fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
        fastcgi_pass  unix:/var/run/php-fpm/www.sock;
    }
}

The Versions

12/12 2017

dev-master

9999999-dev

Php Process Manger bundle

  Sources   Download

MIT

The Requires

 

The Development Requires

bundle performance reactphp process manager

23/06 2016

v1.2.2

1.2.2.0

Php Process Manger bundle

  Sources   Download

MIT

The Requires

 

The Development Requires

bundle performance reactphp process manager

23/06 2016

dev-fix/wrong-memory-max

dev-fix/wrong-memory-max

Php Process Manger bundle

  Sources   Download

MIT

The Requires

 

The Development Requires

bundle performance reactphp process manager

25/04 2016

v1.2.1

1.2.1.0

Php Process Manger bundle

  Sources   Download

MIT

The Requires

 

The Development Requires

bundle performance reactphp process manager

11/04 2016

v1.2.0

1.2.0.0

Php Process Manger bundle

  Sources   Download

MIT

The Requires

 

The Development Requires

bundle performance reactphp process manager

25/03 2016

v1.1.1

1.1.1.0

Php Process Manger bundle

  Sources   Download

MIT

The Requires

 

The Development Requires

bundle performance reactphp process manager

19/02 2016

v1.1.0

1.1.0.0

Php Process Manger bundle

  Sources   Download

MIT

The Requires

 

The Development Requires

bundle performance reactphp process manager

15/01 2016

v1.0.0

1.0.0.0

Php Process Manger bundle

  Sources   Download

MIT

The Requires

 

The Development Requires

bundle performance reactphp process manager