Path: csiph.com!usenet.pasdenom.info!news.etla.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.051 X-Spam-Evidence: '*H*': 0.90; '*S*': 0.00; 'responding': 0.07; 'occasionally': 0.09; 'overwrite': 0.09; 'subject:using': 0.09; 'sure,': 0.09; 'cc:addr:python-list': 0.11; "(you're": 0.16; 'closure.': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'high-volume': 0.16; 'idle,': 0.16; 'roy': 0.16; 'subject:send': 0.16; 'tcp': 0.16; 'through.': 0.16; 'trivially': 0.16; 'udp,': 0.16; 'prevent': 0.16; 'wrote:': 0.18; 'bit': 0.19; 'trying': 0.19; 'basically': 0.19; 'starts': 0.20; 'fit': 0.20; 'example': 0.22; 'otherwise,': 0.22; 'cc:addr:python.org': 0.22; 'certainly': 0.24; 'sorry,': 0.24; 'guys': 0.24; 'mon,': 0.24; 'cc:2**0': 0.24; "i've": 0.25; 'switch': 0.26; 'least': 0.26; 'gets': 0.27; 'header:In-Reply-To:1': 0.27; 'point': 0.28; 'chris': 0.29; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; '(since': 0.31; 'argue': 0.31; 'end,': 0.31; 'critical': 0.32; 'another': 0.32; '(i.e.': 0.33; 'guess': 0.33; "i'd": 0.34; 'could': 0.34; "can't": 0.35; 'agree': 0.35; 'common': 0.35; 'connection': 0.35; 'possible.': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'really': 0.36; 'data,': 0.36; 'idle': 0.36; 'doing': 0.36; 'next': 0.36; 'possible': 0.36; 'should': 0.36; 'behind': 0.37; 'too': 0.37; 'being': 0.38; 'represent': 0.38; 'connections': 0.38; 'nov': 0.38; 'anything': 0.39; 'does': 0.39; 'bad': 0.39; 'heard': 0.39; 'around.': 0.60; 'catch': 0.60; 'slowly': 0.60; 'most': 0.60; 'full': 0.61; 'new': 0.61; 'establish': 0.61; "you're": 0.61; 'kind': 0.63; 'skip:n 10': 0.64; 'more': 0.64; 'talking': 0.65; 'corporate': 0.67; 'close': 0.67; 'smith': 0.68; 'power': 0.76; '100%': 0.77; 'article': 0.77; 'low': 0.83; '512': 0.84; 'updates,': 0.84; 'inefficient': 0.91; 'reasoning': 0.91; 'to:none': 0.92; 'imagine': 0.93; 'luck': 0.93; 'state.': 0.95 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=58P9hUdWWz7y58ltMgH/HXkXEpKj/+06wYMQVFs4CLU=; b=t3t8MkYjXcOpE1QveUw8m1m/+NjP5X+63LcNbV3DzgFxCR6jdpYkHP/ySuv1f0L+4K yhsWGDV5QIJEq7CGIA0rmFUjoWzeU6I3Upw2e8q1AePYfgXAgkdSmWGOS7LLXQGmlXNk hS0GZmrbn7gTepX0m1v21uGx7MqBLIg8FndbaMgDdNCwnR8zEcJJI7qWtSbCZpKLhgKO TeCBhdGTjRUwpiuOY9Z4ytO8XY8oCKQbmk75zBjZt67gPFk4Np3YUTPvpLPKMoUHy6OM tFea4XNP/qbcDH+aaIiCxfuN83XIhUhz9CVSaHvgT5DAGtn/GE0AdruAST7IlCSAc20B t0+w== MIME-Version: 1.0 X-Received: by 10.50.171.193 with SMTP id aw1mr21997378igc.2.1416175003639; Sun, 16 Nov 2014 13:56:43 -0800 (PST) In-Reply-To: References: <87oas7ntvv.fsf@dpt-info.u-strasbg.fr> Date: Mon, 17 Nov 2014 08:56:43 +1100 Subject: Re: OTish: using short-term TCP connections to send to multiple slaves From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 56 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1416175005 news.xs4all.nl 2858 [2001:888:2000:d::a6]:56440 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:80914 On Mon, Nov 17, 2014 at 4:21 AM, Roy Smith wrote: > In article , > Chris Angelico wrote: > >> UDP for anything more than your network's MTU is inefficient > > Why do you say it's inefficient? Sure, the UDP datagram will get > fragmented and re-assembled at the other end, but it's not like TCP > would do any better. One way or another, your data is going to be > transmitted in packet that fit into the MTU. Sorry, is less efficient. I was responding to the point about 64KB being way too big for UDP, when really it's perfectly possible. It's common to keep UDP packet sizes as low as possible to take advantage of non-fragmentation efficiency (hence the DNS TCP switchover at 512 bytes), but I've sent some huge UDP packets around. >> plus you'd need to roll your own acknowledgement system so you know >> when the client got the data, at which point you're basically >> recreating TCP. > > That I certainly agree with. UDP should be used for fire-and-forget, > where its not critical that every bit of data gets through. A classic > example is high-volume logging. Once you start thinking about any kind > of acknowledgements, you should just switch to TCP. The alternative is > that you will slowly end up reinventing TCP (and doing a bad job of it). Another good use of UDP is where it's not 100% critical that *every* update get to *every* client instantly, but a client can "catch up" when it gets the next notification. (Since clients can be down, you'd need some kind of catch-up mechanic anyway.) If the data involved can fit inside a single UDP packet, this is trivially easy: just overwrite with the new state. Otherwise, some kind of update counter works too ("hmm, I got update 5, this one's update 7, I guess I'd better catch up"). If most clients collect most UDP updates, but occasionally they establish a TCP connection to do the full catch-up, you can get some handy conveniences. >> NAT is the most common cause of breakage, but any router does have the >> power to monitor and drop connections on any basis it likes. (I can't >> imagine any reason a non-NAT router would want to prevent connections >> from going idle, but it could be done.) > > It's common in corporate networks for routers to forcibly close idle > connections (i.e. inject RST packets). Often, the IT security guys > think idle connections represent some kind of threat (and good luck > trying to argue with them). Yeah... but I can't imagine any reason for those connections to be a threat. I've heard of it happening but I cannot fathom the reasoning behind it. (You're also suggesting a much nicer approach than the worst-case I was talking about: with RST injection, at least one end will be immediately aware of the closure. If the router just starts dropping packets, much harder.) ChrisA