Skip to main content

Compression and Performance

SCP performance can be tuned through compression, cipher selection, and bandwidth limiting. These options are especially useful for slow or metered connections.

Compression (-C)

Enables gzip compression on the SSH channel. Most effective for text-heavy data (logs, SQL dumps, config files). Less effective for already-compressed data (.tar.gz, .zip, images).

Example: Transfer Logs with Compression

Command:

scp -C ./access.log admin@server:/archive/

Output:

access.log                             100%  500MB  55.0MB/s   00:09

Without -C, the same file might show 35.0MB/s on the same link — compression reduces the actual bytes sent.

When Compression Helps vs Hurts
Data TypeCompression Benefit
Logs, CSV, SQL dumpsSignificant (2-10x reduction)
Source code, configsGood (2-5x reduction)
Images, video, .tar.gzMinimal or negative (CPU overhead)

Cipher Selection (-c)

Different ciphers trade security margin for speed. On trusted internal networks, a faster cipher can boost throughput.

Available Ciphers

ssh -Q cipher

Output:

aes128-ctr
aes192-ctr
aes256-ctr
aes128-gcm@openssh.com
aes256-gcm@openssh.com
chacha20-poly1305@openssh.com

Example: Use a Faster Cipher

Command:

scp -c aes128-gcm@openssh.com ./large-dataset.csv admin@server:/data/

Output:

large-dataset.csv                      100% 2048MB  58.0MB/s   00:35
Cipher Speeds (Approximate)
CipherRelative SpeedSecurity
aes128-gcm@openssh.comFastestGood
aes256-gcm@openssh.comFastVery Good
chacha20-poly1305@openssh.comModerateExcellent
aes256-ctrModerateVery Good

Bandwidth Limiting (-l)

Limits transfer speed in Kbit/s. Useful to prevent SCP from saturating the network.

Desired Speed-l Value
1 MB/s8000
5 MB/s40000
10 MB/s80000
50 MB/s400000

Example: Limit to 5 MB/s

Command:

scp -l 40000 ./backup.tar.gz admin@server:/backups/

Output:

backup.tar.gz                          100% 1024MB   5.0MB/s   03:25

Verbose and Debug (-v)

Use -v to see the full SSH handshake and transfer debug info. Stack up to three times (-vvv) for maximum detail.

Example: Debug a Slow Transfer

Command:

scp -v ./file.txt admin@server:/tmp/

Output:

Executing: program /usr/bin/ssh host server
debug1: Reading configuration data /home/user/.ssh/config
debug1: Connecting to server [192.168.1.100] port 22.
debug1: Connection established.
debug1: identity file /home/user/.ssh/id_ed25519 type 3
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering public key: /home/user/.ssh/id_ed25519
debug1: Authentication succeeded (publickey).
file.txt 100% 4096 2.0MB/s 00:00

Example: Maximum Verbosity

Command:

scp -vvv ./file.txt admin@server:/tmp/

Output:

(extensive debug output including key exchange details,
MAC algorithms negotiated, channel multiplexing, etc.)
file.txt 100% 4096 2.0MB/s 00:00

Performance Comparison

StrategyBest ForFlag
CompressionText-heavy files over slow links-C
Fast cipherLarge transfers on trusted networks-c aes128-gcm@openssh.com
Bandwidth limitShared or metered connections-l <kbps>
Tar + SSH pipeMany small filestar czf - dir | ssh host "tar xzf -"

What's Next?

Learn how to transfer through bastion servers in Jump Host and Proxy.