Skip to content
This repository has been archived by the owner on Nov 24, 2022. It is now read-only.

Load locale file only once #423

Merged
merged 2 commits into from
Oct 21, 2016
Merged

Load locale file only once #423

merged 2 commits into from
Oct 21, 2016

Conversation

sergle
Copy link
Contributor

@sergle sergle commented Oct 18, 2016

Hello,
My case is a bit unusual - we have near 200 machines defined by single Vagrantfile.
I found that command 'vagrant status' takes near 82seconds to run on empty setup. With strace I see that there are a lot of open("...vagrant-lxc-1.2.1/locales/en.yml") requests.
With attached patch time of 'vagrant status' reduced to 32seconds.

Configuration:
Ubuntu 16.04.1
Vagrant Version: 1.8.5
vagrant plugin list:
vagrant-lxc (1.2.1)
vagrant-share (1.1.5, system)

@ccope
Copy link
Contributor

ccope commented Oct 18, 2016

Nice! I have some other caching improvements I've been working on too, I'll try to put up a PR this week.

@@ -8,12 +8,16 @@ class Plugin < Vagrant.plugin("2")
The LXC provider allows Vagrant to manage and control
LXC-based virtual machines.
EOF
locale_loaded = false

provider(:lxc, parallel: true, priority: 7) do
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This appears to be in a parallel section, do we need to do some sort of locking here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked into docker and hyperv providers from vagrant-1.8.5 and found no locking there.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should I rewrite patch to use the same style (def self.init!) as in docker/plugin.rb ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that sounds good to me. The docker provider is the newest in the main vagrant project and generally a good example to follow.

@ccope ccope merged commit a68a1de into fgrehm:master Oct 21, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants