<s>
HTTP	B-Protocol
persistent	I-Protocol
connection	I-Protocol
,	O
also	O
called	O
HTTP	B-Protocol
keep-alive	I-Protocol
,	O
or	O
HTTP	B-Protocol
connection	O
reuse	O
,	O
is	O
the	O
idea	O
of	O
using	O
a	O
single	O
TCP	B-Protocol
connection	I-Protocol
to	O
send	O
and	O
receive	O
multiple	O
HTTP	B-Protocol
requests/responses	O
,	O
as	O
opposed	O
to	O
opening	O
a	O
new	O
connection	O
for	O
every	O
single	O
request/response	O
pair	O
.	O
</s>
<s>
The	O
newer	O
HTTP/2	B-Protocol
protocol	O
uses	O
the	O
same	O
idea	O
and	O
takes	O
it	O
further	O
to	O
allow	O
multiple	O
concurrent	O
requests/responses	O
to	O
be	O
multiplexed	O
over	O
a	O
single	O
connection	O
.	O
</s>
<s>
Under	O
HTTP	B-Protocol
1.0	I-Protocol
,	O
connections	O
should	O
always	O
be	O
closed	O
by	O
the	O
server	O
after	O
sending	O
the	O
response	O
.	O
</s>
<s>
using	O
HTTP/1.0	B-Protocol
,	O
started	O
to	O
add	O
an	O
unofficial	O
extension	O
(	O
to	O
the	O
protocol	O
)	O
named	O
"	O
keep-alive	O
"	O
in	O
order	O
to	O
allow	O
the	O
reuse	O
of	O
a	O
connection	O
for	O
multiple	O
requests/responses	O
.	O
</s>
<s>
Since	O
1997	O
,	O
the	O
various	O
versions	O
of	O
HTTP/1.1	B-Protocol
specifications	O
acknowledged	O
the	O
usage	O
of	O
this	O
unofficial	O
extension	O
and	O
included	O
a	O
few	O
caveats	O
regarding	O
the	O
interoperability	O
between	O
HTTP/1.0	B-Protocol
(	O
keep-alive	O
)	O
and	O
HTTP/1.1	B-Protocol
clients	O
/	O
servers	O
.	O
</s>
<s>
In	O
HTTP	B-Protocol
1.1	I-Protocol
,	O
all	O
connections	O
are	O
considered	O
persistent	O
unless	O
declared	O
otherwise	O
.	O
</s>
<s>
The	O
HTTP	B-Protocol
persistent	I-Protocol
connections	I-Protocol
do	O
not	O
use	O
separate	O
keepalive	O
messages	O
,	O
they	O
just	O
allow	O
multiple	O
requests	O
to	O
use	O
a	O
single	O
connection	O
.	O
</s>
<s>
Keepalive	O
makes	O
it	O
difficult	O
for	O
the	O
client	O
to	O
determine	O
where	O
one	O
response	O
ends	O
and	O
the	O
next	O
response	O
begins	O
,	O
particularly	O
during	O
pipelined	B-Protocol
HTTP	I-Protocol
operation	O
.	O
</s>
<s>
To	O
solve	O
this	O
problem	O
,	O
HTTP	B-Protocol
1.1	I-Protocol
introduced	O
a	O
chunked	B-Protocol
transfer	I-Protocol
coding	I-Protocol
that	O
defines	O
a	O
last-chunk	O
bit	O
.	O
</s>
<s>
Reduced	O
latency	O
in	O
subsequent	O
requests	O
(	O
no	O
handshaking	B-Protocol
and	O
no	O
slow	O
start	O
)	O
.	O
</s>
<s>
Reduced	O
CPU	B-Device
usage	O
and	O
round-trips	O
because	O
of	O
fewer	O
new	O
connections	O
and	O
TLS	O
handshakes	B-Protocol
.	O
</s>
<s>
Enables	O
HTTP	B-Protocol
pipelining	I-Protocol
of	O
requests	O
and	O
responses	O
.	O
</s>
<s>
Reduced	O
network	B-Protocol
congestion	I-Protocol
(	O
fewer	O
TCP	B-Protocol
connections	O
)	O
.	O
</s>
<s>
Errors	O
can	O
be	O
reported	O
without	O
the	O
penalty	O
of	O
closing	O
the	O
TCP	B-Protocol
connection	I-Protocol
.	O
</s>
<s>
The	O
previous	O
version	O
of	O
the	O
HTTP/1.1	B-Protocol
specification	O
but	O
in	O
the	O
words	O
of	O
RFC	O
7230	O
"	O
this	O
was	O
found	O
to	O
be	O
impractical	O
for	O
many	O
applications	O
...	O
instead	O
...	O
be	O
conservative	O
when	O
opening	O
multiple	O
connections	O
"	O
.	O
</s>
<s>
These	O
guidelines	O
are	O
intended	O
to	O
improve	O
HTTP	B-Protocol
response	O
times	O
and	O
avoid	O
congestion	O
.	O
</s>
<s>
If	O
HTTP	B-Protocol
pipelining	I-Protocol
is	O
correctly	O
implemented	O
,	O
there	O
is	O
no	O
performance	O
benefit	O
to	O
be	O
gained	O
from	O
additional	O
connections	O
,	O
while	O
additional	O
connections	O
may	O
cause	O
issues	O
with	O
congestion	O
.	O
</s>
<s>
Also	O
a	O
race	B-Operating_System
condition	I-Operating_System
can	O
occur	O
where	O
the	O
client	O
sends	O
a	O
request	O
to	O
the	O
server	O
at	O
the	O
same	O
time	O
that	O
the	O
server	O
closes	O
the	O
TCP	B-Protocol
connection	I-Protocol
.	O
</s>
<s>
Not	O
all	O
clients	O
will	O
re-send	O
the	O
request	O
,	O
and	O
many	O
that	O
do	O
will	O
only	O
do	O
so	O
if	O
the	O
request	O
has	O
an	O
idempotent	O
HTTP	B-Protocol
method	O
.	O
</s>
<s>
All	O
modern	O
web	O
browsers	O
including	O
Google	B-Application
Chrome	I-Application
,	O
Firefox	B-Application
,	O
Internet	B-Application
Explorer	I-Application
(	O
since	O
4.01	O
)	O
,	O
Opera	B-Application
(	O
since	O
4.0	O
)	O
and	O
Safari	B-Application
use	O
persistent	B-Protocol
connections	I-Protocol
.	O
</s>
<s>
By	O
default	O
,	O
Internet	B-Application
Explorer	I-Application
versions	O
6	O
and	O
7	O
use	O
two	O
persistent	B-Protocol
connections	I-Protocol
while	O
version	O
8	O
uses	O
six	O
.	O
</s>
<s>
Persistent	B-Protocol
connections	I-Protocol
time	O
out	O
after	O
60	O
seconds	O
of	O
inactivity	O
which	O
is	O
changeable	O
via	O
the	O
Windows	O
Registry	O
.	O
</s>
<s>
In	O
Firefox	B-Application
,	O
the	O
number	O
of	O
simultaneous	O
connections	O
can	O
be	O
customized	O
(	O
per-server	O
,	O
per-proxy	O
,	O
total	O
)	O
.	O
</s>
<s>
Persistent	B-Protocol
connections	I-Protocol
time	O
out	O
after	O
115seconds	O
(	O
1.92minutes	O
)	O
of	O
inactivity	O
which	O
is	O
changeable	O
via	O
the	O
configuration	O
.	O
</s>
<s>
Python	O
's	O
requests	O
library	O
contains	O
requests.Session( )	O
,	O
which	O
establishes	O
a	O
persistent	B-Protocol
HTTP	I-Protocol
connection	O
,	O
thereby	O
allowing	O
the	O
underlying	O
TCP	B-Protocol
connection	I-Protocol
to	O
be	O
reused	O
,	O
which	O
can	O
result	O
in	O
a	O
significant	O
performance	O
increase	O
.	O
</s>
