Linux Netfilter discussions
 help / color / mirror / Atom feed
From: "Michal Kubeček" <mkubecek@suse.cz>
To: netfilter@vger.kernel.org
Cc: Jan Engelhardt <jengelh@medozas.de>
Subject: Re: limit module timer precision issue
Date: Thu, 13 Oct 2011 15:08:19 +0200	[thread overview]
Message-ID: <201110131508.20000.mkubecek@suse.cz> (raw)
In-Reply-To: <alpine.LNX.2.01.1110131420310.16250@frira.zrqbmnf.qr>

On Thursday 13 of October 2011, Jan Engelhardt wrote:
> Well, burst does not specify any rate, so claiming "per second" (or
> "per jiffy") does not make sense anyway.

It does. The match works with jiffy granularity and if you look at the 
source, you'll see that no more than burst packets per jiffy can pass.

> --limit 2000/s should always give you 2000 packets somehow
> distributed over 1 second for any burst value <= 2000. The fact that
> it does not (you observe 1000/s) hints towards what I said earlier
> that high-rate matching in xt_limit and xt_hashlimit has
> inaccuracies.

This is not an inaccuracy, this is simple result of how the token bucket 
algorithm works. You can never get more than burst packets per jiffy 
simply because you don't get more than burst tokens. The rate you get is 
approximately min(avg, burst*HZ).

The same problem exists in TBF: no matter what rate do you specify, real 
rate is effectively limited by burst*HZ (and by mtu*HZ). Fort TBF, this 
is even mentioned in the documentation.

                                                          Michal Kubeček

  reply	other threads:[~2011-10-13 13:08 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-13  1:43 limit module timer precision issue abirvalg
2011-10-12 22:57 ` Jan Engelhardt
2011-10-13  7:10 ` Michal Kubeček
2011-10-13 10:15   ` Jan Engelhardt
2011-10-13 11:23     ` Michal Kubeček
2011-10-13 12:32       ` Jan Engelhardt
2011-10-13 13:08         ` Michal Kubeček [this message]
2011-10-13 19:59 ` fuzzy_4711

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201110131508.20000.mkubecek@suse.cz \
    --to=mkubecek@suse.cz \
    --cc=jengelh@medozas.de \
    --cc=netfilter@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox