Closed paales closed 4 years ago
Maybe it is an idea to reintroduce some sort of filesystem events for the host and OSX?
We also have this issue when working with Magento2 projects but found a possible solution by using "-repeat watch", filesystem events, instead of polling by seconds.
Config:
vps.unison.repeat = "watch"
Host (https://github.com/hnsl/unox):
brew tap eugenmayer/dockersync
brew install eugenmayer/dockersync/unox
Guest: Increased files that can be watched in the guest
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
Guest: Uninstalled unison, compiled Unison from source code (to get unison-fsmonitor), copied unison + unison-fsmonitor to /usr/local/bin
Ohh! That might be a great solution! Working with Magento 2 as well. You mention 'possible solution', in the sense that not everything is integrated 100% yet, or that you haven't tried yet?
When I've got the time, I will take a look at it as well. As I understand, this should also considerably improve the time it takes to sync, because we don't have the extra second any more?
With 'possible solution' I meant that we have not rolled it out to our developers yet so we don't have any real usage data. Only done some initial testing and it seems to solve the CPU issue when no files are changed.
Thanks for the response :)
We [...] found a possible solution by using "-repeat watch", filesystem events, instead of polling by seconds.
I'm using this in my project now and can certainly say that there is an extreme increase in performance after switching to the "watch" version.
I have modified my Vagrantfile
as such to support this with a fallback to seconds if watch is not supported.
Maybe this could be implemented as a new parameter for vagrant-unison2 so that it automatically falls back? I definitely think there should be some sort of callout in the docs for "watch" support.
# Check whether host system has unison-fsmonitor
def has_unison_fsmonitor?()
system("which unison-fsmonitor")
end
Vagrant.configure(2) do |config|
[...]
if Vagrant.has_plugin?("vagrant-unison2")
[...] # Other vagrant-unison2 parameters
# Change polling interval (in seconds) at which to sync changes
config.unison.repeat = "5"
config.unison.repeat = "watch" if has_unison_fsmonitor?
end
config.vm.synced_folder '.', '/vagrant', disabled: true
end
Hopefully this helps those looking to implement the watch syntax if their host has unison-fsmonitor
.
@dasginganinja We've since migrated to https://mutagen.io, works faster and is relatively easy to set up.
Hi there,
We're syncing a rather large project (Magento 2) to our box which causes a rather large CPU usage (even when no files are changed).
Ideas how to reduce the CPU usage?