Closed joanhey closed 4 years ago
@joanhey Not startup, I think need a add request~
The name is better with 'php-ngx' https://github.com/rryqszq4/ngx_php7/blob/master/src/php/impl/php_ngx.c#L263
Had you tried to add "php-ngx" in https://github.com/php/php-src/blob/master/ext/opcache/ZendAccelerator.c#L2544 ??
Copile it to try with php-ngx.
I am trying something else.
https://github.com/unbit/uwsgi/blob/master/plugins/php/php_plugin.c
The uwsgi, perhaps they initialize the sapi in another way.
Also useful to take ideas.
In nginx unit it's working without problems. https://github.com/nginx/unit/blob/master/src/nxt_php_sapi.c
They are using "cli-server" :roll_eyes:
We could try with that first.
I think that "cli-server" maybe better.
With "cli-server"
I need to test a little more. With different files. This image is using the app.php loaded in the init_worker. So it is loaded only one time.
I don't expect any exponencial gain. But all the includes outside of the init_worker will be fast now.
@joanhey Test use opcache and not.
Result of use opcache
./wrk -H 'Host: 127.0.0.1' -H 'Accept: application/json,text/html;q=0.9,application/xhtml+xml;q=0.9,application/xml;q=0.8,*/*;q=0.7' -H 'Connection: keep-alive' --latency -d 15 -c 512 --timeout 8 -t 28 http://127.0.0.1/h2
Running 15s test @ http://127.0.0.1/h2
28 threads and 512 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 109.19ms 538.96ms 6.81s 97.50%
Req/Sec 1.77k 1.66k 10.61k 81.66%
Latency Distribution
50% 2.47ms
75% 3.53ms
90% 200.55ms
99% 3.21s
627719 requests in 15.10s, 81.39MB read
Socket errors: connect 0, read 10, write 0, timeout 4
Requests/sec: 41570.54
Transfer/sec: 5.39MB
Result of not use opcache
./wrk -H 'Host: 127.0.0.1' -H 'Accept: application/json,text/html;q=0.9,application/xhtml+xml;q=0.9,application/xml;q=0.8,*/*;q=0.7' -H 'Connection: keep-alive' --latency -d 15 -c 512 --timeout 8 -t 28 http://127.0.0.1/h2
Running 15s test @ http://127.0.0.1/h2
28 threads and 512 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 508.66ms 1.27s 7.91s 89.15%
Req/Sec 198.26 158.90 1.46k 61.65%
Latency Distribution
50% 49.07ms
75% 52.63ms
90% 2.09s
99% 5.82s
30416 requests in 15.10s, 3.94MB read
Socket errors: connect 0, read 0, write 0, timeout 3
Requests/sec: 2014.45
Transfer/sec: 267.46KB
And cache is hit.
Finally, but still be wary of unexpected mistakes.
The socket errors happen without opcache too, so I think it is for the 512 concurrent connections in that computer.
The numbers are impressive. What is the code of that test ??
Very simple code~ and h2 for that.
location = /h1 {
content_by_php '
echo "hello, world!"
';
}
location = /h2 {
content_by_php '
include "/ngx_php7/t/lib/hello.php";
';
}
And the results of /h1 ??
No, it's h2
yes, but I want to compare /h1 vs /h2 (with opcache)
OK, show you the result at tomorrow.
@joanhey
./wrk -H 'Host: 127.0.0.1' -H 'Accept: application/json,text/html;q=0.9,application/xhtml+xml;q=0.9,application/xml;q=0.8,*/*;q=0.7' -H 'Connection: keep-alive' --latency -d 15 -c 512 --timeout 8 -t 28 http://127.0.0.1/h1
Running 15s test @ http://127.0.0.1/h1
28 threads and 512 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 66.11ms 355.81ms 6.77s 98.54%
Req/Sec 1.99k 2.11k 43.31k 84.85%
Latency Distribution
50% 2.37ms
75% 3.31ms
90% 170.52ms
99% 1.05s
679166 requests in 15.10s, 88.06MB read
Requests/sec: 44976.38
Transfer/sec: 5.83MB
./wrk -H 'Host: 127.0.0.1' -H 'Accept: application/json,text/html;q=0.9,application/xhtml+xml;q=0.9,application/xml;q=0.8,*/*;q=0.7' -H 'Connection: keep-alive' --latency -d 15 -c 512 --timeout 8 -t 28 http://127.0.0.1/h1
Running 15s test @ http://127.0.0.1/h1
28 threads and 512 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 60.00ms 305.88ms 6.77s 98.38%
Req/Sec 1.84k 1.86k 11.82k 86.27%
Latency Distribution
50% 2.32ms
75% 3.71ms
90% 167.79ms
99% 779.61ms
660201 requests in 15.10s, 85.60MB read
Socket errors: connect 0, read 0, write 0, timeout 27
Requests/sec: 43725.02
Transfer/sec: 5.67MB
Could you create a new tag, to tests in the benchmark. And check the results with opcache and the changes in the async mysql.
Could you create a new tag, to tests in the benchmark. And check the results with opcache and the changes in the async mysql.
OK, I will release the version as soon as possible.
Now the image with the hello world is not correct.
The php file is almost as fast as inline.
Sure that the image was already legacy.
We could try that: https://bugs.php.net/bug.php?id=65078
And if work without problem, create a bug request to add the ngx_php7 sapi.