Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only read storage.conf once #1404

Merged
merged 1 commit into from
Oct 24, 2022
Merged

Only read storage.conf once #1404

merged 1 commit into from
Oct 24, 2022

Conversation

rhatdan
Copy link
Member

@rhatdan rhatdan commented Oct 20, 2022

Currently running a simple container runs and stats configuration storage.conf files multiple times on a simple container run.

This PR cuts the opens and stats in half by caching the first read. This speeds up start by about 10-20 microseconds.

If container engines want to react to storage files changing, added a new function UpdateStoreOptions to allow engines to reload options.

Fixes: #1403

Signed-off-by: Daniel J Walsh dwalsh@redhat.com

Currently running a simple container runs and stats configuration
storage.conf files multiple times on a simple container run.

This PR cuts the opens and stats in half by caching the first read.
This speeds up start by about 10-20 microseconds.

If container engines want to react to storage files changing, added a
new function UpdateStoreOptions to allow engines to reload options.

Fixes: containers#1403

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
@rhatdan
Copy link
Member Author

rhatdan commented Oct 20, 2022

Here is what I am seeing with this patch on Podman, second podman has the change.

podman (storage) $ time ./bin/podman run alpine true; time ./bin/podman.s run alpine true

real	0m0.148s
user	0m0.046s
sys	0m0.025s

real	0m0.142s
user	0m0.056s
sys	0m0.021s
podman (storage) $ time ./bin/podman run alpine true; time ./bin/podman.s run alpine true

real	0m0.180s
user	0m0.041s
sys	0m0.036s

real	0m0.138s
user	0m0.050s
sys	0m0.021s
podman (storage) $ time ./bin/podman run alpine true; time ./bin/podman.s run alpine true

real	0m0.153s
user	0m0.048s
sys	0m0.027s

real	0m0.138s
user	0m0.054s
sys	0m0.020s

@rhatdan
Copy link
Member Author

rhatdan commented Oct 20, 2022

If I trace, the command, I see around half the stats and reads of the storage.conf file.
@vrothberg PTAL

Copy link
Member

@vrothberg vrothberg left a comment

Choose a reason for hiding this comment

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

LGTM

Will you talk to the CRI-O folks about this change? They need to account for that on SIGHUP.

@vrothberg
Copy link
Member

This along with containers/podman#16238 should also help HPC folks.

@mtrmac
Copy link
Collaborator

mtrmac commented Oct 21, 2022

Is it expected that CRI-O will trigger the reloads? If so, that work needs to happen.

@vrothberg
Copy link
Member

Is it expected that CRI-O will trigger the reloads? If so, that work needs to happen.

Yes. CRI-O is already doing that for registries.conf.

@alexlarsson
Copy link
Contributor

LGTM

@rhatdan rhatdan merged commit fae5bbf into containers:main Oct 24, 2022
@rhatdan
Copy link
Member Author

rhatdan commented Oct 24, 2022

storageConf, err := DefaultConfigFile(rootless && rootlessUID != 0)
if err != nil {
return defaultStoreOptions, err
}
return defaultStoreOptionsIsolated(rootless, rootlessUID, storageConf)
}

// UpdateOptions should be called iff container engine recieved a SIGHUP,
Copy link
Member

Choose a reason for hiding this comment

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

Typo on iff? (or is it just a term that I don't know?)

Copy link
Member

Choose a reason for hiding this comment

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

"iff" is short for "if and only if"

Copy link
Member

Choose a reason for hiding this comment

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

Didn't know it, thanks!

@rhatdan rhatdan deleted the storage branch October 24, 2022 21:24
@haircommander
Copy link
Contributor

for posterity, I don't see us making any reload claims about the storage fields. Even if we did have them, CRI-O triggers a reload on SIGHUP manually, so dropping this here should be fine (and if we ever add this support, we can use UpdateStoreOptions)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

storage.conf should be cached
6 participants