New issue
Advanced search Search tips

Issue 777450 link

Starred by 1 user

Issue metadata

Status: WontFix
Owner:
Closed: Oct 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 3
Type: Bug



Sign in to add a comment

Load policy from cache instead of reading from disk

Project Member Reported by igorcov@chromium.org, Oct 23 2017

Issue description

Maksim 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.
 
Components: Enterprise
What class are you talking about here?
Labels: OS-Chrome
I think we can start with Chrome OS, and check the rest after that.

Comment 4 by emaxx@chromium.org, 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?

Comment 5 by emaxx@chromium.org, 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 :)
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
Okay, seems like it's indeed cached in the object. I will check on the actual device to confirm.
Status: WontFix (was: Untriaged)
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