lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Tue, Apr 12, 2011 at 4:13 PM, Robert G. Jakabosky <bobby@sharedrealm.com> wrote:
On Sunday 10, joshua simmons wrote:
> Cool benchmarks. Cool release.

Thanks, and thank you for coming up with name ideas for the project.

> I'll have to have a play some time.

When you have some time and if you are interested I have an idea on how to add
thread support to your mongrel2 lua handler.  Basically the main thread would
act as the request load balancer and spawn X child threads to run the handler
code.  The balancer thread would pull requests from mongrel2 and push then to
the child handlers.  The child handlers would be able to send responses
directly back to mongrel2 without having to route them back through the
balancer thread.  For "chat server" like handlers they would need to have a
way to share messages between the child handlers, this shouldn't be to hard to
do but would require the handler to be multi-thread aware.

For handlers that don't need or want to be multi-thread, they could work like
normal and run in the main thread (i.e. without the extra balancer hop for
requests).

--
Robert G. Jakabosky


Would it not be easier to have each thread create their own zmq socket and connect to the server directly? Unless you need magic balancing stuff, in which case might a zmq device be more suited?