meh / cauldron

I wonder what kind of Elixir is boiling in there.
74 stars 7 forks source link

Gen_Server #4

Open dbettin opened 11 years ago

dbettin commented 11 years ago

For my educational purposes, why wasn't cauldron built with gen_server capabilities?

meh commented 11 years ago

Because there's no way to avoid reading messages from handle_info/2 and some receives are done in a certain order.

Right now I'm rewriting it to use the new elixir-socket API which allows for nicer active sockets and using a gen_server, but I'm facing the same problem, I don't want to spawn 3 processes just to handle a single request and to write the writer in a single process I need a special kind of ordered receive to write the responses in the proper order.

I'm trying to figure out a way to keep the gen_server without spawning helper processes but it doesn't look like it's going to be doable.

dbettin commented 11 years ago

Thanks. When will you push up the rewrite?

meh commented 11 years ago

As soon as it works, which could be hours or a few days.

meh commented 11 years ago

I pushed the rewrite in its own branch. Apparently it's 2x slower than the original code which surprised me quite a bit.

Less suprising is that using the new protocol based API has eaten about 300 req/s.

I think I need a completely different approach because this is unbearably slow.