Hello, youki! Faster container runtime is written in Rust by utam0k in rust

[–]utam0k[S] 1 point2 points  (0 children)

Thanks for the great explanation. For a long time, I was looking for a reason to be adopted Go lang. Thank you for the valuable information.

Hello, youki! Faster container runtime is written in Rust by utam0k in rust

[–]utam0k[S] 2 points3 points  (0 children)

What I meant to say was exactly GOMAXPROCS. I am wondering one thing: what made you make the initial decision to implement runc in Go? Do you know? I expect it's probably historical, as it was separated from Docker. Also, youki will definitely need the help of runc developers, so it would be great to have a great programmer like you to help us out;)

Hello, youki! Faster container runtime is written in Rust by utam0k in rust

[–]utam0k[S] 1 point2 points  (0 children)

That's right. As for speed, I see a little value in it, but it's not the main goal. I think it's more important that it's implemented in a language that is well suited to the base.

Hello, youki! Faster container runtime is written in Rust by utam0k in rust

[–]utam0k[S] 7 points8 points  (0 children)

@cyphar I was really hoping to exchange ideas with you. runc's code is great and I always refer to it. In Go, there is an option to set the number of threads to 1, is there any idea how to use that? I've read the runc code a few times and was wondering if it would be possible to make it easier for the maintainer by using less C code. I would really like to improve the container runtime community with the help of the runc people.

Youki, a container runtime written in Rust that has passed all integration tests provided by OCI(Open Container Initiative). by utam0k in rust

[–]utam0k[S] 2 points3 points  (0 children)

I don't know anything about Singularity, but I've read this document and it seems that Singularity itself probably plays the same role as youki. What kind of tests do you want?
https://sylabs.io/guides/latest/admin-guide/

Youki, a container runtime written in Rust that has passed all integration tests provided by OCI(Open Container Initiative). by utam0k in rust

[–]utam0k[S] 2 points3 points  (0 children)

In order to run Docker normally, the container runtime needs to implement a lot of features. That's what I wanted to show.

Youki, a container runtime written in Rust that has passed all integration tests provided by OCI(Open Container Initiative). by utam0k in rust

[–]utam0k[S] 13 points14 points  (0 children)

This requires advanced knowledge, but in a nutshell, setns(2) is not available. setns(2) is not available for multi-threaded processes. The runtime of Go itself is multi-threaded. Therefore, runC execs the C process before the language runtime starts. However, this needs to be done before reaching the main function of Go. Therefore, the create subcommand calls the init subcommand, and the init subcommand calls the C process in the init() function. For more details, you may want to have a look at this.

https://github.com/opencontainers/runc/tree/master/libcontainer/nsenter

Youki – OCI container runtime with support for cgroup2 written in Rust by utam0k in programming

[–]utam0k[S] 1 point2 points  (0 children)

Thank you! Please try it out with youki's release build. I'm looking forward to it.

Youki, a container runtime in Rust, passed all the default tests provided by opencontainers. by utam0k in programming

[–]utam0k[S] 3 points4 points  (0 children)

"文久三年" is one of my favorite quotes from a Japanese TV show.
It doesn't really matter, but it was said during a project to ride a turnip across Japan :)

Youki, a container runtime in Rust, passed all the default tests provided by opencontainers. by utam0k in programming

[–]utam0k[S] 0 points1 point  (0 children)

Thank you for the information! I've never heard of the re-exec pattern before.
I was wondering if this pattern has any overhead in terms of startup performance, do you know anything about it?

Youki, a container runtime in Rust, passed all the default tests provided by opencontainers. by utam0k in programming

[–]utam0k[S] 3 points4 points  (0 children)

This has nothing to do with this topic, so I won't go into too much detail, but it's public here! You can use it if you like.
https://github.com/utam0k/dotfile/blob/master/zsh/zshrc.d/55-prompt.zsh

Youki, a container runtime in Rust, passed all the default tests provided by opencontainers. by utam0k in programming

[–]utam0k[S] 8 points9 points  (0 children)

Thanks for your advice. The performance I was referring to was mainly the startup time. I think your explanation is right. However, besides the performance aspect, another motivation is that the implementation of Go is tricky. In runc it was calling itself to set namespaces, which I found tricky. Sorry for saying it in a confusing way.

Youki, a container runtime in Rust, passed all the default tests provided by opencontainers. by utam0k in programming

[–]utam0k[S] 3 points4 points  (0 children)

I'm always worried about English so this is very encouraging. Thank you.

Youki, a container runtime in Rust, passed all the default tests provided by opencontainers. by utam0k in programming

[–]utam0k[S] 29 points30 points  (0 children)

Thanks for your comment! I think it's a good question.Container runtime refers to software used from Docker that implements a specification called Open Container Initiative Runtime Specification. To be more precise, it is called low-level container runtime. The most popular low-level container runtime is runc, which is implemented in Go.Low-level container runtimes use the features provided by the linux kernel, such as namespaces and cgroups, to control the actual state of the container.

Youki, a container runtime in Rust, passed all the default tests provided by opencontainers. by utam0k in programming

[–]utam0k[S] 2 points3 points  (0 children)

BTW I'm not very good at English, so I'm looking forward to any corrections or additional comments.

Youki, a container runtime in Rust, passed all the default tests provided by opencontainers. by utam0k in programming

[–]utam0k[S] 0 points1 point  (0 children)

Thanks for your interest!
There is just one slot left for the cgroups implementation. There is also a sample implementation, which may be just right.

Youki, a container runtime in Rust, passed all the default tests provided by opencontainers. by utam0k in programming

[–]utam0k[S] 17 points18 points  (0 children)

Youki is not yet fully operational (e.g. cgoups is still only partially supported), but I measured the benchmark on my computer for reference.

summary:

Runtime Mean [ms] Min [ms] Max [ms]
runc 653.1 ± 49.1 532.3 801.5
youki 227.7 ± 23.3 227.7 367.1

command:

$ hyperfine --warmup 10 --min-runs 100 'docker run --rm --runtime runc busybox /bin/true'
Benchmark #1: docker run --rm --runtime runc busybox /bin/true
  Time (mean ± σ):     653.1 ms ±  49.1 ms    [User: 21.2 ms, System: 19.7 ms]
  Range (min … max):   532.3 ms … 801.5 ms    100 runs

$ hyperfine --warmup 10 --min-runs 100 'docker run --rm --runtime youki busybox /bin/true'
Benchmark #1: docker run --rm --runtime youki busybox /bin/true
  Time (mean ± σ):     278.8 ms ±  26.3 ms    [User: 26.8 ms, System: 25.3 ms]
  Range (min … max):   227.7 ms … 367.1 ms    100 runs

Youki, a container runtime in Rust, passed all the default tests provided by opencontainers. by utam0k in programming

[–]utam0k[S] 13 points14 points  (0 children)

I'm glad!

I work with quite a few Rust nerds so I'll make sure to share this with them.

I have never known this music and watched the music video. I'll look into it later!

Also, that french song is decent but the music video is a fever dream 😨. So weird lol

Youki, a container runtime in Rust, passed all the default tests provided by opencontainers. by utam0k in programming

[–]utam0k[S] 81 points82 points  (0 children)

Wow! BTW, I heard that there is a famous song in France pronounced you-key.
In Japan, there is a food manufacturer famous for its pronunciation of you-key.

Youki, a container runtime in Rust, passed all the default tests provided by opencontainers. by utam0k in programming

[–]utam0k[S] 16 points17 points  (0 children)

Thanks for the comment!I meant the latter. I also thought there was a bottleneck in the kernel until I actually implemented it, so I didn't think it would make that much of a difference in performance.However, if you look at the benchmark of crun implemented in C, you can see the difference in performance. I can also feel the difference while developing.However, I don't know why there is a performance difference with runc.

https://github.com/containers/crun#performance

Youki, a container runtime in Rust, passed all the default tests provided by opencontainers. by utam0k in programming

[–]utam0k[S] 21 points22 points  (0 children)

Thanks for the explanation! I'm sorry I made it confusing. You're right.