<div dir="ltr">Hi!<div><br></div><div>Did you do any profiling?</div><div><br></div><div>Reading the patch I noticed that you have replaced single [Mochiweb's Req:stream_body + file:write] with iterative [cowboy_req:body + file:write]. So your process now writes to file (possibly blocking on it) every MTU (typically 1.5K) bytes instead of single write — about 70K syscalls per second on gigabit network. </div><div>I'd suggest adding a large buffer (e.g. 1 MB) to not access the file too often.</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Nov 9, 2014 at 12:41 AM, Shayan Pooya <span dir="ltr"><<a href="mailto:shayan@liveve.org" target="_blank">shayan@liveve.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hello,<br><br>I have ported Disco to use cowboy instead of mochiweb. Mochiweb has been quite stable and we did not have any issues with it recently. However, cowboy uses the sendfile syscall which avoids a lot of overhead when serving static files and I thought that could lower the memory footprint of Disco when serving large files and free up some cycles. Disco+cowboy is now fully functional and all of the integration tests pass (minus some minor missing features).<br><br>I wanted to get a sense of the performance before making the switch and used a couple of different Disco jobs (which pressure the web-servers) to do a comparison and the Disco version with cowboy consistently takes 10 to 20 percent longer to finish. I haven't done much for optimizing the usage of cowboy yet, but the micro-benchmarks that I find on the web are contrary to what I am seeing here and I wanted to know if anyone can offer some guidance for getting better results with cowboy.<br><br>I am using cowboy 1.0.1 and the Cowboy patch for Disco is available at <a href="https://github.com/pooya/disco/commit/5499d696438" target="_blank">https://github.com/pooya/disco/commit/5499d696438</a> just in case.<br><br>Regards.<br></div>
<br>_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div><font face="'courier new', monospace">Danil Zagoskin | <a href="mailto:z@gosk.in" target="_blank">z@gosk.in</a></font></div></div></div>
</div>