Context Switch Performance

113 views
Skip to first unread message

Mauro Ferri

unread,
May 14, 2013, 6:35:45 PM5/14/13
to min...@googlegroups.com
Hi folks,

I have been doing some test in Minx over virtualbox and I noted that the context switch performance is not good, Could it  be  because I run minix over a virtual machine?

thanks

Antoine LECA

unread,
May 15, 2013, 5:36:47 AM5/15/13
to min...@googlegroups.com
Mauro Ferri wrote:
> I have been doing some test in Minx over virtualbox and I noted that the
> context switch performance is not good,

Please give actual data.
Like how you measure, what you are obtaining, what you are expecting.

"Not good" is just impossible to discuss in engineering terms.

> Could it be because I run minix over a virtual machine?

Yes, it could be.
Which is adding just another set of parameters you need to submit as
informations, like the host you are using, or whether you are using
hardware virtualization (VT-x, Pacifica.)


Antoine

Janne Kiiski

unread,
May 15, 2013, 3:41:43 PM5/15/13
to min...@googlegroups.com
Hi, 

I see this might be good thread to post my notes what I have done lately (Mauro, sorry for messing your thread, but I maybe some extra data wont make harm).

I've ran minix3 in virtualbox, worked with pkgsrc, and always just ignored the fact that git status/checkout/reset/etc operations are 
painfully slow and assumed that its because of virtualization.

So I finally had enough time (motivation) to do some simple tests with minix3 (virtualbox), netbsd (virtualbox) and linux (native).

HW:

- Host PC: Intel 2600K, 8G ram, 128G SSD
- virtualbox guests settings: 1G ram, 1 CPU core, VT-x enabled

SW:

- minix3 (virtualbox)

# cd /usrc/src; git log -1 --oneline
7174253 (HEAD, origin/master, origin/HEAD, master) kernel, random: adaptive entropy gather
# git --version
git version 1.7.7

- netbsd (virtualbox)

# uname -a
NetBSD  6.0.1 NetBSD 6.0.1 (GENERIC) amd64
# git --version
git version 1.8.0.1

- host (native)

# uname -srmpo                                                                                                                                                                                                                                                              !4060
Linux 3.8.0-19-generic x86_64 x86_64 GNU/Linux
# git --version
git version 1.8.1.2

Cloned git repository for each environment from: git://git.minix3.org/pkgsrc

# cd /usr/pkgsrc ; git log -1 --oneline
7ffc3b5 minix/clang31: updated distinfo

Test: time "git status" for clean tree (output a bit stripped for readability):

- minix3 (virtualbox)

# for i in `seq 10`; do time git status; done
# On branch minix-master
nothing to commit (working directory clean)
      10.45 real       7.90 user       2.53 sys
      10.46 real       8.31 user       2.13 sys
      10.48 real       8.18 user       2.28 sys
      10.41 real       7.86 user       2.53 sys
      10.38 real       8.25 user       2.13 sys
      10.46 real       7.91 user       2.53 sys
      10.43 real       7.98 user       2.43 sys
      10.43 real       7.83 user       2.56 sys
      10.45 real       8.15 user       2.28 sys
      10.46 real       7.96 user       2.48 sys

- netbsd (virtualbox)

# for i in `seq 10`; do time git status; done
# On branch minix-master
nothing to commit, working directory clean
        0.58 real         0.22 user         0.33 sys
        0.56 real         0.24 user         0.28 sys
        0.56 real         0.19 user         0.34 sys
        0.56 real         0.21 user         0.32 sys
        0.56 real         0.24 user         0.29 sys
        0.56 real         0.21 user         0.32 sys
        0.56 real         0.17 user         0.35 sys
        0.56 real         0.15 user         0.37 sys
        0.56 real         0.20 user         0.32 sys
        0.57 real         0.17 user         0.36 sys

- linux (native)

# for i in `seq 10`; do time git status; done
# On branch minix-master
nothing to commit, working directory clean
git status  0.17s user 0.13s system 99% cpu 0.302 total
git status  0.20s user 0.10s system 99% cpu 0.307 total
git status  0.20s user 0.10s system 98% cpu 0.305 total
git status  0.18s user 0.12s system 98% cpu 0.300 total
git status  0.15s user 0.15s system 98% cpu 0.301 total
git status  0.16s user 0.14s system 98% cpu 0.301 total
git status  0.18s user 0.13s system 98% cpu 0.307 total
git status  0.18s user 0.12s system 99% cpu 0.302 total
git status  0.15s user 0.14s system 98% cpu 0.301 total
git status  0.16s user 0.14s system 98% cpu 0.301 total

NOTES:

- there is small differences between systems, ~0.2s vs. ~0.6s vs. 10.5s
- netbsd on virtualbox performance is good (no experience of native performance though)
- filesystems are different on each machine: ext4 (linux), ffs (netbsd), mfs (minix) if/when it make any meaningful difference in this test case.
- git versions different
- netbsd/linux amd64 versions (64-bit)

A quick strace what is happening on linux.

# strace -f -c git status
# On branch minix-master
nothing to commit, working directory clean
% time     seconds  usecs/call     calls    errors syscall
------ ----------- ----------- --------- --------- ----------------
 46.25    0.001246           0     72311        12 lstat
 33.41    0.000900           0     33117           getdents
  9.99    0.000269           0     16603     16563 open
  5.35    0.000144           0     16599           close
  5.01    0.000135           0     16558           openat
  0.00    0.000000           0        57           read
  0.00    0.000000           0         2           write
  0.00    0.000000           0        17         5 stat
  0.00    0.000000           0        30           fstat
  0.00    0.000000           0         4           lseek
  0.00    0.000000           0        48           mmap
  0.00    0.000000           0        12           mprotect
  0.00    0.000000           0        20           munmap
  0.00    0.000000           0       235           brk
  0.00    0.000000           0         7           rt_sigaction
  0.00    0.000000           0         1           rt_sigprocmask
  0.00    0.000000           0         1           ioctl
  0.00    0.000000           0        31        20 access
  0.00    0.000000           0         1           execve
  0.00    0.000000           0         8           fcntl
  0.00    0.000000           0         5           getcwd
  0.00    0.000000           0         5           chdir
  0.00    0.000000           0         1           unlink
  0.00    0.000000           0         1         1 readlink
  0.00    0.000000           0         2           getrlimit
  0.00    0.000000           0         1           arch_prctl
  0.00    0.000000           0         1         1 futex
  0.00    0.000000           0         1           set_tid_address
  0.00    0.000000           0         1           set_robust_list
------ ----------- ----------- --------- --------- ----------------
100.00    0.002694                155680     16602 total

So, most of time spent is used to walk trough file system, as expected.
It is dangerous to make assumptions but I still do assume that lstat and getdents (readdir) syscalls are the major bottlenecks also in minix3.
There is over 100k calls just for these two functions. 

It would be interesting information to know how much time is spent in VFS/MFS code vs. sending messages in and out.

- janne kiiski





--
You received this message because you are subscribed to the Google Groups "minix3" group.
To unsubscribe from this group and stop receiving emails from it, send an email to minix3+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



Reply all
Reply to author
Forward
0 new messages