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

Slow performance - TTFB up to 60 #106

Closed
bonovski opened this issue Dec 18, 2018 · 13 comments
Closed

Slow performance - TTFB up to 60 #106

bonovski opened this issue Dec 18, 2018 · 13 comments

Comments

@bonovski
Copy link

I have a few wordpress sites that connect to a remote mysql DB.

The problem is that php/nginx performance is extremely slow, TTFB takes usually more than 20 seconds, but after that the site loads normally.

Anybody encountered similar issues?

WIN10, php7.2, mariadb 5.6 on remote server

@cretueusebiu
Copy link
Owner

Could be from the remote database. Try with a local one.

@staabm
Copy link

staabm commented Dec 19, 2018

You could try running a profiler to measure whats slow (blackfire or xdebug or similar)

@bonovski
Copy link
Author

Remote databases work fine when I use apache as the web server or when I use the original valet on macos.

I installed Laragon and response and loading times where the same as on macos/valet, but laragon has some other issues, so I don't want to use that.

It also works fine when I switch to the local db.

@bonovski
Copy link
Author

Just booted up an ubuntu installation in virtualbox with "valet for linux" and it works as expected.

@bonovski
Copy link
Author

Getting some 10060 errors:

2018/12/19 17:15:31 [error] 3240#6500: *4991 upstream timed out (10060: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond) while reading response header from upstream, client: 127.0.0.1, server: , request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9001", host: "staging.test"

@bonovski
Copy link
Author

fastcgi_buffering off did the trick.

The solution is for WSL but works nevertheless.

https://stackoverflow.com/questions/46286420/php7-0-fpm-extremly-slow-on-ubuntu-windows-subsystem-linux

microsoft/WSL#2100

@LarryBarker
Copy link

LarryBarker commented Mar 4, 2019

@bonovski Where did you change this setting at?

@bonovski
Copy link
Author

bonovski commented Mar 5, 2019

@bonovski Where did you change this setting at?

It's in valet.conf, I added it at the end of the php location block.

location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass 127.0.0.1:9001;
        fastcgi_index "C:/Users/USER/AppData/Roaming/Composer/vendor/cretueusebiu/valet-windows/server.php";
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME "C:/Users/USER/AppData/Roaming/Composer/vendor/cretueusebiu/valet-windows/server.php";
        fastcgi_param HOME "C:/Users/USER";
	fastcgi_buffering off;
    }

The file is located in C:\Users\USER\AppData\Roaming\Composer\vendor\cretueusebiu\valet-windows\bin\nginx\valet

@LarryBarker
Copy link

Thanks so much! I had been looking in the wrong folder. Do you think running MAMP with Apache on port 8890 is affecting my response time?

@bonovski
Copy link
Author

bonovski commented Mar 6, 2019

I don't think so, but nginx on windows can be finicky.
Additionally to turning fastcgi_buffering off I also installed non-thread-safe php.

I didn't notice any difference but it was recommended on the forums for nginx.

@darrylmorley
Copy link

I'm struggling with very slow performance in Windows, I've added fastcgi_buffering off; but it doesn't appear to have had any effect. Is there anything else I can try please?

@bonovski
Copy link
Author

You can try adding fastcgi_keep_conn on; below too.
That's as fast as it gets.

@darrylmorley
Copy link

Thanks, i'll give it a shot.

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