Discussion:
[vagrant-up] Painfully slow MySQL connections - How to debug and fix?
Lucas Bustamante
2018-09-27 14:58:12 UTC
Permalink
Hi,

I have a Windows 7 64 bits as host machine, running Vagrant -> Ubuntu 14.04.

*Host machine:*
CPU: i7 2600
RAM: 16GB RAM
OS in SSD
2 HDDs for data, Vagrant is running in HDD.

*Vagrant machine:*
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu-server-14.04"
config.vm.box_url =
"https://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box"
config.vm.network :forwarded_port, guest: 81, host: 81
config.vm.network :forwarded_port, guest: 3306, host: 3306
config.vm.network :private_network, ip: "192.168.33.10"
config.vm.synced_folder "www/", "/var/www", owner: "www-data", group:
"www-data", mount_options: ['dmode=777','fmode=666']
config.vm.synced_folder "~", "/vagrant", owner: "vagrant", group:
"vagrant"
config.vm.provider "virtualbox" do |machine|
machine.memory = 2048
machine.name = "ubuntu-server-php"
end
# Enable Dynamic Swap Space to prevent Out of Memory crashes
config.vm.provision "shell", inline: "sudo apt install swapspace -y"
config.vm.provision :shell, path: "setup.sh"
end

*Vagrant plugins:*
vagrant-faster (0.2.0)
vagrant-vbguest (0.15.2)

I've built a small PHP benchmarking script: https://pastebin.com/b8SSrQks

I've ran it both in Vagrant and in my VPS. These are the results:

*// VPS*
Benchmark::drop:
beforeDrop: "0.000 seconds"
afterDrop: "0.381 seconds"
Benchmark::importSql:
afterFileGetContents: "0.423 seconds"
afterExec: "1.581 seconds"

*// Vagrant*
Benchmark::drop:
beforeDrop: "0.000 seconds"
afterDrop: "19.955 seconds"
Benchmark::importSql:
afterFileGetContents: "20.015 seconds"
afterExec: "95.536 seconds"

The SQL file in question is a clean WordPress install dump. It's 128kb.

What can possibly be causing my Vagrant box to be so slow? How can I debug
and try to fix this?

Thanks!
--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.

GitHub Issues: https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
---
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/eb0ee28e-2ae9-4d27-85df-466c31a1c2dc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Alvaro Miranda Aguilera
2018-09-28 08:05:51 UTC
Permalink
Which ip port are you using?

will be better if you use 192.168.33.10
Alvaro
Post by Lucas Bustamante
Hi,
I have a Windows 7 64 bits as host machine, running Vagrant -> Ubuntu 14.04.
*Host machine:*
CPU: i7 2600
RAM: 16GB RAM
OS in SSD
2 HDDs for data, Vagrant is running in HDD.
*Vagrant machine:*
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu-server-14.04"
config.vm.box_url = "
https://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box
"
config.vm.network :forwarded_port, guest: 81, host: 81
config.vm.network :forwarded_port, guest: 3306, host: 3306
config.vm.network :private_network, ip: "192.168.33.10"
"www-data", mount_options: ['dmode=777','fmode=666']
"vagrant"
config.vm.provider "virtualbox" do |machine|
machine.memory = 2048
machine.name = "ubuntu-server-php"
end
# Enable Dynamic Swap Space to prevent Out of Memory crashes
config.vm.provision "shell", inline: "sudo apt install swapspace -y"
config.vm.provision :shell, path: "setup.sh"
end
*Vagrant plugins:*
vagrant-faster (0.2.0)
vagrant-vbguest (0.15.2)
I've built a small PHP benchmarking script: https://pastebin.com/b8SSrQks
*// VPS*
beforeDrop: "0.000 seconds"
afterDrop: "0.381 seconds"
afterFileGetContents: "0.423 seconds"
afterExec: "1.581 seconds"
*// Vagrant*
beforeDrop: "0.000 seconds"
afterDrop: "19.955 seconds"
afterFileGetContents: "20.015 seconds"
afterExec: "95.536 seconds"
The SQL file in question is a clean WordPress install dump. It's 128kb.
What can possibly be causing my Vagrant box to be so slow? How can I debug
and try to fix this?
Thanks!
--
This mailing list is governed under the HashiCorp Community Guidelines -
https://www.hashicorp.com/community-guidelines.html. Behavior in
violation of those guidelines may result in your removal from this mailing
list.
GitHub Issues: https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
---
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an
To view this discussion on the web visit
https://groups.google.com/d/msgid/vagrant-up/eb0ee28e-2ae9-4d27-85df-466c31a1c2dc%40googlegroups.com
<https://groups.google.com/d/msgid/vagrant-up/eb0ee28e-2ae9-4d27-85df-466c31a1c2dc%40googlegroups.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
Alvaro
--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.

GitHub Issues: https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
---
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/CAHqq0ewWpWPj63SFzQEsxcujE8NKFp7-1Pw6NHESXRkqdsvR9A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Loading...