Al, I'm curious to learn more about the benchmarks you ran.
sysbench --test=fileio --file-total-size=1G preparesysbench fileio --file-total-size=1G --file-test-mode=rndrw --time=60 --max-requests=0 runI measured the overhead of interception system calls with ptrace. A "blank" system call takes 20 nanoseconds. With ptrace it becomes 7 milliseconds that's is a lot (x 350 slower)! Do you think this could be solved somehow? Also is ptrace the only reason of the slowness?
--
You received this message because you are subscribed to the Google Groups "gVisor Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gvisor-users...@googlegroups.com.
To post to this group, send email to gvisor...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gvisor-users/1f151388-9d6b-4852-a94f-03350330d4ba%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
#include <stdio.h>#include <unistd.h>
int main(){ printf("<- start ->\n"); for (int i = 0; i < 1000000; i ++) { syscall(1000); } printf("<- end ->\n"); return 0;}#include <stdio.h>#include <sys/ptrace.h>#include <sys/types.h>#include <sys/wait.h>#include <unistd.h>#include <sys/user.h>#include <sys/reg.h>#include <unistd.h>#include <sys/syscall.h>
int main(){ pid_t child; long orig_eax; child = fork(); if(child == 0) { printf("-- start\n"); ptrace(PTRACE_TRACEME, 0, NULL, NULL); printf("-- test\n"); execl("./app", "app", nullptr); } else { while(true) { long orig_eax, eax; long params[3]; int status; int insyscall = 0; wait(&status); if(WIFEXITED(status)) break; orig_eax = ptrace(PTRACE_PEEKUSER, child, 8 * ORIG_RAX, NULL); //printf(">>> syscall %ld\n", orig_eax); ptrace(PTRACE_SYSCALL, child, NULL, NULL); } } return 0;}time ./app<- start -><- end ->
real 0m0.194suser 0m0.075ssys 0m0.117stime ./trace-- start-- test<- start -><- end ->
real 0m25.885suser 0m0.874ssys 0m11.179sTo view this discussion on the web visit https://groups.google.com/d/msgid/gvisor-users/b21c46be-c18c-4a0f-b038-bf1eeafa1bec%40googlegroups.com.
Hi Adin,
I am currently using gVisor with Docker. I found that compared with docker, gVisor (Ptrace) may introduce a lot of CPU migrations. Therefore, I wire the task goroutines to certain system threads by using runtime.LockOSThread(), and then use SCHED_SETAFFINITY syscall to pin these threads to certain CPUs. Doing so improves performance slightly (about 30% for running sysbench).
To further reduce the syscall cost, I have tried the gVisor (KVM platform). However, the performance is still worse than running docker on a VM (especially for system call heavy workloads). I was wondering if there is any optimizations that I can make to further improve the performance of gVisor (KVM platform)? (e.g., modifying the host kernel so that we can forward some syscalls directly to the host kernel?)
Thanks.
To view this discussion on the web visit https://groups.google.com/d/msgid/gvisor-users/CAAHL2QLE6OYnm7JorMN3jp-4gTnEDbS3ehuv1Be1ST06azbCuA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
To view this discussion on the web visit https://groups.google.com/d/msgid/gvisor-users/CAAay%2B2G4sAJT%3D%3Dwuor1LoFPbdu8UytN%3DCiYHvf5d%3DoH5dswCFQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.