How to run concurrent (parrallel) downloads with lftp?

Abstract: Resolve slow lftp download speeds by enabling concurrent transfers via the set parallel directive to maximize throughput.

Created: 2026-09-08 by
You can enable concurrent downloads in lftp by setting the parallel variable to a positive integer, such as set parallel 4, before executing your transfer command. This feature allows lftp to open multiple simultaneous connections to the server, significantly increasing throughput for large batches of files or high-latency networks.

Configuring Parallel Transfers

The primary mechanism for enabling parallel downloads in lftp is the set parallel directive. This setting tells lftp how many concurrent file transfers it should attempt at any given time. By default, lftp may only use one connection per session depending on the version and configuration, which can bottleneck performance when downloading many small files or when network latency is high. To apply this setting, you have two main options: passing it directly via the command line or configuring it within your .lftprc initialization file. The command-line approach is useful for one-off tasks, while the configuration file method ensures the behavior persists across all sessions. When using the command line, you can prepend the set command to your mirror or get operation. For example:
lftp -e "set parallel 4; mirror /remote/path /local/path" ftp://[email protected]
In this snippet, set parallel 4 instructs lftp to maintain four simultaneous download threads. You can adjust the number based on your network capacity and server limits. A value between 3 and 8 is often optimal for most broadband connections, but higher values may be beneficial for fiber connections with low latency. If you prefer a persistent configuration, add the following line to your ~/.lftprc file:
set parallel 4
This ensures that every time you launch lftp, it automatically initializes with four parallel connections. This is particularly helpful if you frequently perform bulk downloads or synchronize directories.

Understanding Connection Limits and Server Restrictions

While increasing the number of parallel connections can boost speed, it is not without risks. Many FTP and SFTP servers impose limits on the number of simultaneous connections per user to prevent abuse or resource exhaustion. If you exceed these limits, the server may reject new connections, leading to errors or incomplete transfers. Before setting a high parallel value, check your server's documentation or contact the administrator to determine the maximum allowed connections. Common defaults range from 3 to 10 concurrent connections. Exceeding these limits might result in timeout errors or being temporarily banned from the server. Additionally, some servers may throttle bandwidth individually per connection rather than per user. In such cases, increasing parallelism might not yield significant speed improvements because each thread receives a smaller slice of the total bandwidth. Monitor your actual transfer rates to determine if higher parallelism provides diminishing returns. For SFTP connections, note that the SSH protocol itself does not natively support multiplexed data streams in the same way HTTP/2 does. Lftp handles this by opening multiple distinct SSH tunnels, which increases CPU overhead on both client and server. Ensure your system resources are sufficient to handle the additional encryption/decryption load.

Optimizing Mirror Commands for Parallelism

The mirror command is the most common use case for parallel downloads in lftp. It recursively copies directories from the remote site to the local machine. When combined with the parallel setting, it efficiently downloads entire directory trees. However, the order of operations matters. Always set the parallel variable before invoking mirror. If you set it after, the initial batch of files may already be queued with single-threaded behavior.
lftp -e "set parallel 6; set net:timeout 30; mirror --continue /data /backup/data" sftp://[email protected]
In this example, we also set a network timeout to prevent hanging connections from stalling the entire process. The --continue flag ensures that interrupted downloads resume rather than restarting, which is crucial when managing many concurrent transfers. You can also combine parallel downloads with filtering options. For instance, to download only specific file types in parallel:
lftp -e "set parallel 4; mirror -R --include='*.jpg' /photos /local/photos" ftp://images.example.com
This command mirrors only JPEG images, leveraging parallelism to accelerate the transfer of media-heavy directories.

Troubleshooting Common Issues

Users sometimes encounter issues when enabling parallel downloads, such as connection refusals or increased error rates. If you receive messages like "Connection refused" or "Too many connections," reduce the parallel value immediately. Another common problem is the "pseudo-tty allocation failed" error, which can occur when running lftp scripts in automated environments like cron jobs. This issue is unrelated to parallelism but can compound problems if not addressed separately. Ensure your shell environment is correctly configured for non-interactive sessions. See our guide on Troubleshooting 'pseudo-tty allocation failed' error when running lftp in shell script via cronjob for detailed resolution steps. If downloads fail intermittently, check your network stability. High packet loss can exacerbate issues with multiple simultaneous connections. Consider lowering the parallel count or increasing the timeout settings to allow more recovery time for individual streams. For users experiencing stuck connections during SFTP sessions, particularly those showing "ls0[Connecting...]", refer to our article on SFTP Connection Stuck: Troubleshooting 'ls0[Connecting...]' Issues to diagnose potential handshake or firewall interference.

Frequently Asked Questions

Does parallel downloading work with SFTP?

Yes, lftp supports parallel downloads over SFTP by opening multiple independent SSH connections. However, be aware that this increases CPU usage due to repeated encryption overhead. Test with lower parallel counts first to ensure your server can handle the load.

How do I limit bandwidth while using parallel downloads?

Use the set limit rate command to cap the total bandwidth usage. For example, set limit rate 10M restricts all combined transfers to 10 MB/s. This prevents lftp from saturating your internet connection when multiple threads are active.

Why are my parallel downloads slower than single-threaded ones?

This usually happens when the server throttles per-connection bandwidth or when network latency is high. Each parallel connection incurs a setup cost and competes for shared resources. Reducing the parallel count or switching to a server with higher per-connection limits often resolves this.

Can I use parallel uploads with lftp?

Yes, the parallel setting applies to both uploads and downloads. Use mirror -R (reverse mirror) to upload directories in parallel. Ensure the server allows incoming connections and has sufficient write permissions for the target directory.

What is the maximum recommended parallel value?

There is no universal maximum, but values above 10 often provide diminishing returns and may trigger server-side restrictions. Start with 4-8 connections and increase gradually while monitoring transfer stability and server response times.

Latest News

How to Display Output of xterm Command in Terminal Screen using Cron

Resolve the inability to display xterm output in a terminal screen from cron by redirecting logs or using wall instead of insecure X11 workarounds.

Read More
Expose Local Server on VPS Preserving Real Client IPs (OS Level)

Resolve VPS logging showing only gateway IPs by configuring reverse proxies to forward real client addresses via X-Forwarded-For headers.

Read More
How to Clear Recent Files History in Linux without Deleting Actual Files?

Clear recent files history in Linux by deleting ~/.local/share/recently-used.xbel without removing the actual files.

Read More
Best HDD Copy Strategy: Manually Syncing and Rewriting Scratch

Resolve data drift between two 4TB hard drives by using rsync with the --delete flag to manually sync and rewrite scratch data for an exact mirror.

Read More
Understanding Bash Prompt Abbreviations: An Overview

Resolve repetitive typing errors by creating and persisting Bash aliases in the .bashrc file for improved command-line efficiency.

Read More
Free Tools and Methods to Log Real-Time Performance Details in Task Manager

Log real-time CPU and memory metrics to CSV files using Windows Performance Monitor Data Collector Sets to troubleshoot system slowness.

Read More
Contact Qatar Airways Customer Service: Phone Number, Help Center, and More

Resolve urgent Qatar Airways reservation issues like flight changes and baggage claims using the US phone number +1801-855-5905 or online self-service tools.

Read More
Windows 11: Alt Codes Displaying Wrong Characters - Solutions

Resolve Windows 11 Alt codes showing wrong characters by verifying the US keyboard layout and enabling Num Lock.

Read More
Run Programs with Elevated Privileges: A Comprehensive Guide

Eliminates the need to type sudo for frequent administrative tasks by configuring .bashrc aliases or functions.

Read More
Dynamically Changing Dates in Excel Formulas Using Cells

Eliminate manual date updates in Excel by using cell references to create dynamic formulas that automatically adjust calculations when input dates change.

Read More
Granting Edit Access to a Specific Excel Sheet in an Office 365 User Email ID-Based Login

Excel Online lacks native sheet-level permissions, so users must split workbooks or use worksheet protection to isolate edit access for specific tabs.

Read More
Creating Network Load on Local Wi-Fi from One PC

Generate sustained Wi-Fi bandwidth load from a single PC using a VM SFTP server to test router stability and throughput.

Read More
Changing the Default Editor for Batch Files in Windows 11's File Explorer

Resolve the issue of batch files opening in Notepad by changing the default editor to a preferred application like VS Code.

Read More
Gain WiFi Connection Minutes Before Losing it by Changing MAC Address

Bypass MAC address filtering to restore WiFi connectivity temporarily when a device is blocked by network administrators.

Read More
Photos Folders Turned Black: Troubleshooting Picture Applications on Windows

Resolve black screens in Windows Photos by resetting the app, updating graphics drivers, and repairing system files.

Read More
Troubleshooting High CPU Temperature Values: A Step-by-Step Guide

Resolve high CPU temperatures and thermal throttling by monitoring with Speedfan, cleaning dust from cooling components, and replacing degraded thermal paste.

Read More
Make cURL establish TLS connection with CA unknown

Resolve cURL TLS connection failures with unknown or self-signed certificates by using the --insecure flag to bypass CA validation.

Read More
Troubleshooting Incorrect Network Metrics Values in Grafana, Prometheus, InfluxDB, and Telegraf

Fix incorrect network metrics in Grafana, Prometheus, InfluxDB, and Telegraf by verifying interface selection, resolving unit mismatches, and handling counter resets.

Read More
Start Another Terminal Window (cmd.exe) Windows Repair/Troubleshoot

Provides step-by-step instructions to access the Windows Command Prompt via bootable media for advanced system repair and troubleshooting.

Read More
Thinkpad P1 Gen 6: Sudden Thunderbolt 3 Dock USB-C Charging Stopped Working

Resolve sudden Thunderbolt 3 dock USB-C charging and internet failure on ThinkPad P1 Gen 6 by updating firmware, resetting the dock, and adjusting power settings.

Read More
ASUS Windows 11 Laptop: Internet Connection Issue with Hotspot

Resolve ASUS Windows 11 laptop spinning wheel issue when connecting to mobile hotspot by resetting network stack, disabling IPv6, and adjusting power settings.

Read More
Developing iOS Project with Firebase: Logging in and Sending Push Notifications

Integrates Firebase to enable secure user authentication and push notifications in iOS applications.

Read More
Troubleshooting Bash Script with Suspected Issues of Spaces, Dashes, Filenames and Quoting

Resolve Bash script failures caused by word splitting, globbing, and special characters in filenames by applying proper quoting techniques.

Read More
Populating OneDrive Folder for Local Backup without Affecting Remote Files

Prevent OneDrive from deleting remote files during Windows reinstallation by unlinking the account or using symbolic links to isolate local data.

Read More
Force First Frame as Keyframe Without Re-encoding: A Quick Solution

Resolve inaccurate seeking and playback glitches by re-encoding video to ensure the first frame is a valid keyframe.

Read More
Find Information in Database Using WSL (Ubuntu) on Windows-10

Resolve database connection issues from WSL Ubuntu on Windows 10 by configuring client tools and network access to query remote or local servers.

Read More
Configuring a New Router with Different Networks: One Family, One Guest

Resolve IP conflicts and isolate guest traffic by configuring a second router with a distinct subnet via its WAN port.

Read More
Quickly Open Multiple Stock Websites with a Single Command

Solve the problem of manually opening multiple stock research websites by creating a single command to launch them simultaneously on Windows, macOS, or Linux.

Read More
Improved Adobe Acrobat Search Experience: Access Advanced Search with Ease

Access advanced search filters like case sensitivity and regex in Adobe Acrobat by clicking More Options in the Find bar.

Read More
Port Forwarding VM via OpenVPN: A Comprehensive Guide

Configure OpenVPN server and iptables to forward specific ports from VPN clients to a virtual machine's internal IP address.

Read More
Understanding Partitions in the 1980s: A Look Back at MS-DOS and Master Boot Record

Explains how the Master Boot Record and partition table enabled MS-DOS to manage multiple disk volumes on a single physical drive.

Read More
Windows 10 Enterprise: Keyboard Not Detected in Managed Organization with Admin Privileges

Resolve Windows 10 Enterprise keyboard detection failures caused by Group Policy restrictions, driver corruption, or USB enumeration errors.

Read More
Can't Find x86_64 Versions of Applications on MacOS arm64 (M1)

Resolve missing x86_64 app issues on M1 Macs by installing Rosetta 2 and reinstalling apps as universal binaries.

Read More
How to Hide Installation Source for an Android App

Manage Android app installation source visibility by using USB transfers or file managers to reduce browser traces and isolate data via work profiles.

Read More
Connecting Momentus 4200.2 ST9808210A Hard Drive via USB Cable

Resolve inability to access Seagate Momentus 4200.2 ST9808210A hard drive by connecting it via USB using a compatible SATA-to-USB adapter and configuring the disk in Windows.

Read More