• Pádraig Brady's avatar
    rate limit calls to posix_fadvise() · dacd2967
    Pádraig Brady authored
    There can be a large kernel overhead involved in POSIX_FADV_DONTNEED.
    There is no point in calling this per item logged, so rate limit
    to at most once per 2MiB written.
    
    With a simple test program that logs 100K items at WARNING level:
    
    Before:
    
      $ time strace -c -e fadvise64 log.test \
        -log_dir=/dev/shm -logtofiles=true -logtostderr=false
      % time     seconds  usecs/call     calls    errors syscall
      ------ ----------- ----------- --------- --------- ----------------
      100.00   12.522509         125     99957           fadvise64
      ------ ----------- ----------- --------- --------- ----------------
      real    0m52.671s
      user    0m2.194s
      sys     0m44.022s
    
    After:
    
      $ time strace -c -e fadvise64 log.test \
        -log_dir=/dev/shm -logtofiles=true -logtostderr=false
    
      % time     seconds  usecs/call     calls    errors syscall
      ------ ----------- ----------- --------- --------- ----------------
      100.00    0.000759         152         5           fadvise64
      ------ ----------- ----------- --------- --------- ----------------
      real    0m4.206s
      user    0m1.436s
      sys     0m3.153s
    
    Fixes issue #84
    dacd2967
Name
Last commit
Last update
cmake Loading commit data...
doc Loading commit data...
m4 Loading commit data...
packages Loading commit data...
src Loading commit data...
vsprojects Loading commit data...
.gitignore Loading commit data...
AUTHORS Loading commit data...
CMakeLists.txt Loading commit data...
CONTRIBUTING.md Loading commit data...
CONTRIBUTORS Loading commit data...
COPYING Loading commit data...
ChangeLog Loading commit data...
INSTALL Loading commit data...
Makefile.am Loading commit data...
Makefile.in Loading commit data...
NEWS Loading commit data...
README Loading commit data...
README.windows Loading commit data...
aclocal.m4 Loading commit data...
compile Loading commit data...
config.guess Loading commit data...
config.sub Loading commit data...
configure Loading commit data...
configure.ac Loading commit data...
depcomp Loading commit data...
glog-config.cmake.in Loading commit data...
google-glog.sln Loading commit data...
install-sh Loading commit data...
libglog.pc.in Loading commit data...
ltmain.sh Loading commit data...
missing Loading commit data...
mkinstalldirs Loading commit data...
test-driver Loading commit data...