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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Comments on your conclusions #3

Open
bwoebi opened this issue Apr 26, 2017 · 3 comments
Open

Comments on your conclusions #3

bwoebi opened this issue Apr 26, 2017 · 3 comments

Comments

@bwoebi
Copy link

bwoebi commented Apr 26, 2017

As was mentioned otherwhere, enabling opcache (via -dopcache.enable_cli=1 -dopcache.optimization_level=0xffffffff) and using PHP 7.1 may improve performance a bit more.

Also, note that the node http module is even simpler than ours; as in, it has no concept of flexible middlewares etc. It ultimately just has to handle even less logic and thus may be faster. A tiny bit of logic, but not totally insignificant as it has to create a bunch of generators for the middleware machinery.
There are also other options to tune for the benchmark, like "deflateEnable" => false: Aerys always buffers by default for up to Options->deflateMinimumLength to check whether it's worth to use gzip compression]. NodeJS does no such thing.

In general, the nodejs server is more lightweight than Aerys; Aerys is packed with a bit more functionality which will be handy in more complex … in real world scenarios.

I have no idea why the standard deviation, especially as it is very low for node... I'd be interested in that too.

P.s.: $resp->addHeader('Content-Length', strlen($data)); is redundant; Aerys will set it for you (chunked encoding if you stream and normal content-length if end() is used without prior stream() call)

@dbalabka
Copy link
Owner

@bwoebi I have added comparison to run benchmark with or without enabled OPCache and found that there no difference or results became even worse.

Agree that Aerys is more complete solution that simple prototype implemented using NodeJS. It can add additional overhead. I have added new comments about ReactPHP. I can say that ReactPHP perform better and it more lite weight that proves you thoughts. But unfortunately it can't be compared with nodejs, because it doens't support keep-alive yet.

Standard deviation is good indicator of server work stability. You can see the probability of the worst performance. Now we can say that only 1% percent of request will be very slow(for some currently unknown reason). Currently I don't have ideas how to profile this case. It will be tricky.

Issue about strlen($data) addressed in PR #4

@dbalabka
Copy link
Owner

dbalabka commented Apr 28, 2017

@bwoebi I was wrong about OPCache. I have review latest build on Linux environment and can say that we definitely gain benefit of OpCache optimisations.

  • PHP nightly: 131818 / 135186 (reqs/30s) = 2%
  • PHP 7.1: 129809 / 134037 (reqs/30s) = 3%
  • PHP 7.0: 110310 / 125997 (reqs/30s) = 12%

@kelunik
Copy link
Contributor

kelunik commented Apr 29, 2017

@torinaki The 1% slow requests are probably the ones that need a new connection in case of keep-alive enabled.

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

5 participants
@dbalabka @kelunik @bwoebi and others