[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [Libevent-users] delay evhttp requests



On Fri, Jan 10, 2014 at 12:41 PM, Florian Lohoff <f@xxxxx> wrote:
>
> Hi,
>
> i want to delay evhttp requests as if i answer them i'll immediatly get
> the next request. Speedwise this would be good - but not with thousands
> of clients hammering at me at the same time.
>
> So in case my backend is busy i'd like to send kind of keepalives
> but delay them for e.g. 10-30 seconds.
>
> currently i am getting the request callback and now my idea was to
> put the evhttp_request on hold and put a timer up which then pushes
> the answer.
>
> From reading the API i simply do an
>
>         evhttp_request_own
>
> on the request structure and return from callback. Later in the
> timer callback i do a
>
>         evhttp_send_reply
>         evhttp_request_free
>
> Is my understanding of the documentation right?
>

I believe that is indeed supposed to work.  Does anybody know differently?

Another option you could consider, if this one doesn't work out for
you, is using the rate-limiting functionality to attach rate-limits to
the bufferevents implementing the HTTP connections.

yrs,
-- 
Nick
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users    in the body.