confidential-containers / cloud-api-adaptor

Ability to create Kata pods using cloud provider APIs aka the peer-pods approach
Apache License 2.0
48 stars 88 forks source link

optimize process-user-data startup time #2160

Closed mkulke closed 1 day ago

mkulke commented 3 days ago

the binary is currently importing a lot of libraries which have costly init() procedures (around 8-10s at startup) this is due to sharing some consts with the CAA modules. We can avoid that by inlining code in process-user-data and moving shared consts into dedicated modules.

We can use a cpuid field to narrow down a hypervisor, so we don't have to probe an IMDS endpoint while circling through the cloud provider, delaying startup.

this is the result w/ debug enabled, the crypto libraries that are used to hash initdata are still consuming a few, but it's far better now.

Nov 19 15:51:19 fedora process-user-data[676]: init main @1029 ms, 0.039 ms clock, 2600 bytes, 22 allocs