Maybe you can try Router-Dealer instead of Rep-Req? The former is non-blocked.

Sincerely Fucong.Luo

> 在 2014年4月16日,0:58,Dong Mo <[email protected]> 写道:
> 
> Dear list,
> 
> I am new to zmq and still trying to get what is the core benefits to use that.
> 
> 1. Say I have a server that needs to handle a really large amount of request 
> from a large number of clients. If I use zmq's req and reply pattern and only 
> a single thread, it seems I will bottleneck my server due to some far away 
> (long RTT) clients. For example:
> 
> I have server S and client A, B, C. A,B,C continuously send requests to S to 
> modify a state on S(so if I multi-thread the server, I will have to have lock 
> on this state). The server can handle the request blazing fast. However, C is 
> far away from S and it takes 200ms to just send the reply back to C, so if 
> sever S is using a single thread to handle request, it will block for 200ms 
> everytime it handles request from C. Is there any better way to just spawn 
> out a lot of threads to handle client request so server does not get blocked.
> 
> 2. What is the best practice to solve the problem when using REQ/REP socket:
> 
> Client send request for server;
> 
> Client died
> 
> Server will stuck at the reply send part forever
> 
> Thanks
> -Mo
> 
> 
> _______________________________________________
> zeromq-dev mailing list
> [email protected]
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
_______________________________________________
zeromq-dev mailing list
[email protected]
http://lists.zeromq.org/mailman/listinfo/zeromq-dev

Reply via email to