-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reduce the overhead of shutting down the Firecracker process #1164
Comments
Hi @wkozaczuk First, I feel sorry for asking out-scoped question here, but your post comparing boot-time between qemu microvm and firecracker really interests me and guide me here. I'm also interested in evaluating their boot/startup time in a certain fair way for both. What I can come up as below:
However, the specific problems below occur, say if I want to measure the time to run a
I see you gave very detailed time breakdown in other place, very good. I would be much appreciated if you can shed some experiences :-) |
I've been experimenting a bit with this issue, trying to add Adding
Adding
Next, injecting
Leads to a 30ms overhead:
I guess it has something to do with the cost of destroying these objects. But we would have to dive deeper. |
Hi @wkozaczuk , I did a bit more research on this. As far as I understand, indeed the process counts as fully destroyed only when the parent fetches the exit status via As for the added latency, I could track a big chunk of it (about 20ms) here:
As far as I know, this is the expected I will close this issue since it doesn't seem related to Firecracker. Feel free to reopen it if needed. |
I ran into the same problem elsewhere. Here is what I have found. Maybe it will help you. The program below spawns a process in a new IPC namespace. Then the new process replaces itself with
#define _GNU_SOURCE
#include <sched.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/utsname.h>
#include <sys/wait.h>
#include <unistd.h>
#define err_exit(msg) \
do { \
perror(msg); \
exit(EXIT_FAILURE); \
} while (0)
static int child_fn(void *arg) {
char *const argv[] = {"/bin/ls", NULL};
char *const env[] = {NULL};
execve(argv[0], argv, env);
return 0;
}
#define STACK_SIZE (1024 * 1024)
int main(int argc, char *argv[]) {
int new_ipc = argc == 2 && strcmp(argv[1], "NEWIPC") == 0;
char *stack;
char *stack_top;
pid_t pid;
stack = malloc(STACK_SIZE);
stack_top = stack + STACK_SIZE;
int flags = SIGCHLD;
if (new_ipc) {
flags |= CLONE_NEWIPC;
}
pid = clone(child_fn, stack_top, flags, argv[1]);
printf("clone() returned %ld\n", (long)pid);
waitpid(pid, NULL, 0);
printf("child has terminated\n");
return 0;
}
Execute
[pid 30483] The duration between Execute
[pid 30487] The duration between It seems that the IPC namespace causes the overhead(about 25ms) of shutting down. Is it a kernel bug? |
Based on some casual measurements it takes 40-60ms from the moment exit() is called to the moment Linux host considers Firecracker dead. For more details please see this and that comment from somewhat related issue.
The text was updated successfully, but these errors were encountered: