Re: [zeromq-dev] What exact networking problems ZMQ does solve?
hi Justin Karneges. I finally got your point (and point from Justin Cook, he had expressed earlier) !! Thanks a lot. You guys are talking about situation(s) when server side __is not capable__ to send FIN or RST. I reproduced situation of broken connection and blind client very easily with iptables command. Before that I was using ifdown -- and experienced grievous mental confusion because couldn't understand __how__ client socket knows that server abruptly exited. Until I found that there's such thing as RST ... :) So, during ifdown or /etc/init.d/network stop or abruptly killed server process -- kernel sends RST to client socket(s), making them aware that server gone offline. It appears that iptables is very silent connection killer ! Now my question is going more to networking field. I want that kind of situations when I can lose connection __but__ nor FIN, neither RST will be generated . In other words I want to lose connection veyr silently (from client perspective). Will be much appreciated for all that possible scenarios. Thanks in advance. BR -artemv 2013/12/11 Justin Karneges jus...@affinix.com On 12/11/2013 11:07 AM, artemv zmq wrote: If the server goes down, and their is an established session, there is no way to know that without further communication, or no response where response is expected. If there is, I would love to know about it. I found a solution. There's a lib in java called netty. So they do next: in separate thread they poll existing channels on read operation (among others) and during this poll __they can__ detect that socket was focibly closed by remote peer. Ok? So they just poll for read and when things are connected polling on read returns an info akin to 0 bytes was read, so essentially, appl. treat this like nothing was read but channel is alive!. And that's it. What it gives? Before write operation we may know the status of channel. 0 bytes read is an indicator that it's alive. If got exception -- channel is closed, and all future operations on channel are cancelled. I'm wondering why ZMQ can't do something similar or even better? o_O If you establish a TCP connection to a remote system with netty, and then do ifdown on the remote system, you will not receive any indication of this and any messages you send to the remote system will be lost. If the connection stays down long enough, maybe around 20 minutes, then the local TCP stack will timeout the connection and netty will finally report an error to your application. TCP, and therefore any framework based upon it, does not instantly report delivery failure, and in general it is hard to figure out what was not delivered when you finally do receive an error. About the best you can do is use ioctl() with SIOCOUTQ to investigate your TCP queue. Your goal of knowing instantly if a message was not delivered is not possible without a very fast heartbeat system. One thing you can do is consider delivery to have failed if you don't have a TCP connection active (or if an attempt to establish a connection resulted in a connection refused error), but just be aware that this won't cover a case of the network dropping out, as in the case of ifdown, or if someone accidentally unplugs a network cable. The short answer is that 0MQ does not solve your exact problem. It does solve a bunch of other problems though. Justin ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev
Re: [zeromq-dev] What exact networking problems ZMQ does solve?
On Thu, Dec 12, 2013 at 06:46:12PM +0200, artemv zmq wrote: [...] Now my question is going more to networking field. I want that kind of situations when I can lose connection __but__ nor FIN, neither RST will be generated . In other words I want to lose connection veyr silently (from client perspective). Will be much appreciated for all that possible scenarios. �Thanks in advance. The situations are numerous -- anything happening to any piece of the chain in between one application-level socket and the other can cause this. You have seen that at the host level a software firewall like iptables can do it. Here's a short, incomplete list of other possibilities: - Network cable unplugged on either end, or at any switch/router in between - Power cable unplugged on either end, or at any switch/router - Hardware or OS failure on either end, or at any switch/router - Overloaded/malfunctioning network hop or component dropping packets - Hackers (DDOS or other mayhem) - Fiber-seeking backhoe - Solar flares - Alien invasion / zombie apocalypse ... etc. etc. etc. The good news is that as an application developer, the solution to all of these eventualities and more is the solution that's already been mentioned: heartbeats to verify liveness, and/or request/response architecture to verify receipt. (These can be used individually or combined; they give you different information.) ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev
Re: [zeromq-dev] What exact networking problems ZMQ does solve?
On Dec 12, 2013, at 17:40, Randall Nortman rn...@wonderclown.net wrote: On Thu, Dec 12, 2013 at 06:46:12PM +0200, artemv zmq wrote: [...] Now my question is going more to networking field. I want that kind of situations when I can lose connection __but__ nor FIN, neither RST will be generated . In other words I want to lose connection veyr silently (from client perspective). Will be much appreciated for all that possible scenarios. �Thanks in advance. The situations are numerous -- anything happening to any piece of the chain in between one application-level socket and the other can cause this. You have seen that at the host level a software firewall like iptables can do it. Here's a short, incomplete list of other possibilities: - Network cable unplugged on either end, or at any switch/router in between (…) let me take this to a concrete ZMQ case: - node B does a bind socket - node A does a connect into B - between A and B there is bad network with bad nat machines. What happens: 1. network slows down or stops and HWM fills up 1.1 A with blocking socket (PUSH, DEALER, etc.): solution: send will fail when HWM is hit. Call socket.disconnect and reconnect. loose the messages on the local buffer. 1.2 A with nonblocking socket (PUB, ROUTER): solution: configure socket to use timeouts so it return error in case of fail, or use pollers, etc. Same as 1.1 1.3 socket with multiple connects and blocking (e.g. push) send will only fail when all connections are stale. if n-1 are stale but one is still working, there is no easy way to know about it. 1.4 socket with multiple connects and non blocking (e.g. pub) some subscribers will receive nothing and A and B won’t know about it. Additional trick: set linger to 0 or else the client disconnect may still try to send bytes and never close the connection. 2. network is broken in such a way that A’s side of the nat is closed but B’s side is still ESTABLISHED solution: no idea. can’t unbind the socket. can’t understand that the TCP is dead. Even if keep alive ZMQ packets were used, don’t know how to kill that connection. This is what’s happening to me now. Using PUSH-PULL, linger(0) and send with timeout I can force the clients to try to reconnect. Sometimes connections will still hang on the client side, but mostly on FIN_WAIT1 state, albeit I’ve seen a couple ESTABLISHED that couldn’t understand. On the bind side it’s typical to have dozens of ESTABLISHED connections and not be able to clean them up. They don’t seem to affect the performance, but if instead of dozens it becomes hundreds of thousands, it could become a problem. In conclusion, it’s great that ZMQ abstracts the sockets for us, but when sxxx hits the fan, it would be nice to be able to press the panic button. In this case the only panic button available is closing the zmq socket and opening a new one, killing everything. Please note I’m not complaining about anything here. Just quite confused with the current state of my lan and struggling to get solutions to my problems and, hopefully, help others and the project with that knowledge. signature.asc Description: Message signed with OpenPGP using GPGMail ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev
Re: [zeromq-dev] What exact networking problems ZMQ does solve?
Keep in mind that RST does not always mean the server is unreachable, merely that something went wrong with that particular connection. It can happen in congested environments, and usually just re-connecting works fine. The hard part in this case is knowing which messages sent on the previous connection got through, and which need resending. The simplest possible example of a case where a server can become unreachable silently: if a smartphone leaves the coverage area, and loses its connection to the data network. In general, the only way to detect this is to set a timeout, and assume that if you haven't gotten a response to your message within that time, you aren't going to get one at all. This is not a perfect assumption but it's usually good enough. (Heartbeats are a variation on this theme.) On Thu, Dec 12, 2013 at 11:46 AM, artemv zmq artemv@gmail.com wrote: hi Justin Karneges. I finally got your point (and point from Justin Cook, he had expressed earlier) !! Thanks a lot. You guys are talking about situation(s) when server side __is not capable__ to send FIN or RST. I reproduced situation of broken connection and blind client very easily with iptables command. Before that I was using ifdown -- and experienced grievous mental confusion because couldn't understand __how__ client socket knows that server abruptly exited. Until I found that there's such thing as RST ... :) So, during ifdown or /etc/init.d/network stop or abruptly killed server process -- kernel sends RST to client socket(s), making them aware that server gone offline. It appears that iptables is very silent connection killer ! Now my question is going more to networking field. I want that kind of situations when I can lose connection __but__ nor FIN, neither RST will be generated . In other words I want to lose connection veyr silently (from client perspective). Will be much appreciated for all that possible scenarios. Thanks in advance. BR -artemv 2013/12/11 Justin Karneges jus...@affinix.com On 12/11/2013 11:07 AM, artemv zmq wrote: If the server goes down, and their is an established session, there is no way to know that without further communication, or no response where response is expected. If there is, I would love to know about it. I found a solution. There's a lib in java called netty. So they do next: in separate thread they poll existing channels on read operation (among others) and during this poll __they can__ detect that socket was focibly closed by remote peer. Ok? So they just poll for read and when things are connected polling on read returns an info akin to 0 bytes was read, so essentially, appl. treat this like nothing was read but channel is alive!. And that's it. What it gives? Before write operation we may know the status of channel. 0 bytes read is an indicator that it's alive. If got exception -- channel is closed, and all future operations on channel are cancelled. I'm wondering why ZMQ can't do something similar or even better? o_O If you establish a TCP connection to a remote system with netty, and then do ifdown on the remote system, you will not receive any indication of this and any messages you send to the remote system will be lost. If the connection stays down long enough, maybe around 20 minutes, then the local TCP stack will timeout the connection and netty will finally report an error to your application. TCP, and therefore any framework based upon it, does not instantly report delivery failure, and in general it is hard to figure out what was not delivered when you finally do receive an error. About the best you can do is use ioctl() with SIOCOUTQ to investigate your TCP queue. Your goal of knowing instantly if a message was not delivered is not possible without a very fast heartbeat system. One thing you can do is consider delivery to have failed if you don't have a TCP connection active (or if an attempt to establish a connection resulted in a connection refused error), but just be aware that this won't cover a case of the network dropping out, as in the case of ifdown, or if someone accidentally unplugs a network cable. The short answer is that 0MQ does not solve your exact problem. It does solve a bunch of other problems though. Justin ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev
Re: [zeromq-dev] What exact networking problems ZMQ does solve?
zeromq.org - learn the basics - http://zeromq.org/intro:read-the-manual - the guide - http://zguide.zeromq.org/page:all I just gave you a short description of how Ømq is solving the network problems for me. On Dec 11, 2013, at 6:59, asif saeed asif.l...@gmail.com wrote: Hi Bruno, On Wed, Dec 11, 2013 at 12:38 AM, Bruno D. Rodrigues bruno.rodrig...@litux.org wrote: Xsub xpub for distribution load balancing What is Xsub xpub? Could you please explain these terms or give me a link to an online resource where these terms are explained in detail? Thanks in advance, -Asif ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev signature.asc Description: Message signed with OpenPGP using GPGMail ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev
Re: [zeromq-dev] What exact networking problems ZMQ does solve?
Okay. Thanks for your thoughts. Again, I read the guide, and I know on practice what's pub/sub/push/pull/ .. and so on. But let me ask one more time very concrete and simple question. I want to develop a client/server appl. Okay. I pick dealer/router pattern. Fine. Now my requirement is following: if server is unaccessible (wrong ip address, server is not online, server was online and then went offline, etc.) -- in this case I want to get (_instantly_) some indication that client can't send a message because server is unaccessible. It's clear? Again, I don't want to await for reply, I want to know right now that I can't send a message. Realistically, this is very classic networking issue :) So, how can ZMQ help me? Or is it possible/eligible et al to implement transactional (not batching!) applications on ZMQ? BR -artemv 2013/12/11 Bruno D. Rodrigues bruno.rodrig...@litux.org zeromq.org - learn the basics - http://zeromq.org/intro:read-the-manual - the guide - http://zguide.zeromq.org/page:all I just gave you a short description of how Ømq is solving the network problems for me. On Dec 11, 2013, at 6:59, asif saeed asif.l...@gmail.com wrote: Hi Bruno, On Wed, Dec 11, 2013 at 12:38 AM, Bruno D. Rodrigues bruno.rodrig...@litux.org wrote: Xsub xpub for distribution load balancing What is Xsub xpub? Could you please explain these terms or give me a link to an online resource where these terms are explained in detail? Thanks in advance, -Asif ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev
Re: [zeromq-dev] What exact networking problems ZMQ does solve?
Artem, This is a problem that every network developer faces. Did my message make it to its destination? If I send a message, is it likely to make it to the recipient? Fortunately, there are patterns to use to increase reliability, but even then there is no way to be 100% sure that when a message is sent, it will flow across the infrastructure and be delivered with 100% certainty without an acknowledgement. You cannot _instantly_ get an indication a server failed — or the associated infrastructure — unless you have a steady stream of bytes going across the wire, and they suddenly stop. If you want to know a node went down, you will need heartbeat messages. There are a few ways to do this. Please look at the paranoid pirate example and this: http://zguide.zeromq.org/page:all#Heartbeating -- Justin Cook On Wednesday, 11 December 2013 at 09:59, artemv zmq wrote: Okay. Thanks for your thoughts. Again, I read the guide, and I know on practice what's pub/sub/push/pull/ .. and so on. But let me ask one more time very concrete and simple question. I want to develop a client/server appl. Okay. I pick dealer/router pattern. Fine. Now my requirement is following: if server is unaccessible (wrong ip address, server is not online, server was online and then went offline, etc.) -- in this case I want to get (_instantly_) some indication that client can't send a message because server is unaccessible. It's clear? Again, I don't want to await for reply, I want to know right now that I can't send a message. Realistically, this is very classic networking issue :) So, how can ZMQ help me? Or is it possible/eligible et al to implement transactional (not batching!) applications on ZMQ? BR -artemv 2013/12/11 Bruno D. Rodrigues bruno.rodrig...@litux.org (mailto:bruno.rodrig...@litux.org) zeromq.org (http://zeromq.org) - learn the basics - http://zeromq.org/intro:read-the-manual - the guide - http://zguide.zeromq.org/page:all I just gave you a short description of how Ømq is solving the network problems for me. On Dec 11, 2013, at 6:59, asif saeed asif.l...@gmail.com (mailto:asif.l...@gmail.com) wrote: Hi Bruno, On Wed, Dec 11, 2013 at 12:38 AM, Bruno D. Rodrigues bruno.rodrig...@litux.org (mailto:bruno.rodrig...@litux.org) wrote: Xsub xpub for distribution load balancing What is Xsub xpub? Could you please explain these terms or give me a link to an online resource where these terms are explained in detail? Thanks in advance, -Asif ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org (mailto:zeromq-dev@lists.zeromq.org) http://lists.zeromq.org/mailman/listinfo/zeromq-dev ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org (mailto:zeromq-dev@lists.zeromq.org) http://lists.zeromq.org/mailman/listinfo/zeromq-dev ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org (mailto:zeromq-dev@lists.zeromq.org) http://lists.zeromq.org/mailman/listinfo/zeromq-dev ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev
Re: [zeromq-dev] What exact networking problems ZMQ does solve?
There is a new feature on 4.x called ZMQ_IMMEDIATE that will, depending on the socket type, prevent the message from being queued if the pipe (tcp socket) is not yet established. With this option enabled, the send will block until a connection is established, or a send(DONTWAIT) will return false. On Dec 11, 2013, at 9:59, artemv zmq artemv@gmail.com wrote: Okay. Thanks for your thoughts. Again, I read the guide, and I know on practice what's pub/sub/push/pull/ .. and so on. But let me ask one more time very concrete and simple question. I want to develop a client/server appl. Okay. I pick dealer/router pattern. Fine. Now my requirement is following: if server is unaccessible (wrong ip address, server is not online, server was online and then went offline, etc.) -- in this case I want to get (_instantly_) some indication that client can't send a message because server is unaccessible. It's clear? Again, I don't want to await for reply, I want to know right now that I can't send a message. Realistically, this is very classic networking issue :) So, how can ZMQ help me? Or is it possible/eligible et al to implement transactional (not batching!) applications on ZMQ? BR -artemv 2013/12/11 Bruno D. Rodrigues bruno.rodrig...@litux.org zeromq.org - learn the basics - http://zeromq.org/intro:read-the-manual - the guide - http://zguide.zeromq.org/page:all I just gave you a short description of how Ømq is solving the network problems for me. On Dec 11, 2013, at 6:59, asif saeed asif.l...@gmail.com wrote: Hi Bruno, On Wed, Dec 11, 2013 at 12:38 AM, Bruno D. Rodrigues bruno.rodrig...@litux.org wrote: Xsub xpub for distribution load balancing What is Xsub xpub? Could you please explain these terms or give me a link to an online resource where these terms are explained in detail? Thanks in advance, -Asif ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev signature.asc Description: Message signed with OpenPGP using GPGMail ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev
Re: [zeromq-dev] What exact networking problems ZMQ does solve?
hi Justin. Thanks for heads up. Ok. Clear. Especially about steady stream. But, again, let me make it very clear. I imagine following situations and desired outcomes: - Server is not up yet, and client tries to send a message. Desired outcome: big red alarm -- fail w/o waiting for reply. - Server is up, client sends a message, gets reply, everything is smooth. Then the network between client and server is getting down (e.g. ifdown eth0 on server). The client tries to send a message... Desired outcome: big red alarm -- fail w/o waiting for reply. I don't care server is up or down, or in what status an infrastructure is. I want to know one thing -- did all frames (of my message) been sent or not ? Is it posible with ZMQ? BR -artemv 2013/12/11 Justin Cook jhc...@gmail.com Artem, This is a problem that every network developer faces. Did my message make it to its destination? If I send a message, is it likely to make it to the recipient? Fortunately, there are patterns to use to increase reliability, but even then there is no way to be 100% sure that when a message is sent, it will flow across the infrastructure and be delivered with 100% certainty without an acknowledgement. You cannot _instantly_ get an indication a server failed — or the associated infrastructure — unless you have a steady stream of bytes going across the wire, and they suddenly stop. If you want to know a node went down, you will need heartbeat messages. There are a few ways to do this. Please look at the paranoid pirate example and this: http://zguide.zeromq.org/page:all#Heartbeating -- Justin Cook On Wednesday, 11 December 2013 at 09:59, artemv zmq wrote: Okay. Thanks for your thoughts. Again, I read the guide, and I know on practice what's pub/sub/push/pull/ .. and so on. But let me ask one more time very concrete and simple question. I want to develop a client/server appl. Okay. I pick dealer/router pattern. Fine. Now my requirement is following: if server is unaccessible (wrong ip address, server is not online, server was online and then went offline, etc.) -- in this case I want to get (_instantly_) some indication that client can't send a message because server is unaccessible. It's clear? Again, I don't want to await for reply, I want to know right now that I can't send a message. Realistically, this is very classic networking issue :) So, how can ZMQ help me? Or is it possible/eligible et al to implement transactional (not batching!) applications on ZMQ? BR -artemv 2013/12/11 Bruno D. Rodrigues bruno.rodrig...@litux.org (mailto: bruno.rodrig...@litux.org) zeromq.org (http://zeromq.org) - learn the basics - http://zeromq.org/intro:read-the-manual - the guide - http://zguide.zeromq.org/page:all I just gave you a short description of how Ømq is solving the network problems for me. On Dec 11, 2013, at 6:59, asif saeed asif.l...@gmail.com (mailto: asif.l...@gmail.com) wrote: Hi Bruno, On Wed, Dec 11, 2013 at 12:38 AM, Bruno D. Rodrigues bruno.rodrig...@litux.org (mailto:bruno.rodrig...@litux.org) wrote: Xsub xpub for distribution load balancing What is Xsub xpub? Could you please explain these terms or give me a link to an online resource where these terms are explained in detail? Thanks in advance, -Asif ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org (mailto:zeromq-dev@lists.zeromq.org) http://lists.zeromq.org/mailman/listinfo/zeromq-dev ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org (mailto:zeromq-dev@lists.zeromq.org) http://lists.zeromq.org/mailman/listinfo/zeromq-dev ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org (mailto:zeromq-dev@lists.zeromq.org) http://lists.zeromq.org/mailman/listinfo/zeromq-dev ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev
Re: [zeromq-dev] What exact networking problems ZMQ does solve?
Artem, There is no way to know that a node on the network went down without the lack of receiving acknowledgements that the message was received — either with TCP ACKs or a messaging pattern in 0MQ such as REQ/REP. If the the server is not up yet, and you have not established a session, then Bruno has given you the option to workaround that. If the server goes down, and their is an established session, there is no way to know that without further communication, or no response where response is expected. If there is, I would love to know about it. -- Justin Cook On Wednesday, 11 December 2013 at 10:42, artemv zmq wrote: hi Justin. Thanks for heads up. Ok. Clear. Especially about steady stream. But, again, let me make it very clear. I imagine following situations and desired outcomes: - Server is not up yet, and client tries to send a message. Desired outcome: big red alarm -- fail w/o waiting for reply. - Server is up, client sends a message, gets reply, everything is smooth. Then the network between client and server is getting down (e.g. ifdown eth0 on server). The client tries to send a message... Desired outcome: big red alarm -- fail w/o waiting for reply. I don't care server is up or down, or in what status an infrastructure is. I want to know one thing -- did all frames (of my message) been sent or not ? Is it posible with ZMQ? BR -artemv 2013/12/11 Justin Cook jhc...@gmail.com (mailto:jhc...@gmail.com) Artem, This is a problem that every network developer faces. Did my message make it to its destination? If I send a message, is it likely to make it to the recipient? Fortunately, there are patterns to use to increase reliability, but even then there is no way to be 100% sure that when a message is sent, it will flow across the infrastructure and be delivered with 100% certainty without an acknowledgement. You cannot _instantly_ get an indication a server failed — or the associated infrastructure — unless you have a steady stream of bytes going across the wire, and they suddenly stop. If you want to know a node went down, you will need heartbeat messages. There are a few ways to do this. Please look at the paranoid pirate example and this: http://zguide.zeromq.org/page:all#Heartbeating -- Justin Cook On Wednesday, 11 December 2013 at 09:59, artemv zmq wrote: Okay. Thanks for your thoughts. Again, I read the guide, and I know on practice what's pub/sub/push/pull/ .. and so on. But let me ask one more time very concrete and simple question. I want to develop a client/server appl. Okay. I pick dealer/router pattern. Fine. Now my requirement is following: if server is unaccessible (wrong ip address, server is not online, server was online and then went offline, etc.) -- in this case I want to get (_instantly_) some indication that client can't send a message because server is unaccessible. It's clear? Again, I don't want to await for reply, I want to know right now that I can't send a message. Realistically, this is very classic networking issue :) So, how can ZMQ help me? Or is it possible/eligible et al to implement transactional (not batching!) applications on ZMQ? BR -artemv 2013/12/11 Bruno D. Rodrigues bruno.rodrig...@litux.org (mailto:bruno.rodrig...@litux.org) (mailto:bruno.rodrig...@litux.org) zeromq.org (http://zeromq.org) (http://zeromq.org) - learn the basics - http://zeromq.org/intro:read-the-manual - the guide - http://zguide.zeromq.org/page:all I just gave you a short description of how Ømq is solving the network problems for me. On Dec 11, 2013, at 6:59, asif saeed asif.l...@gmail.com (mailto:asif.l...@gmail.com) (mailto:asif.l...@gmail.com) wrote: Hi Bruno, On Wed, Dec 11, 2013 at 12:38 AM, Bruno D. Rodrigues bruno.rodrig...@litux.org (mailto:bruno.rodrig...@litux.org) (mailto:bruno.rodrig...@litux.org) wrote: Xsub xpub for distribution load balancing What is Xsub xpub? Could you please explain these terms or give me a link to an online resource where these terms are explained in detail? Thanks in advance, -Asif ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org (mailto:zeromq-dev@lists.zeromq.org) (mailto:zeromq-dev@lists.zeromq.org) http://lists.zeromq.org/mailman/listinfo/zeromq-dev ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org (mailto:zeromq-dev@lists.zeromq.org) (mailto:zeromq-dev@lists.zeromq.org) http://lists.zeromq.org/mailman/listinfo/zeromq-dev
Re: [zeromq-dev] What exact networking problems ZMQ does solve?
Cool! I saw Bruno response. Justin, thanks for patience and for keep replying, I much appreciate that. BR -artemv 2013/12/11 Justin Cook jhc...@gmail.com Artem, There is no way to know that a node on the network went down without the lack of receiving acknowledgements that the message was received — either with TCP ACKs or a messaging pattern in 0MQ such as REQ/REP. If the the server is not up yet, and you have not established a session, then Bruno has given you the option to workaround that. If the server goes down, and their is an established session, there is no way to know that without further communication, or no response where response is expected. If there is, I would love to know about it. -- Justin Cook On Wednesday, 11 December 2013 at 10:42, artemv zmq wrote: hi Justin. Thanks for heads up. Ok. Clear. Especially about steady stream. But, again, let me make it very clear. I imagine following situations and desired outcomes: - Server is not up yet, and client tries to send a message. Desired outcome: big red alarm -- fail w/o waiting for reply. - Server is up, client sends a message, gets reply, everything is smooth. Then the network between client and server is getting down (e.g. ifdown eth0 on server). The client tries to send a message... Desired outcome: big red alarm -- fail w/o waiting for reply. I don't care server is up or down, or in what status an infrastructure is. I want to know one thing -- did all frames (of my message) been sent or not ? Is it posible with ZMQ? BR -artemv 2013/12/11 Justin Cook jhc...@gmail.com (mailto:jhc...@gmail.com) Artem, This is a problem that every network developer faces. Did my message make it to its destination? If I send a message, is it likely to make it to the recipient? Fortunately, there are patterns to use to increase reliability, but even then there is no way to be 100% sure that when a message is sent, it will flow across the infrastructure and be delivered with 100% certainty without an acknowledgement. You cannot _instantly_ get an indication a server failed — or the associated infrastructure — unless you have a steady stream of bytes going across the wire, and they suddenly stop. If you want to know a node went down, you will need heartbeat messages. There are a few ways to do this. Please look at the paranoid pirate example and this: http://zguide.zeromq.org/page:all#Heartbeating -- Justin Cook On Wednesday, 11 December 2013 at 09:59, artemv zmq wrote: Okay. Thanks for your thoughts. Again, I read the guide, and I know on practice what's pub/sub/push/pull/ .. and so on. But let me ask one more time very concrete and simple question. I want to develop a client/server appl. Okay. I pick dealer/router pattern. Fine. Now my requirement is following: if server is unaccessible (wrong ip address, server is not online, server was online and then went offline, etc.) -- in this case I want to get (_instantly_) some indication that client can't send a message because server is unaccessible. It's clear? Again, I don't want to await for reply, I want to know right now that I can't send a message. Realistically, this is very classic networking issue :) So, how can ZMQ help me? Or is it possible/eligible et al to implement transactional (not batching!) applications on ZMQ? BR -artemv 2013/12/11 Bruno D. Rodrigues bruno.rodrig...@litux.org (mailto: bruno.rodrig...@litux.org) (mailto:bruno.rodrig...@litux.org) zeromq.org (http://zeromq.org) (http://zeromq.org) - learn the basics - http://zeromq.org/intro:read-the-manual - the guide - http://zguide.zeromq.org/page:all I just gave you a short description of how Ømq is solving the network problems for me. On Dec 11, 2013, at 6:59, asif saeed asif.l...@gmail.com (mailto: asif.l...@gmail.com) (mailto:asif.l...@gmail.com) wrote: Hi Bruno, On Wed, Dec 11, 2013 at 12:38 AM, Bruno D. Rodrigues bruno.rodrig...@litux.org (mailto:bruno.rodrig...@litux.org) (mailto: bruno.rodrig...@litux.org) wrote: Xsub xpub for distribution load balancing What is Xsub xpub? Could you please explain these terms or give me a link to an online resource where these terms are explained in detail? Thanks in advance, -Asif ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org (mailto:zeromq-dev@lists.zeromq.org) (mailto:zeromq-dev@lists.zeromq.org) http://lists.zeromq.org/mailman/listinfo/zeromq-dev ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org (mailto:zeromq-dev@lists.zeromq.org) (mailto:zeromq-dev@lists.zeromq.org)
Re: [zeromq-dev] What exact networking problems ZMQ does solve?
hi Justin, If the server goes down, and their is an established session, there is no way to know that without further communication, or no response where response is expected. If there is, I would love to know about it. I found a solution. There's a lib in java called netty. So they do next: in separate thread they poll existing channels on read operation (among others) and during this poll __they can__ detect that socket was focibly closed by remote peer. Ok? So they just poll for read and when things are connected polling on read returns an info akin to 0 bytes was read, so essentially, appl. treat this like nothing was read but channel is alive!. And that's it. What it gives? Before write operation we may know the status of channel. 0 bytes read is an indicator that it's alive. If got exception -- channel is closed, and all future operations on channel are cancelled. I'm wondering why ZMQ can't do something similar or even better? o_O BR -artemv 2013/12/11 artemv zmq artemv@gmail.com Cool! I saw Bruno response. Justin, thanks for patience and for keep replying, I much appreciate that. BR -artemv 2013/12/11 Justin Cook jhc...@gmail.com Artem, There is no way to know that a node on the network went down without the lack of receiving acknowledgements that the message was received — either with TCP ACKs or a messaging pattern in 0MQ such as REQ/REP. If the the server is not up yet, and you have not established a session, then Bruno has given you the option to workaround that. If the server goes down, and their is an established session, there is no way to know that without further communication, or no response where response is expected. If there is, I would love to know about it. -- Justin Cook On Wednesday, 11 December 2013 at 10:42, artemv zmq wrote: hi Justin. Thanks for heads up. Ok. Clear. Especially about steady stream. But, again, let me make it very clear. I imagine following situations and desired outcomes: - Server is not up yet, and client tries to send a message. Desired outcome: big red alarm -- fail w/o waiting for reply. - Server is up, client sends a message, gets reply, everything is smooth. Then the network between client and server is getting down (e.g. ifdown eth0 on server). The client tries to send a message... Desired outcome: big red alarm -- fail w/o waiting for reply. I don't care server is up or down, or in what status an infrastructure is. I want to know one thing -- did all frames (of my message) been sent or not ? Is it posible with ZMQ? BR -artemv 2013/12/11 Justin Cook jhc...@gmail.com (mailto:jhc...@gmail.com) Artem, This is a problem that every network developer faces. Did my message make it to its destination? If I send a message, is it likely to make it to the recipient? Fortunately, there are patterns to use to increase reliability, but even then there is no way to be 100% sure that when a message is sent, it will flow across the infrastructure and be delivered with 100% certainty without an acknowledgement. You cannot _instantly_ get an indication a server failed — or the associated infrastructure — unless you have a steady stream of bytes going across the wire, and they suddenly stop. If you want to know a node went down, you will need heartbeat messages. There are a few ways to do this. Please look at the paranoid pirate example and this: http://zguide.zeromq.org/page:all#Heartbeating -- Justin Cook On Wednesday, 11 December 2013 at 09:59, artemv zmq wrote: Okay. Thanks for your thoughts. Again, I read the guide, and I know on practice what's pub/sub/push/pull/ .. and so on. But let me ask one more time very concrete and simple question. I want to develop a client/server appl. Okay. I pick dealer/router pattern. Fine. Now my requirement is following: if server is unaccessible (wrong ip address, server is not online, server was online and then went offline, etc.) -- in this case I want to get (_instantly_) some indication that client can't send a message because server is unaccessible. It's clear? Again, I don't want to await for reply, I want to know right now that I can't send a message. Realistically, this is very classic networking issue :) So, how can ZMQ help me? Or is it possible/eligible et al to implement transactional (not batching!) applications on ZMQ? BR -artemv 2013/12/11 Bruno D. Rodrigues bruno.rodrig...@litux.org (mailto: bruno.rodrig...@litux.org) (mailto:bruno.rodrig...@litux.org) zeromq.org (http://zeromq.org) (http://zeromq.org) - learn the basics - http://zeromq.org/intro:read-the-manual - the guide - http://zguide.zeromq.org/page:all I just gave you a short description of how Ømq is solving the network problems for me. On Dec 11, 2013, at 6:59, asif saeed
Re: [zeromq-dev] What exact networking problems ZMQ does solve?
Here's code reference (for netty-3.6.6) org.jboss.netty.channel.socket.nio.AbstractNioWorker.process(). Go to abstract function read(SelectionKey k) . The go to org.jboss.netty.channel.socket.nio.NioWorker.read() implementation. This block: ... try { while ((ret = ch.read(bb)) 0) { readBytes += ret; if (!bb.hasRemaining()) { break; } } failure = false; } catch (ClosedChannelException e) { // Can happen, and does not need a user attention. } catch (Throwable t) { fireExceptionCaught(channel, t); } ... So they read and catch ClosedChannelException. And then further they call close(channel, succeededFuture(channel)); which means that operation on channel will not pass. 2013/12/11 artemv zmq artemv@gmail.com hi Justin, If the server goes down, and their is an established session, there is no way to know that without further communication, or no response where response is expected. If there is, I would love to know about it. I found a solution. There's a lib in java called netty. So they do next: in separate thread they poll existing channels on read operation (among others) and during this poll __they can__ detect that socket was focibly closed by remote peer. Ok? So they just poll for read and when things are connected polling on read returns an info akin to 0 bytes was read, so essentially, appl. treat this like nothing was read but channel is alive!. And that's it. What it gives? Before write operation we may know the status of channel. 0 bytes read is an indicator that it's alive. If got exception -- channel is closed, and all future operations on channel are cancelled. I'm wondering why ZMQ can't do something similar or even better? o_O BR -artemv 2013/12/11 artemv zmq artemv@gmail.com Cool! I saw Bruno response. Justin, thanks for patience and for keep replying, I much appreciate that. BR -artemv 2013/12/11 Justin Cook jhc...@gmail.com Artem, There is no way to know that a node on the network went down without the lack of receiving acknowledgements that the message was received — either with TCP ACKs or a messaging pattern in 0MQ such as REQ/REP. If the the server is not up yet, and you have not established a session, then Bruno has given you the option to workaround that. If the server goes down, and their is an established session, there is no way to know that without further communication, or no response where response is expected. If there is, I would love to know about it. -- Justin Cook On Wednesday, 11 December 2013 at 10:42, artemv zmq wrote: hi Justin. Thanks for heads up. Ok. Clear. Especially about steady stream. But, again, let me make it very clear. I imagine following situations and desired outcomes: - Server is not up yet, and client tries to send a message. Desired outcome: big red alarm -- fail w/o waiting for reply. - Server is up, client sends a message, gets reply, everything is smooth. Then the network between client and server is getting down (e.g. ifdown eth0 on server). The client tries to send a message... Desired outcome: big red alarm -- fail w/o waiting for reply. I don't care server is up or down, or in what status an infrastructure is. I want to know one thing -- did all frames (of my message) been sent or not ? Is it posible with ZMQ? BR -artemv 2013/12/11 Justin Cook jhc...@gmail.com (mailto:jhc...@gmail.com) Artem, This is a problem that every network developer faces. Did my message make it to its destination? If I send a message, is it likely to make it to the recipient? Fortunately, there are patterns to use to increase reliability, but even then there is no way to be 100% sure that when a message is sent, it will flow across the infrastructure and be delivered with 100% certainty without an acknowledgement. You cannot _instantly_ get an indication a server failed — or the associated infrastructure — unless you have a steady stream of bytes going across the wire, and they suddenly stop. If you want to know a node went down, you will need heartbeat messages. There are a few ways to do this. Please look at the paranoid pirate example and this: http://zguide.zeromq.org/page:all#Heartbeating -- Justin Cook On Wednesday, 11 December 2013 at 09:59, artemv zmq wrote: Okay. Thanks for your thoughts. Again, I read the guide, and I know on practice what's pub/sub/push/pull/ .. and so on. But let me ask one more time very concrete and simple question. I want to develop a client/server appl. Okay. I pick dealer/router pattern. Fine. Now my requirement is following: if server is unaccessible (wrong ip address, server is not online, server was online and then went offline, etc.) -- in this case I
Re: [zeromq-dev] What exact networking problems ZMQ does solve?
On 12/11/2013 11:07 AM, artemv zmq wrote: If the server goes down, and their is an established session, there is no way to know that without further communication, or no response where response is expected. If there is, I would love to know about it. I found a solution. There's a lib in java called netty. So they do next: in separate thread they poll existing channels on read operation (among others) and during this poll __they can__ detect that socket was focibly closed by remote peer. Ok? So they just poll for read and when things are connected polling on read returns an info akin to 0 bytes was read, so essentially, appl. treat this like nothing was read but channel is alive!. And that's it. What it gives? Before write operation we may know the status of channel. 0 bytes read is an indicator that it's alive. If got exception -- channel is closed, and all future operations on channel are cancelled. I'm wondering why ZMQ can't do something similar or even better? o_O If you establish a TCP connection to a remote system with netty, and then do ifdown on the remote system, you will not receive any indication of this and any messages you send to the remote system will be lost. If the connection stays down long enough, maybe around 20 minutes, then the local TCP stack will timeout the connection and netty will finally report an error to your application. TCP, and therefore any framework based upon it, does not instantly report delivery failure, and in general it is hard to figure out what was not delivered when you finally do receive an error. About the best you can do is use ioctl() with SIOCOUTQ to investigate your TCP queue. Your goal of knowing instantly if a message was not delivered is not possible without a very fast heartbeat system. One thing you can do is consider delivery to have failed if you don't have a TCP connection active (or if an attempt to establish a connection resulted in a connection refused error), but just be aware that this won't cover a case of the network dropping out, as in the case of ifdown, or if someone accidentally unplugs a network cable. The short answer is that 0MQ does not solve your exact problem. It does solve a bunch of other problems though. Justin ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev
[zeromq-dev] What exact networking problems ZMQ does solve?
Hi community, Can you please itemize what exact networking issues ZMQ does solve? I have count 1 -- reconnection. Ok. But can you please provide more? BR -artemv ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev
Re: [zeromq-dev] What exact networking problems ZMQ does solve?
The guide covers many, many use cases: http://zguide.zeromq.org/ -Michel On Tue, Dec 10, 2013 at 7:59 AM, artemv zmq artemv@gmail.com wrote: Hi community, Can you please itemize what exact networking issues ZMQ does solve? I have count 1 -- reconnection. Ok. But can you please provide more? BR -artemv ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev
Re: [zeromq-dev] What exact networking problems ZMQ does solve?
az Can you please itemize what exact networking issues ZMQ does solve? az I have count 1 -- reconnection. Ok. But can you please provide more? Have you read the bullet points at http://zeromq.org/, or skimmed http://zeromq.org/intro:read-the-manual or the preface in the guide (http://zguide.zeromq.org/page:all)? -- Gregg ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev
Re: [zeromq-dev] What exact networking problems ZMQ does solve?
Yes I read a guide. But I want to ask question and get answer from real ppl. based on real use cases. Ok. Let me re-phrase a bit. - how one can benefit from automatic reconnection? - how one can benefit from HWM and in-memory message queueing if he/she develops peer-to-peer transactional appl.? - if peer is not connected and we send message there, why it's good idea to keep message in memory? where it helps? - can I use ZMQ if I want develop something akin to http server? if this server is down, then can I get exception that I can't send him a msg? BR -artemv 2013/12/10 Gregg Irwin gr...@pointillistic.com az Can you please itemize what exact networking issues ZMQ does solve? az I have count 1 -- reconnection. Ok. But can you please provide more? Have you read the bullet points at http://zeromq.org/, or skimmed http://zeromq.org/intro:read-the-manual or the preface in the guide (http://zguide.zeromq.org/page:all)? -- Gregg ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev
Re: [zeromq-dev] What exact networking problems ZMQ does solve?
Hi Bruno, On Wed, Dec 11, 2013 at 12:38 AM, Bruno D. Rodrigues bruno.rodrig...@litux.org wrote: Xsub xpub for distribution load balancing What is Xsub xpub? Could you please explain these terms or give me a link to an online resource where these terms are explained in detail? Thanks in advance, -Asif ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev