Sunday, 17 November 2019

Very slow laravel homestead/vagrant/virtualbox on Mac OSX

I am using Homestead + Vagrant + Virtualbox on a Mac.

Problem

While I found lots of threads/answers how to fix slow response times (e.g. TTFB) none of them worked. My response times vary between 25 - 32 seconds, which of obviously is not acceptable for local development.

Suggested Solutions

I have tried a lot of suggested solutions from here: https://github.com/laravel/homestead/issues/901

And have also read and tried many suggestions from these threads:

Even though there were accepted answers, none of them helped me.

Disabling xdebug

I can say that Disabling xdebug like explained here helped me to save 5 seconds.

Changing disc size

While changing the VM's disc size from dynamic to fixed as suggested here and explained here didn't help at all (result was even worse).

Using NFS (sync folders) as suggested here

Also setting homestead/vagrant to NFS didn't help a thing.

Tried (vagrant file):

Vagrant.configure("2") do |config|
  config.vm.synced_folder ".", "/vagrant", type: "nfs", mount_options:['nolock,vers=3,udp,noatime,actimeo=1']
end

Also tried (homestead.yaml)

folders:
    -
        map: '/Users/myuser/PhpstormProjects/example.com'
        to: /home/vagrant/code
        type: "nfs"
        options:
            mount_options: ['nolock','vers=3','udp','noatime','actimeo=1']

NFS was working in both cases but it didn't change a thing regarding TTFB on page load.

Setting natdnshostresolver: off

I also tried to turn off natdnshostresolver as suggested here It didn't change a thing.

Adjusting Virtualbox Image

Of course I also tried to increase RAM, CPUs, Graphic stuff, etc. but as you can figure it didn't help.

Any other suggestions

As of now I'm also open to try e.g. valet or for any other recommendations / solutions you could give.

Thanks a lot in advance!



from Very slow laravel homestead/vagrant/virtualbox on Mac OSX

No comments:

Post a Comment