Very slow laravel homestead/vagrant/virtualbox on Mac OSX
My Laravel projects are also slow but only when using Postman, assuming it's booting up every time I make a request which adds like 10-15seconds to every request. My solution was to tweak the Keep-Alive
settings.
Assuming what's happening is it opens a new connection, do handshakes, transfer resource, close connection, and repeats for every resource on your page. I might be wrong but try below and lets see. :)
This is only for local development, I don't suggest this for production environment.
Apache
$ sudo nano /etc/apache2/httpd.conf
At the top:
KeepAlive On
MaxKeepAliveRequests 200
KeepAliveTimeout 300
Then restart apache
nginx
$ sudo nano /etc/nginx/nginx.conf
In the http {}
block:
keepalive_disable none;
keepalive_requests 200;
keepalive_timeout 300s;
Then restart nginx
Thanks to all of you guys, but I found a quite interesting solution or rather an issue that I had.
I was using the local environment for a wordpress install. There was a file called "object-cache.php" in the wp-content folder which uses Memcached. Memcached is installed within homestead but seems to have a different configuration than my live server.
This leads to local files not being cached properly, which ultimately results in the code pulling all available options from the database for each request.
So in sum it was a huge caching issue.
Removing the object-cache.php file is now my solution (resulting in a TTFB of 1.23 seconds).
I just leave this here in case anyone runs into a similar issue. Thanks again for all the help and thought you guys put into this.