Fohn-Group / fohn-ui

PHP framework using Tailwind Css
MIT License
2 stars 2 forks source link

Benchmarking problems #34

Open woodholly opened 3 weeks ago

woodholly commented 3 weeks ago

Do you know why I can't benchmark fohn-ui ?

curl http://localhost/forn-ui/app-test/

works immidiately, but

ab -c1 -n1 http://localhost/forn-ui/app-test/

stucks for exactly 5 seconds, why ? Same with lynx. First I thought that it is user-agent filter/protection, but changing user-agent does not help.

It certainly stucks inside

$ui->setApp(new App());
ibelar commented 3 weeks ago

Probably cause by your server/php configuration. For example, if your php installation use xDebug, it can cause the server to respond slowly. (5sec in my case with xDebug)

This is my test result without xDebug:

ab -c1 -n1 http://localhost:8080/app-test/ This is ApacheBench, Version 2.3 <$Revision: 1903618 $> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking localhost (be patient).....done

Server Software: Apache/2.4.58 Server Hostname: localhost Server Port: 8080

Document Path: /app-test Document Length: 239 bytes

Concurrency Level: 1 Time taken for tests: 0.003 seconds Complete requests: 1 Failed requests: 0 Non-2xx responses: 1 Total transferred: 468 bytes HTML transferred: 239 bytes Requests per second: 333.78 [#/sec] (mean) Time per request: 2.996 [ms] (mean) Time per request: 2.996 [ms] (mean, across all concurrent requests) Transfer rate: 152.55 [Kbytes/sec] received

Connection Times (ms) min mean[+/-sd] median max Connect: 0 0 0.0 0 0 Processing: 3 3 0.0 3 3 Waiting: 3 3 0.0 3 3 Total: 3 3 0.0 3 3

woodholly commented 3 weeks ago

Thanks, but I have no xdebug, checked everything (php.ini, phpinfo..., all extensions).

woodholly commented 3 weeks ago

This is http 1.1 protocol bug in ither ab or php module guzzlehttp/psr7. Changing 29 line inside ./vendor/guzzlehttp/psr7/src/MessageTrait.php to:

return '1.0';

solves it.

I am actually surprised that ab works for you... Simple php script kills ab:

<?php
header("HTTP/1.1 200 OK");
exit;
woodholly commented 3 weeks ago

ab does not support HTTP 1.1 (https://bz.apache.org/bugzilla/show_bug.cgi?id=65155) How it works for you ? :)

ibelar commented 3 weeks ago

This is way over my field of competence. 😄 I am using psr7 version 2.6. Could it be the reason ?