cloudius-systems / osv

OSv, a new operating system for the cloud.
osv.io
Other
4.11k stars 604 forks source link

Run OSv without the overhead of Firecracker #1228

Open costinsin opened 1 year ago

costinsin commented 1 year ago

Hello!

I am trying to build a tool that benchmarks multiple unikernel solutions and compares their performance. While I was working on benchmarking OSv's boot time I have noticed that the boot time measured from when the firecracker.py script starts running until the unikernel finishes booting is ~50ms higher than the one showed on the screen (Booted up in x ms).

I think that this ~50ms overhead comes from initializing Firecracker every time when I try to boot one instance of OSv. Is there a way to prepare the Firecracker infrastructure in advance and then run OSv unikernels on this infrastructure without the Firecracker overhead? If not, would you be interested in adding this to the firecracker.py script?

wkozaczuk commented 1 year ago

Hi @costinsin,

Sorry for the late reply. I was going to reply earlier but then I forgot.

Anyhow, I think firecracker has a socket API that firecracker.py uses when you pass --api option. Currently, in either case, it always starts firecracker. But you can imagine having firecracker process already running and then simply make an api call to a local socket it is listening on. We could change firecracker.py to have such an option. Also, python has som overhead so there may be a more efficient way to make that call.

So I guess, you can have a solution where you have a pool of ready firecracker instances ready to start OSv and then simply make calls to one of the instances and pass disk image and command line.

If you are interested in the overhead of starting and shutting down firecracker please look at this issue.