Skip to content
This repository was archived by the owner on Jun 30, 2025. It is now read-only.

Conversation

@pixelb
Copy link
Contributor

@pixelb pixelb commented Dec 9, 2016

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

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
@shinh shinh merged commit 96f6656 into google:master Jul 6, 2017
@shinh
Copy link
Contributor

shinh commented Jul 6, 2017

Looks great, thanks!

@pixelb pixelb deleted the rate-limit-posix-fadvise branch November 1, 2017 20:56
durswd pushed a commit to durswd/glog that referenced this pull request Sep 2, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants