zhengfish | 13 Jun 2012 16:39
Picon
Gravatar

How to limit the read/write( input/output ) traffic?

Hi, all
    I want to shape the read/write traffic, I check the data-structure
    I find there are 4 members in the struct bufferevent which maybe do that function.
    However I don't know how to do it in detail steps.
    Anyone can share some tips for that?


struct bufferevent {
    ......

    /** An input buffer. Only the bufferevent is allowed to add data to
        this buffer, though the user is allowed to drain it. */
    struct evbuffer *input;

    /** An input buffer. Only the bufferevent is allowed to drain data
        from this buffer, though the user is allowed to add it. */
    struct evbuffer *output;

    struct event_watermark wm_read;
    struct event_watermark wm_write;

};

--

_ __ _ _ ___| |__ ___ _ __ __ _ / _(_)___| |__ |_ / '_ \ / _ \ '_ \ / _` | | |_| / __| '_ \ / /| | | | __/ | | | (_| | | _| \__ \ | | | /___|_| |_|\___|_| |_|\__, | |_| |_|___/_| |_| |___/

Mark Ellzey | 13 Jun 2012 17:46

Re: How to limit the read/write( input/output ) traffic?

On Wed, Jun 13, 2012 at 10:39:01PM +0800, zhengfish wrote:
> Hi, all
>     I want to shape the read/write traffic, I check the data-structure
>     I find there are 4 members in the struct bufferevent which maybe do
> that function.
>     However I don't know how to do it in detail steps.
>     Anyone can share some tips for that?
> 

If I am understanding this correctly you want to do rate-limiting on a
bufferevent? If so check out
http://www.wangafu.net/~nickm/libevent-book/Ref6a_advanced_bufferevents.html
under the section "Bufferevents and Rate-limiting".

Cheers.

***********************************************************************
To unsubscribe, send an e-mail to majordomo <at> freehaven.net with
unsubscribe libevent-users    in the body.


Gmane