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


Groups > comp.lang.python > #108667

OT: limit number of connections from browser to my server?

Path csiph.com!feeder.erje.net!1.eu.feeder.erje.net!newsfeed0.kamp.net!newsfeed.kamp.net!fu-berlin.de!uni-berlin.de!not-for-mail
From Grant Edwards <grant.b.edwards@gmail.com>
Newsgroups comp.lang.python
Subject OT: limit number of connections from browser to my server?
Date Mon, 16 May 2016 16:06:09 +0000 (UTC)
Lines 57
Message-ID <mailman.17.1463414817.19823.python-list@python.org> (permalink)
References <nhcr5g$o1k$1@ger.gmane.org>
X-Trace news.uni-berlin.de 0DySGfyvr+fxVDWR0DYPwAGnZWds4leP6GRMS45QtbnA==
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'socket': 0.07; 'subject:number': 0.07; 'https': 0.09; 'page?': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'received:qwest.net': 0.09; 'python': 0.10; 'assume': 0.11; 'files.': 0.13; 'file,': 0.15; 'prototype': 0.15; 'at,': 0.16; 'massively': 0.16; 'mutliple': 0.16; 'received:80.91.229.3': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'specific,': 0.16; 'subject:limit': 0.16; 'subject:server': 0.16; 'tcp': 0.16; 'two,': 0.16; 'looked': 0.16; 'ssl': 0.18; 'solution.': 0.18; 'load': 0.20; 'library': 0.20; 'versions': 0.20; 'browsers': 0.22; 'seems': 0.23; 'header': 0.24; 'requests': 0.25; "i've": 0.25; 'header:User-Agent:1': 0.26; "doesn't": 0.26; 'header:X-Complaints-To:1': 0.26; 'handling': 0.27; 'css': 0.27; 'turns': 0.27; 'device': 0.28; 'fine': 0.28; "i'm": 0.30; 'connection': 0.30; 'connections': 0.30; 'seconds': 0.31; "can't": 0.32; 'embedded': 0.32; 'good.': 0.32; 'control,': 0.33; 'http': 0.33; 'open': 0.33; 'running': 0.34; 'server': 0.34; 'so,': 0.35; 'could': 0.35; '???': 0.35; 'problem.': 0.35; 'but': 0.36; 'there': 0.36; "wasn't": 0.36; 'to:addr:python-list': 0.36; 'subject:?': 0.36; 'subject:: ': 0.37; 'setting': 0.37; 'received:org': 0.37; 'seem': 0.37; 'subject:from': 0.39; 'takes': 0.39; 'to:addr:python.org': 0.40; 'some': 0.40; 'software': 0.40; 'your': 0.60; 'skip:u 10': 0.61; 'matter': 0.63; 'our': 0.64; 'grab': 0.64; 'limit': 0.65; 'benefit': 0.66; 'life': 0.67; 'customers': 0.70; 'connection,': 0.72; 'devices.': 0.84; 'farms': 0.84; 'edwards': 0.91; 'beverage': 0.93
X-Injected-Via-Gmane http://gmane.org/
X-Gmane-NNTP-Posting-Host 67-130-15-94.dia.static.qwest.net
User-Agent slrn/1.0.2 (Linux)
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.22
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>
X-Mailman-Original-Message-ID <nhcr5g$o1k$1@ger.gmane.org>
Xref csiph.com comp.lang.python:108667

Show key headers only | View raw


This is not Python specific, though I'm turning to Python to do some
experimentation and to try to prototype a solution.

Is there any way to limit the number of connections a browser uses to
download a web page?  Browser writers seems to assume that all https
servers are massively parallel server farms with hardware crypto
support.

So, when a browser wants to load a page that has the main html file, a
css file, a javascript library or two, and a few icons and background
bitmaps, they browser opens up a half-dozen SSL connections in
parallel.

That's fine when the server is Facebook's server farm.

But when it's a small embedded device running at 40MHz with a
single-threaded web server and software crypto, it turns a 2-second
page load time into a 15-second page load time.

When we first added https support years ago, this wasn't a problem.  A
browser would open _an_ SSL connection (handshake time around 2
seconds), and then send mutliple HTTP requests over that connection to
grab a half-dozen files.  Each HTTP request would take a few tens of
milliseconds, and life was good.

Now that 2-second page load takes up to 10-15 seconds because of all
the SSL connection setup overhead involved in handling a half-dozen
"parallel" connections.

I was _hoping_ there was an HTTP header or HTML meta tag that could be
used to smack the browser with a clue bat, but there doesn't seem to
be.  [Please tell me I'm wrong...]

Some browsers used to have a global "max parallel connections" setting
that the user could control, but a) that seems to be gone from recent
versions of browsers I've looked at, and b) we can't ask customers to
change that setting just for the benefit of our devices.

So now I'm going to set up a simple Python HTTP server to try some
other approaches:

  1) Only allow the listening socket to accept 1 connection at a time.

  2) Accept the TCP connection, but don't allow the SSL handshaking to
     start on the "extra" connections.

  3) ???

  4) Profits!

Any ideas?

-- 
Grant Edwards               grant.b.edwards        Yow! What's the MATTER
                                  at               Sid? ... Is your BEVERAGE
                              gmail.com            unsatisfactory?

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


Thread

OT: limit number of connections from browser to my server? Grant Edwards <grant.b.edwards@gmail.com> - 2016-05-16 16:06 +0000
  Re: OT: limit number of connections from browser to my server? Steven D'Aprano <steve@pearwood.info> - 2016-05-17 03:11 +1000
    Re: OT: limit number of connections from browser to my server? Grant Edwards <grant.b.edwards@gmail.com> - 2016-05-16 19:28 +0000
    Re: OT: limit number of connections from browser to my server? Grant Edwards <grant.b.edwards@gmail.com> - 2016-05-16 22:09 +0000
      Re: OT: limit number of connections from browser to my server? Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2016-05-17 18:06 +1200
        Re: OT: limit number of connections from browser to my server? Marko Rauhamaa <marko@pacujo.net> - 2016-05-17 09:23 +0300
          Re: OT: limit number of connections from browser to my server? Grant Edwards <grant.b.edwards@gmail.com> - 2016-05-17 14:23 +0000
        Re: OT: limit number of connections from browser to my server? Grant Edwards <grant.b.edwards@gmail.com> - 2016-05-17 14:22 +0000

csiph-web