Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #96913

Re: Lightwight socket IO wrapper

Path csiph.com!eternal-september.org!feeder.eternal-september.org!border1.nntp.ams1.giganews.com!nntp.giganews.com!usenetcore.com!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!nzpost1.xs4all.net!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.007
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; '21,': 0.07; 'badly': 0.07; 'bits': 0.07; 'nasty': 0.07; 'socket': 0.07; 'cc:addr:python- list': 0.09; 'bits.': 0.09; 'bsd': 0.09; 'file-like': 0.09; 'http,': 0.09; 'times,': 0.13; 'ack': 0.16; 'defaults,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'simpson': 0.16; 'stuff,': 0.16; 'tcp': 0.16; 'wrappers': 0.16; 'writes.': 0.16; 'wrote:': 0.16; '>>>': 0.20; '2015': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'sep': 0.22; 'am,': 0.23; '(or': 0.23; '(you': 0.23; 'header:In-Reply-To:1': 0.24; 'mon,': 0.24; "doesn't": 0.26; 'chris': 0.26; 'message- id:@mail.gmail.com': 0.27; 'data,': 0.27; 'idea': 0.28; 'delayed': 0.29; 'socket,': 0.29; 'another': 0.32; 'received:google.com': 0.35; 'so,': 0.35; 'protocol': 0.35; 'something': 0.35; 'level': 0.35; 'but': 0.36; 'should': 0.36; 'depends': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'agree': 0.37; 'one,': 0.37; 'doing': 0.38; 'end': 0.39; 'data': 0.39; 'waiting': 0.60; 'your': 0.60; 'skip:u 10': 0.61; 'times': 0.63; 'cameron': 0.66; "they're": 0.66; 'risk': 0.68; 'directly.': 0.76; 'topic,': 0.79; 'counts': 0.81; 'algorithm,': 0.84; 'all!': 0.84; 'chrisa': 0.84; 'queued': 0.84; 'together,': 0.84; 'to:none': 0.91; 'trouble.': 0.91; 'response,': 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=hoqnjEqANiQaIIjTSE9TT276ax7gorQekCyJjf0GIKA=; b=tQ09TLo5DAI3CfsYOHZVMdvKmtdYFpiQN+LrtOGC7O91qPWmbLz7yx5UyEugxDRAt6 mNdDuEezx0Xk70tLm7I4wLDr1bzZocVE/rjIVuFy01BeXWIPOpp5kwwPfygV6IdwwEAe RUqIyuZdhxxcQvi4VvtRHf2n8j3TynC2jRMT3TtkFm+2sVpiR+7fGEqRcAzxo/CB5dj3 eIPrno2FDqQWAGxuBjZEvw+fMmsm0KmrEHvLJrvboLZYaouQMbDddYF0fzv/TG7m2NBX PFsNA7/Dg9C6T0ypitvdbjuAzBTmc8edbl8iDcpKxSlPIJRC1+DUK/pks+zs2OjAwXIS vhRw==
MIME-Version 1.0
X-Received by 10.107.36.72 with SMTP id k69mr22680458iok.157.1442810906070; Sun, 20 Sep 2015 21:48:26 -0700 (PDT)
In-Reply-To <876134e683.fsf@elektro.pacujo.net>
References <CAPTjJmpLyuy==kY4hj11pGkRedhBS5vevitmzeDvwz8rQpSSag@mail.gmail.com> <20150921015514.GA70236@cskk.homeip.net> <mailman.17.1442803211.28679.python-list@python.org> <876134e683.fsf@elektro.pacujo.net>
Date Mon, 21 Sep 2015 14:48:25 +1000
Subject Re: Lightwight socket IO wrapper
From Chris Angelico <rosuav@gmail.com>
Cc "python-list@python.org" <python-list@python.org>
Content-Type text/plain; charset=UTF-8
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.20.1442810914.28679.python-list@python.org> (permalink)
Lines 37
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1442810914 news.xs4all.nl 23856 [2001:888:2000:d::a6]:45838
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:96913

Show key headers only | View raw


On Mon, Sep 21, 2015 at 2:39 PM, Marko Rauhamaa <marko@pacujo.net> wrote:
> Chris Angelico <rosuav@gmail.com>:
>
>> On Mon, Sep 21, 2015 at 11:55 AM, Cameron Simpson <cs@zip.com.au> wrote:
>>> Another nice thing about TCP is that wil a little effort you get to
>>> pack multiple data packets (or partial data packets) into a network
>>> packet, etc.
>>
>> Emphatically - a little effort sometimes, and other times no effort at
>> all! If you write a packet of data, then write another one, and
>> another, and another, and another, without waiting for responses,
>> Nagling should combine them automatically. And even if they're not
>> deliberately queued by Nagle's Algorithm, packets can get combined for
>> other reasons. So, yeah! Definitely can help a lot with packet counts
>> on small writes.
>
> Unfortunately, Nagle and delayed ACK, which are both defaults, don't go
> well together (you get nasty 200-millisecond hickups).

Only in the write-write-read scenario. If you write-read-write-read,
or if your reads don't depend on your writes, then Nagle + delayed ACK
works just fine. But if you write a bunch of stuff, then block waiting
for the other end to respond, and then write multiple times, and wait
for a response, _then_ the pair work badly together, yes.

> As for the topic, TCP doesn't need wrappers to abstract away the
> difficult bits. That's a superficially good idea that leads to trouble.

Depends what you're doing - if you're working with a higher level
protocol like HTTP, then abstracting away the difficult bits of TCP is
part of abstracting away the difficult bits of HTTP, and something
like 'requests' is superb. But if you're inventing your own protocol,
directly on top of a BSD socket, then I would agree - just call socket
functions directly. Otherwise you risk nasty surprises when your
file-like object has ridiculous performance problems.

ChrisA

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: Lightwight socket IO wrapper Chris Angelico <rosuav@gmail.com> - 2015-09-21 12:40 +1000
  Re: Lightwight socket IO wrapper Marko Rauhamaa <marko@pacujo.net> - 2015-09-21 07:39 +0300
    Re: Lightwight socket IO wrapper Chris Angelico <rosuav@gmail.com> - 2015-09-21 14:48 +1000
      Re: Lightwight socket IO wrapper Marko Rauhamaa <marko@pacujo.net> - 2015-09-21 09:56 +0300
    Re: Lightwight socket IO wrapper Michael Ströder <michael@stroeder.com> - 2015-09-21 09:02 +0200
      Re: Lightwight socket IO wrapper Marko Rauhamaa <marko@pacujo.net> - 2015-09-21 10:57 +0300
        Re: Lightwight socket IO wrapper Michael Ströder <michael@stroeder.com> - 2015-09-21 10:29 +0200
          Re: Lightwight socket IO wrapper Marko Rauhamaa <marko@pacujo.net> - 2015-09-21 11:47 +0300
            Re: Lightwight socket IO wrapper MRAB <python@mrabarnett.plus.com> - 2015-09-21 13:26 +0100

csiph-web