Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel Homestead/Vagrant/Virtualbox is slow on Windows

Tags:

I have installed Laravel Homestead/Vagrant/Virtualbox on Windows as it said on official site

But it is really slow. Page update takes about 5 seconds.

And it is not only my observation. Laracast has a discussion about it.

The laracast forum has some interesting ideas, but it is a mess there (sorry Jeffery), it is hard to understand which ideas are accepted and which is declined.

Here on Stackoverflow we have a good voting system to vote up working solutions, and request authors to give more details for each solution individually. Please post your solutions and experiences.

From my experience - there was a situation once when windows run updates and shut down my system forcefully, and when it started it was incredibly fast (10 times faster at least) but after next restart it went slow again. Now I know that something may be done to speed it up, it is not a "slow hardware case" it is a software config case!

Im using Windows-10 on Intel-Core-i7, with Oracle Virtualbox-5.2.12... (everything is latest and there is nothing to update)

like image 831
Yevgeniy Afanasyev Avatar asked May 30 '18 23:05

Yevgeniy Afanasyev


People also ask

What is laravel Homestead box?

Laravel Homestead is an official, pre-packaged Vagrant box that provides you a wonderful development environment without requiring you to install PHP, a web server, and any other server software on your local machine. Vagrant provides a simple, elegant way to manage and provision Virtual Machines.

Can Vagrant work without VirtualBox?

Before you start, make sure you already have a virtualization solution on your system. Solutions that work with Vagrant include VirtualBox, VMware, Docker, Hyper-V, and custom solutions.


1 Answers

NFS stands for Network File System and you need it for speed.

Laravel homestead tutorial does not say what NFS is and why you need it, which is why I ignored it on the initial install.

1) On your Windows host, install the plugin that adds NFS support to vagrant in Windows.

$ vagrant plugin install vagrant-winnfsd

2) Go to Homestead.yaml, it usually sits in C:\Users\username\Homestead\Homestead.yaml

3) Add type: "nfs" in the folders section like so:

folders:
    - map: ~/code
      to: /home/vagrant/code
      type: "nfs"

4) Run vagrant up --provision

Result:

The speed increases, as in @phazei's answer, from 8 to 2 seconds for each request, but it is much less work. @phazei's answer clarifies some background processes.

I tested it on windows 10 with Oracle Virtualbox-5.2.12, vagrant version-2.1.1.

Please note: Vagrant NFS page says

Windows users: NFS folders do not work on Windows hosts. Vagrant will ignore your request for NFS synced folders on Windows.

But if you have the plugin, you can ignore it.

like image 58
Yevgeniy Afanasyev Avatar answered Sep 28 '22 11:09

Yevgeniy Afanasyev