cauldron icon indicating copy to clipboard operation
cauldron copied to clipboard

Gen_Server

Open dbettin opened this issue 11 years ago • 4 comments

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

dbettin avatar Sep 05 '13 06:09 dbettin

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.

meh avatar Sep 05 '13 07:09 meh

Thanks. When will you push up the rewrite?

dbettin avatar Sep 06 '13 19:09 dbettin

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

meh avatar Sep 06 '13 19:09 meh

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.

meh avatar Sep 07 '13 12:09 meh