Skip to content
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

rate limit calls to posix_fadvise() #145

Merged
merged 1 commit into from
Jul 6, 2017
Merged

rate limit calls to posix_fadvise() #145

merged 1 commit into from
Jul 6, 2017

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
Collaborator

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 join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants