runtime: In transient_store mode, move bolt_state.db to rundir

This brings a performance improvement to `podman run` on top of the
other transient_store improvements in containers/storage:

Transient mode without transient bolt_db:

Benchmark 1: bin/podman run --transient-store=true --rm --pull=never --network=host --security-opt seccomp=unconfined fedora true
  Time (mean ± σ):     130.6 ms ±   5.8 ms    [User: 44.4 ms, System: 25.9 ms]
  Range (min … max):   122.6 ms … 143.7 ms    21 runs

Transient mode with transient bolt_db:

Benchmark 1: bin/podman run --transient-store=true --rm --pull=never --network=host --security-opt seccomp=unconfined fedora true
  Time (mean ± σ):     100.3 ms ±   5.3 ms    [User: 40.5 ms, System: 24.9 ms]
  Range (min … max):    93.0 ms … 111.6 ms    29 runs

Signed-off-by: Alexander Larsson <alexl@redhat.com>
This commit is contained in:
Alexander Larsson
2022-11-09 11:39:38 +01:00
parent 25d9af8f42
commit e74b3f24e1

View File

@ -339,7 +339,11 @@ func makeRuntime(runtime *Runtime) (retErr error) {
case config.SQLiteStateStore:
return fmt.Errorf("SQLite state is currently disabled: %w", define.ErrInvalidArg)
case config.BoltDBStateStore:
dbPath := filepath.Join(runtime.config.Engine.StaticDir, "bolt_state.db")
baseDir := runtime.config.Engine.StaticDir
if runtime.storageConfig.TransientStore {
baseDir = runtime.config.Engine.TmpDir
}
dbPath := filepath.Join(baseDir, "bolt_state.db")
state, err := NewBoltState(dbPath, runtime)
if err != nil {