Skip to content

Commit

Permalink
persist.md: removed, merged with urls/connreuse.md
Browse files Browse the repository at this point in the history
  • Loading branch information
bagder committed Jun 19, 2024
1 parent fc1c26e commit 951aef5
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 37 deletions.
1 change: 0 additions & 1 deletion SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@
* [Passwords](cmdline/passwords.md)
* [Progress meter](cmdline/progressmeter.md)
* [Version](cmdline/curlver.md)
* [Persistent connections](cmdline/persist.md)
* [Exit code](cmdline/exitcode.md)
* [Copy as curl](cmdline/copyas.md)
* [Command line transfers](usingcurl/README.md)
Expand Down
2 changes: 0 additions & 2 deletions cmdline/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,11 @@ implementations in the most creative ways.
* [Command line options](options/)
* [Options depend on version](versions.md)
* [URLs](urls/)
* [URL globbing](globbing.md)
* [List options](listopts.md)
* [Config file](configfile.md)
* [Variables](variables.md)
* [Passwords](passwords.md)
* [Progress meter](progressmeter.md)
* [Version](curlver.md)
* [Persistent connections](persist.md)
* [Exit code](exitcode.md)
* [Copy as curl](copyas.md)
2 changes: 1 addition & 1 deletion cmdline/options/negative.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Negative options
# Negative options

For options that switch on something, boolean options, there is also a way to
switch them off. You then use the long form of the option with an initial
Expand Down
21 changes: 0 additions & 21 deletions cmdline/persist.md

This file was deleted.

31 changes: 19 additions & 12 deletions cmdline/urls/connreuse.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
# Connection reuse

Setting up a TCP connection and especially a TLS connection can be a slow
process, even on high bandwidth networks.

It can be useful to remember that curl has a connection pool internally which
keeps previously used connections alive and around for a while after they were
used so that subsequent requests to the same hosts can reuse an already
established connection.

Of course, they can only be kept alive for as long as the curl tool is
running. It is a good reason for trying to get several transfers done
within the same command line instead of running several independent curl
command line invocations.
When setting up connections to sites, curl keeps old connections around for a
while so that if the next transfer is done using the same host as a previous
transfer, it can reuse the same connection again and thus save a lot of
time. We call this persistent connections. curl always tries to keep
connections alive and reuses existing connections as far as it can.

Connections are kept in the *connection pool*, sometimes also called the
*connection cache*.

The curl command-line tool can, however, only keep connections alive for as
long as it runs, so as soon as it exits back to your command line it has to
close down all currently open connections (and also free and clean up all the
other caches it uses to decrease time of subsequent operations). We call the
pool of alive connections the *connection cache*.

If you want to perform N transfers or operations against the same host or same
base URL, you could gain a lot of speed by trying to do them in as few curl
command lines as possible instead of repeatedly invoking curl with one URL at
a time.

0 comments on commit 951aef5

Please sign in to comment.