I added a caching mechanism to virt that allows a virt to greatly speedup the lookup process for libvirt and guest objects. The host object also automatically maintains the cache should any of those objects be removed outside the virt object.
However, after using with foreman I noticed that the new caching mechanism wasn't being utilized. I poked around the foreman code and noticed that foreman doesn't keep the virt host object in memory as it disconnects after making a call. This is why it takes a long time to re-index the vms with every refresh. Foreman has to recreate the virt host object along with all the guest objects and libvirt domain objects with every refresh or creation of a vm. Is there any way to keep the virt connection object in memory long enough for the virt caching mechanism to do its job? Is there any reason why we wouldn't want to keep the virt object in memory? The amount of time saved from keeping the virt object in memory would be about 20x improvement.
Is there any kind of top level foreman cache that can be used to store objects?
I put the virt cache in the host object should you want to take a look.
> Ohad,
>
> I added a caching mechanism to virt that allows a virt to greatly speedup
> the lookup process for libvirt and guest objects. The host object also
> automatically maintains the cache should any of those objects be removed
> outside the virt object.
>
awesome!
>
> However, after using with foreman I noticed that the new caching mechanism
> wasn't being utilized. I poked around the foreman code and noticed that
> foreman doesn't keep the virt host object in memory as it disconnects after
> making a call. This is why it takes a long time to re-index the vms with
> every refresh. Foreman has to recreate the virt host object along with all
> the guest objects and libvirt domain objects with every refresh or creation
> of a vm. Is there any way to keep the virt connection object in memory
> long enough for the virt caching mechanism to do its job? Is there any
> reason why we wouldn't want to keep the virt object in memory? The amount
> of time saved from keeping the virt object in memory would be about 20x
> improvement.
>
Yes, you can use Rails.cache, see how we cache puppet certificate calls
–>
note also for line 27.
Ohad
···
On Sat, Dec 24, 2011 at 1:21 AM, Corey Osman wrote:
Is there any kind of top level foreman cache that can be used to store
objects?