Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Choose the fastest php implementation #309

Closed
waghanza opened this issue Jul 30, 2018 · 12 comments
Closed

Choose the fastest php implementation #309

waghanza opened this issue Jul 30, 2018 · 12 comments

Comments

@waghanza
Copy link
Collaborator

Following #249 (comment), it'll be great to test php implementation

with new generation servers

Nginx / php-fpm was a default choice 馃槢

@bonfante if you are interested to see diffs between implementations, feel free to PR 鉂わ笍 we will have to choose the more performant / usable / standard

@doanguyen
Copy link
Member

Hi,

An update from this issue: I had a micro-benchmark between Swoole Vs Nginx+Php-fpm. Most of the framework written in PHP now is sync so I have no way other than choosing vanilla PHP to perform the benchmark.

The benchmark workflow is like that:

Apache ab ---> Swoole
Apache ab ---> Nginx ---> PHP Application

I tried to set up Nginx as a reverse proxy on top of Swoole, but It does not work! Pain. Here is the result:

https://gist.github.com/doanguyen/4211d393a975ec361cd1f299182f9859

Conclusion:
Swoole, in fact, faster 16k > 13k fpm, but most of php library is blocking so it's too soon to have it on our stack, yet.

It seems php-pm is very good for managing php process, so I will take a look later.

@waghanza
Copy link
Collaborator Author

馃帀 I'll be quite happy to see what's happening with those generation of tools

@waghanza
Copy link
Collaborator Author

@doanguyen you can also PR with https://github.com/php-pm/php-pm-docker

@waghanza
Copy link
Collaborator Author

@doanguyen
Copy link
Member

I've just made a quick test, it eats ram like twice as Chrome or even worse, workers don't seem to restart as they said.

@waghanza
Copy link
Collaborator Author

@doanguyen I've create an issue php-pm/php-pm-docker#18 to have some helps / see what's happening

@doanguyen
Copy link
Member

I guess you miss that: https://github.com/php-pm/php-pm-httpkernel

setting up phppm is a pain.

@waghanza
Copy link
Collaborator Author

@doanguyen
Copy link
Member

Did you try
ppm start --bootstrap=laravel --app-env=prod --logging=0 --debug=0 --workers=20
yet?

@doanguyen
Copy link
Member

doanguyen commented Oct 12, 2018

PHP-PM, 10 workers

$ wrk -c 10 -d 10s http://172.17.0.2:8080/user/0 -v --timeout 2s --latency
wrk 4.1.0 [epoll] Copyright (C) 2012 Will Glozer
Running 10s test @ http://172.17.0.2:8080/user/0
  2 threads and 10 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency   193.17ms  284.81ms   1.20s    80.96%
    Req/Sec   209.65    130.33   670.00     68.60%
  Latency Distribution
     50%   12.97ms
     75%  339.05ms
     90%  692.05ms
     99%  978.06ms
  3675 requests in 10.03s, 1.90MB read
Requests/sec:    366.29
Transfer/sec:    193.74KB

with memory consumption

Not much better than: nginx+php-fpm

$ wrk -c 10 -d 10s http://172.17.0.2:8080/user/0 -v --timeout 2s --latency
wrk 4.1.0 [epoll] Copyright (C) 2012 Will Glozer
Running 10s test @ http://172.17.0.2:8080/user/0
  2 threads and 10 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    71.20ms  114.21ms 632.32ms   86.77%
    Req/Sec   173.41     81.91   363.00     61.70%
  Latency Distribution
     50%   21.52ms
     75%   39.95ms
     90%  241.27ms
     99%  507.64ms
  3280 requests in 10.01s, 1.79MB read
Requests/sec:    327.73
Transfer/sec:    183.01KB

and memory consumption

@doanguyen
Copy link
Member

doanguyen commented Oct 12, 2018

I think we stick to the nginx+php-fpm since php-pm is leaked in memory, and doesn't seem to fix in a short time.

@waghanza
Copy link
Collaborator Author

Souds good for me. Thanks for your work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants