Allow mod_esi:deliver/2 to handle binary data
Bernard Duggan
bernie@REDACTED
Wed Feb 23 05:59:17 CET 2011
Hi all,
We've been using mod_esi to deliver binary files over HTTP. In
testing, some particularly large files were thrown at it and we ended up
exhausting the VM's memory and crashing it. The ultimate problem is
that mod_esi:deliver/2 is asynchronous, so there's no way to know how
fast or slowly to feed it data to avoid the target process' queue
getting too big. That's a bit of a trickier problem than I could
quickly deal with (not least because it would require an interface
change/addition).
Instead, to mitigate the problem I've made a small change which
allows mod_esi:deliver/2 to take binary data, rather than forcing the
caller to convert it to a list first (and thus avoiding both the
conversion cost and the copy cost as the list is passed between processes).
You can grab it with
git fetch git://github.com/bernardd/otp.git mod_esi_binary
Cheers,
Bernard
More information about the erlang-patches
mailing list