Load policy from cache instead of reading from disk |
|||
Issue descriptionMaksim came up with idea to get the policy from cache when we need it, instead of reading from the disk. This should be easy, as currently we keep the cache in policy_store and update it every time the policy data is written. The code should just check if the cache is non-empty, return its value. And read the file + update the cache otherwise.
,
Oct 23 2017
What class are you talking about here?
,
Oct 23 2017
I think we can start with Chrome OS, and check the rest after that.
,
Oct 23 2017
To clarify, the idea was about not reading the policy file completely after at least one storing happens. I've not actually looked at this code for long time - @igorcov, have you confirmed that the load operations still go through the disk store?
,
Oct 23 2017
I was primarily thinking about session_manager. But now that I'm looking at its code, looks like it's actually loading the file from disk only on the first load, while the subsequent requests go like this: SessionManagerImpl::RetrievePolicy() calls PolicyService::Retrieve(), which boils down to PolicyStore::Get(), which just returns a member |policy_| Igor, if you confirm this, then login_manager is already fine. Sorry for misguiding then :)
,
Oct 23 2017
For Chrome OS - yes. The policy_store LoadOrCreate: https://cs.corp.google.com/chromeos_public/src/platform2/login_manager/policy_store.cc?l=33 calls base::ReadFileToString, which opens the file and reads the data: https://cs.corp.google.com/cobalt/base/file_util.cc?l=156
,
Oct 23 2017
Okay, seems like it's indeed cached in the object. I will check on the actual device to confirm.
,
Oct 24 2017
Just checked on the device, we don't read from the disk multiple times within a session. Only at device boot and user sign out, as the session is destroyed. Marking as invalid, sorry for the noise. |
|||
►
Sign in to add a comment |
|||
Comment 1 by igorcov@chromium.org
, Oct 23 2017