Hi Jiří,
It seems you have found solution. But to make it clear for other users...
On Wed, Mar 13, 2013 at 2:54 PM, Jiří Sedláček
<
yirie.se...@gmail.com> wrote:
> What's the intended architecture for zerogw?
>
> I was planning to use zerogw to replace http server. That would mean more
> workers (think more echo.py clients). The problem I have is that zerogw
> communicates via PUB/SUB. For the http workers replacement one would need
> either PUSH/SUB (subscription to unique request id) or PUSH/PULL. The reason
> being that only one worker would get the message as opposed to PUB/SUB where
> all workers would get and process the message.
>
HTTP workers always work with request-reply, as HTTP is inherently
request-reply protocol. Only websocket messages may be sent with
either pub-sub or push-pull. (There is an exception when HTTP is used
for websocket emulation, but it's websocket emulation anyway). And for
websockets both pub-sub and push-pull supported. Both are useful in
some situations.
Here is a tiny illustration of how to scale using pub-sub:
http://www.slideshare.net/PaulColomiets/zeromq-and-web/50
and this one for push-pull:
http://www.slideshare.net/PaulColomiets/zeromq-and-web/51
(Yeah, I know that mere illustrations are not very useful, but that
may inspire somebody to ask more :) )
> PS: my main motive is cache invalidation in http workers or in other words
> how to send a message to all http workers at once
>
Ah. You need to do it with a backend. Make a tiny script which accepts
a request and sends message with pub/sub to other workers (using just
zeromq, zerogw is of no help there). In 99% use cases you need to
authorize cache invalidation request anyway (or you are open to DoS
attacks).
--
Paul