Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vagrant Homestead slow

I have a vagrant server based off Laravel Homestead for testing my Laravel sites locally for the most part it runs great. However, recently, I have been having problems where it will just halt for anything from a few minutes (typical) to hours (rare). This happens every 15 minutes or so. To the point where if I'm typing in the ssh connection it will just stop. Then when I check back a few minutes later, what I had been typing is now there. This isn't just SSH and pages stop loading, and vagrant commands including rsync and even halt fail.

This is vanilla Homestead, except for I changed the mapping to be via rsync (manual, I run the rsync command whenever I want to update the server). The reason for this was because I was getting 30second or so load times for webpages and after research and trying rsync this helped massively for this. Also, I have (since the problem) tried giving it access to all 4 cpus. I am running this on a macbook air 2013 if this is important. It has been running fine for the past 2 months. The vagrant server is running with 2048MB of memory and I have 15GB of disk space free.

This is a very frustrating problem as it slows down development massively.

edit: This seems to happen most frequently (but not exclusively) when using the mysql command line over ssh

like image 987
user3875916 Avatar asked Sep 10 '14 09:09

user3875916


People also ask

How can I make my vagrant faster?

Increasing allocated CPU cores and RAM in Vagrant As a start, you should always increase the allocated CPU cores and RAM in your Vagrantfile. This should be based on the resources available on your team's computers, and the resources required to run your application.

What is vagrant Homestead?

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.


1 Answers

I had the same issue on windows and this fixed it:

install this vagrant plugin: vagrant plugin install vagrant-winnfsd

then add this to your homestead.yaml: type: nfs

yaml file should look like this:

folders:
    - map: C:\my-www
      to: /home/vagrant/my-www
      type: nfs

when all is done destroy your vagrant and do vagrant up.

like image 123
Pedram Vdl Avatar answered Sep 29 '22 21:09

Pedram Vdl