Slow rails due to excessive sharing

6 views
Skip to first unread message

Christian Aust

unread,
Jun 15, 2016, 3:09:04 AM6/15/16
to Vagrant
Hi,

I'm using Vagrant 1.8.1 on OSX with Virtualbox 5.0.20, plus ansible to provision the boxes. When running a Ruby on Rails 4.2 app within the guest from the shared folder, Rails creates a lot of files and IO underneath $RAILS_ENV/tmp/ and $RAILS_ENV/log/ In particular sprockets and sass are using those paths for caching.

These changes are always synced back and forth when using vboxfs sharing. Running Rails like that is a lot slower than running it directly on my machine, by order of an magnitude.

Using NFS for sharing will speed things up considerably. However it doesn't solve the problem but makes it less visible. A clean solution would

* exclude certain paths from syncing, or
* instruct Rails to use different tmp and log paths while running in a vagrant guest.

Has anybody had any luck with either one, or maybe come up with a different solution? Regards

Christian

Alvaro Miranda Aguilera

unread,
Jun 18, 2016, 2:03:30 PM6/18/16
to vagra...@googlegroups.com
Hello,

If you want to mount a local folder you can try this

mkdir -p /var/tmp/rails_temp /var/tmp/rails_log
mount --bind /var/tmp/rails_temp $RAILS_ENV/tmp/
mount --bind /var/tmp/rails_log $RAILS_ENV/log/

If that works, you can just use an script with run: "always" for that

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/d4ce8127-96d6-4b02-b24d-a72d0b2eee7a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages