On Thu, Oct 14, 2010 at 12:26 AM, Raine Fan <raine...@ymail.com> wrote: > Hi, I'm programming a libevent2 based app that measures read/write > efficiency from a remote (TCP) server using event based paradigms. > Since I'm new to libevent's and event based paradigm, I'm also using > 'buffervevent' and 'evbuffer' interfaces to gather and push data onto > sockets instead of plain old read/write syscalls. > My app is being limited by (it seems) a hardcoded limit of 4096 bytes when i > fully drain a evbuffer on a single call. Instead, i would like to know if > there is any special function/interface to modify this limit. > I know there is a specialized call 'bufferevent_setwatermark(...)' and even > rate limit interfaces, that would allow a read or write event be dispatched > to my callback whenever a low/high watermark level was being reached. The > problem is that when using this kind of calls, libevent core aggregate and > wait until this limit comes true what would confuse the stats i'm measuring, > and also would not be as efficient as changing the read/write data len > bucket directly and getting more data in a single roll/call (this premise is > for my study case). > Is any other interface available on libevent 2.0 that would allow to change > this 4096 byte limit? If not, would be possible including it on the 2.0 > release timeframe?
Ugh. It looks like you're running into EVBUFFER_MAX_READ, defined in buffer.c . You can edit the source and redefine it as high as you want, but there's no way to change it programmatically right now. I'd love to make the "how much to read or write" logic more -- well, logical -- in the future, but as the code stands now I'm worried that fiddling with it now in 2.0 would break somebody, somewhere. You could pretty easily also turn it from a macro into a static variable, and add a function to set it. I'd be leery of doing that in the main codebase right now, since it's not the right interface long-term. In 2.1, I think the answer is for somebody take the risk and refactor the "how much to read or write" logic entirely, probably removing the notion of EVBUFFER_MAX_READ along the way. yrs, -- Nick *********************************************************************** To unsubscribe, send an e-mail to majord...@freehaven.net with unsubscribe libevent-users in the body.