Bug #73412 [Nab]: url-wrappers in PHP7 terrible slow
| From: | spam2 at rhsoft dot net | Date: | Mon, 31 Oct 2016 08:22:56 +0000 |
| Subject: | Bug #73412 [Nab]: url-wrappers in PHP7 terrible slow | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-205099@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=73412&edit=1
ID: 73412
User updated by: spam2 at rhsoft dot net
Reported by: spam2 at rhsoft dot net
Summary: url-wrappers in PHP7 terrible slow
Status: Not a bug
Type: Bug
Package: Performance problem
Operating System: Linux
PHP Version: 7.0.12
Block user comment: N
Private report: N
New Comment:
since the script now has a $use_curl param where this does not happen and you can make 5000 requests
instead 5 in the same time with nothing else changed hardly something in the environment or on the
webserver which is contacted (local machine) pretty sure something wrong on the PHP side
a single call returns immediately
__________________________
[harry@srv-rhsoft:/mnt/data/downloads]$ time php -r "get_headers('http://corecms/index.php');"
real 0m0.057s
user 0m0.035s
sys 0m0.015s
[harry@srv-rhsoft:/mnt/data/downloads]$ time php -r "get_headers('http://corecms/static.htm');"
real 0m0.056s
user 0m0.041s
sys 0m0.013s
[harry@srv-rhsoft:/mnt/data/downloads]$ time php -r "get_headers('http://corecms/static.php');"
real 0m0.043s
user 0m0.032s
sys 0m0.009s
Previous Comments:
------------------------------------------------------------------------
[2016-10-31 08:15:25] nikic@php.net
Okay, so the trace includes a bunch of 3 second timeouts like
18606 09:07:06.754991 poll([{fd=3, events=POLLIN}], 1, 3000) = 0 (Timeout) <3.003119>
That is clearly the reason for the immense slowdown. Now need to figure out what the cause is :)
------------------------------------------------------------------------
[2016-10-31 08:10:19] spam2 at rhsoft dot net
i have no expierience with perf tools but if you would instruct me,,,
in the meantime two straces:
strace -Ff -tt -T -o out.txt php -r "get_headers('http://corecms/static.htm');"
http://access.thelounge.net/harry/get_headers_strace_small.txt
strace -Ff -tt -T -o out.txt php /www/corecms.rhsoft.net/response-times.php
http://access.thelounge.net/harry/get_headers_strace.txt
------------------------------------------------------------------------
[2016-10-31 08:03:27] rasmus@php.net
I think a perf report would be more useful, but if you do an strace, use these flags: strace -Ff -tt
-T -o out.txt php -r "get_headers('http://corecms/static.htm');"
------------------------------------------------------------------------
[2016-10-31 07:44:34] nikic@php.net
Could you please provide an
strace trace for what happens in the get_headers() case?
------------------------------------------------------------------------
[2016-10-31 07:35:44] spam2 at rhsoft dot net
same behavior with your code (replaced the URL and changed 1000 to 20 because otherwise i would need
to wait until next week)
[harry@srv-rhsoft:/downloads]$ php test.php
0.081186056137085
3.1035280227661
the same when it's running within the webserver
interesting that the profiling script used between "make prof-gen" and "make
prof-use" is also doing a ton of file_get_contents on a temporary started webserver on
127.0.0.1:9000 does not suffer from this problem (not within the build-process and also not with the
fallback using the installed binaries) while i have serveral scripts using file_get_contents() or
get_headers() which got magnitudes slower
one of them lists all files recursive and does blind requests to any possible URL to find includes
which are not proper protected against direct calls and that one would take months to finish while
with curl it's pretty fast
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=73412
--
Edit this bug report at https://bugs.php.net/bug.php?id=73412&edit=1