<div dir="ltr">I'm a bit curious to your comments about unsupervised processes in Elli and Elli not following the OTP principles. Why do you think unsupervised request processes is a bad thing? They are short-lived and you cannot restart them in any meaningful way.<div>
<br></div><div>It is true that Elli does not hook any of the processes it creates into a supervisor. As a user of Elli, you include the Elli "server" inside your supervision tree. This server starts linked acceptor processes which accepts a new connection, then handles the request (and keep-alive) before they die and the Elli server starts a new acceptor. If any of these processes exits abnormally, Elli knows about it. If you wish to find these processes to debug something, you can use elli:get_acceptors(ElliPid) or process_info(ElliPid, links). Mochiweb and Yaws does more or less the same.</div>
<div><br></div><div>Knut</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Jun 25, 2013 at 10:06 PM, Loïc Hoguin <span dir="ltr"><<a href="mailto:essen@ninenines.eu" target="_blank">essen@ninenines.eu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">You'd also end up with tons of unsupervised processes, which isn't a good thing when you want to see what's wrong in your production system later on (something I last did today and do quite regularly when consulting). That's the biggest difference between the two, Cowboy follows OTP principles, elli doesn't. Unfortunately supervision does have a cost when you need to accept many short-lived processes quickly, but we have done a lot of work in Ranch to reduce that cost as much as possible. You could always replace Ranch with something that doesn't supervise if you really need to optimize to death, but so far even the handful of companies that I know that use it for ad bidding and other high frequency purposes haven't had the need to do that.<br>
<br>
In short: removing supervision only looks good on benchmarks.<div class="im"><br>
<br>
On 06/25/2013 09:52 PM, okeuday wrote:<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
When I use their benchmark here:<br>
<a href="https://github.com/yesodweb/benchmarks" target="_blank">https://github.com/yesodweb/<u></u>benchmarks</a><br>
(as mentioned here:<br>
<a href="http://www.yesodweb.com/blog/2011/03/preliminary-warp-cross-language-benchmarks" target="_blank">http://www.yesodweb.com/blog/<u></u>2011/03/preliminary-warp-<u></u>cross-language-benchmarks</a>)<br>
to test elli, here:<br>
<a href="https://github.com/knutin/elli" target="_blank">https://github.com/knutin/elli</a><br>
<br>
I get 99000 req/s. The (httperf) test of CloudI's http_req erlang<br>
service using cowboy gives 13358 req/s. cowboy has more features, so<br>
that can explain the extra average latency which limits throughput.<br>
<br>
If you want to understand why their benchmark isn't decent, read this:<br>
<a href="http://www.mnot.net/blog/2011/05/18/http_benchmark_rules" target="_blank">http://www.mnot.net/blog/2011/<u></u>05/18/http_benchmark_rules</a><br>
<br>
So, if you want something faster in Erlang, you could use ellis,<br>
however, keep in mind their testing isn't long enough to be meaningful<br>
(due to garbage collection and other impacts on performance).<br>
<br>
<br>
On Tuesday, June 25, 2013 10:38:25 AM UTC-7, BM Kim wrote:<br>
<br></div><div><div class="h5">
Damian Dobroczyński <qoocku <at> <a href="http://gmail.com" target="_blank">gmail.com</a> <<a href="http://gmail.com" target="_blank">http://gmail.com</a>>> writes:<br>
<br>
><br>
> W dniu <a href="tel:25.06.2013%2013" value="+12506201313" target="_blank">25.06.2013 13</a>:51, BM Kim pisze:<br>
> > Hi folks,<br>
> ><br>
> > First of all, I want to apologise for my poor english skills,<br>
> > since english is not my first language, but I'll try my best<br>
> > to formulate my quesions as clear as possible.<br>
> ><br>
> > Second, I've just begun to learn erlang, so if I'm asking<br>
> > obvious "noob" questions I apologise for that too in advance...<br>
> ><br>
> > Anywho, now to my actual question:<br>
> ><br>
> > I am planning to write a high-performance server application in<br>
erlang,<br>
> > which will primarily handle HTTP requests. After some reseach with<br>
google,<br>
> > I narrowed down my choices to cowboy, misultin and mochiweb and<br>
decided<br>
> > to go with the cowboy library first...<br>
> ><br>
> > Looking at some tutorials, I've quickly built a small server<br>
capable of<br>
> > serving static files and was eager to see first<br>
benchmark-results...<br>
> > I've also built a small Haskell server using Warp library to<br>
compare it<br>
> > with erlang's cowboy...<br>
> ><br>
> > But my first impression was, that my cowboy server is much much<br>
slower<br>
than<br>
> > expected when serving static-files and after some research I<br>
found a<br>
presentation<br>
> > of the cowboy's author claiming that cowboy shouldn't be used for<br>
serving<br>
> > static-files. So I modified the server code, so that it replies<br>
to every<br>
> > request with in-memory 4Kb binary blob and compared it with my<br>
haskell<br>
warp<br>
> > server serving 4kb static file...<br>
> ><br>
> > this is my simple cowboy's http handler:<br>
> ><br>
> ><br>
------------------------------<u></u>------------------------------<u></u>----------<br>
> ><br>
> > blob() -><br>
> > [<<0:8>> || _ <- lists:seq(1,4096)].<br>
><br>
> First, try to replace blob/0 function with this:<br>
><br>
> blob() -> <<0:(4096*8)>>.<br>
><br>
> Then, restart the test and report ;)<br>
><br>
<br>
<br>
Hi,<br>
<br>
Thank you very much for pointing out the obvious mistake...<br>
After correcting it, I got improvement from 5940 req/s to 8650 req/s...<br>
<br>
But still much slower than the haskell warp-server, which has throughput<br>
of 38000 req/s...<br>
<br>
But I have another question regarding blob/0. Is it going to be<br>
evaluated<br>
only once (like GHC would do) since it is a pure expression? I'm not<br>
so sure, since erlang is not pure and any function can have side-effects<br>
which you can't mark as with the IO monad in Haskell...<br>
<br>
______________________________<u></u>_________________<br>
erlang-questions mailing list<br></div></div>
<a href="mailto:erlang-q...@erlang.org" target="_blank">erlang-q...@erlang.org</a> <javascript:><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/<u></u>listinfo/erlang-questions</a><br>
<<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/<u></u>listinfo/erlang-questions</a>><div class="im"><br>
<br>
<br>
<br>
______________________________<u></u>_________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/<u></u>listinfo/erlang-questions</a><br>
<br>
</div></blockquote>
<br><div class="im HOEnZb">
<br>
-- <br>
Loïc Hoguin<br>
Erlang Cowboy<br>
Nine Nines<br>
<a href="http://ninenines.eu" target="_blank">http://ninenines.eu</a><br></div><div class="HOEnZb"><div class="h5">
______________________________<u></u>_________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/<u></u>listinfo/erlang-questions</a><br>
</div></div></blockquote></div><br></div>