{"action":"created","issue":{"url":"https://api.github.com/repos/just-containers/s6-overlay-builder/issues/3","labels_url":"https://api.github.com/repos/just-containers/s6-overlay-builder/issues/3/labels{/name}","comments_url":"https://api.github.com/repos/just-containers/s6-overlay-builder/issues/3/comments","events_url":"https://api.github.com/repos/just-containers/s6-overlay-builder/issues/3/events","html_url":"https://github.com/just-containers/s6-overlay-builder/issues/3","id":59477479,"number":3,"title":"benchmark execline init scripts","user":{"login":"dreamcat4","id":63074,"avatar_url":"https://avatars.githubusercontent.com/u/63074?v=3","gravatar_id":"","url":"https://api.github.com/users/dreamcat4","html_url":"https://github.com/dreamcat4","followers_url":"https://api.github.com/users/dreamcat4/followers","following_url":"https://api.github.com/users/dreamcat4/following{/other_user}","gists_url":"https://api.github.com/users/dreamcat4/gists{/gist_id}","starred_url":"https://api.github.com/users/dreamcat4/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dreamcat4/subscriptions","organizations_url":"https://api.github.com/users/dreamcat4/orgs","repos_url":"https://api.github.com/users/dreamcat4/repos","events_url":"https://api.github.com/users/dreamcat4/events{/privacy}","received_events_url":"https://api.github.com/users/dreamcat4/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-03-02T12:54:01Z","updated_at":"2015-03-16T05:53:35Z","closed_at":"2015-03-16T05:53:35Z","body":"Laurent says:\r\n\r\nUse execline scripting for `init`, because init only needs to be run 1 time at system start. However this is not true for containers (or jails, namespaces, or whatever you want to call it). Which uses linux namespaces kernel feature.\r\n\r\nThe startup time is OK if you have just a few containers. Then it OK and does not seem too slow.\r\n\r\nHowever it is possible to have many more containers running. For example on a production server - to utilize the full host resources.\r\n\r\nThen the startup time matter more. For example, let us imagine a XEON host was fully loaded, and it had to start up **100** containers at boot time. If we assume `execline` based scripts incur a 1 second delay starting inside each container. Then in total that take **100** seconds (additional overhead). For to bring up the server or restart it.\r\n\r\nI have not tested yet our init startup time. It is not \"1 second\". Yet it is not instant.\r\n\r\nMaybe in future (eventually) we can write a 'C' program instead to replace the `stage1` and `stage2`. Then such extra delay / overhead can be a lot less. Expecially if not launching out many individual seperate programs (like we are during the execline script)."},"comment":{"url":"https://api.github.com/repos/just-containers/s6-overlay-builder/issues/comments/81433525","html_url":"https://github.com/just-containers/s6-overlay-builder/issues/3#issuecomment-81433525","issue_url":"https://api.github.com/repos/just-containers/s6-overlay-builder/issues/3","id":81433525,"user":{"login":"glerchundi","id":2232214,"avatar_url":"https://avatars.githubusercontent.com/u/2232214?v=3","gravatar_id":"","url":"https://api.github.com/users/glerchundi","html_url":"https://github.com/glerchundi","followers_url":"https://api.github.com/users/glerchundi/followers","following_url":"https://api.github.com/users/glerchundi/following{/other_user}","gists_url":"https://api.github.com/users/glerchundi/gists{/gist_id}","starred_url":"https://api.github.com/users/glerchundi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/glerchundi/subscriptions","organizations_url":"https://api.github.com/users/glerchundi/orgs","repos_url":"https://api.github.com/users/glerchundi/repos","events_url":"https://api.github.com/users/glerchundi/events{/privacy}","received_events_url":"https://api.github.com/users/glerchundi/received_events","type":"User","site_admin":false},"created_at":"2015-03-16T05:53:35Z","updated_at":"2015-03-16T05:53:35Z","body":"I benchmarked both with 1000 samples. Our image under test starts every s6 services up and then executes `test -1`. Ubuntu does the same with the difference that it doesn't use a s6 supervision tree, take it with a grain of salt but after setting `S6_KILL_GRACETIME=0` and removing [`s6-sleep -m 200`](https://github.com/just-containers/s6-overlay-builder/blob/v1.8.1/builder/overlay-rootfs/etc/s6/init/init-stage3#L28) it should be more or less accurate.\r\n\r\n`ubuntu:14.04`:\r\n\r\n```\r\n#> time docker run -ti -e S6_KILL_GRACETIME=0 ubuntu test -1\r\n\r\nreal   0m0.656s\r\nuser   0m0.143s\r\nsys    0m0.008s\r\n```\r\n\r\n`justcontainers/base` (based in s6-overlay-builder 1.8.1):\r\n\r\n```\r\n#> time docker run -ti -e S6_KILL_GRACETIME=0 base test -1\r\n\r\nreal   0m0.743s\r\nuser   0m0.142s\r\nsys    0m0.008s\r\n```\r\n\r\nSo, the results shows that **s6 takes** more or less **87ms** more than its base image starting everything up. Taking into account what we're doing it's quite fast :-)"}}