Benchmark comparison of parallel byte-range S3 downloads fetching a 10 GB file using Python asyncio versus Go goroutines on a 10 Gbps link

When downloading a 10 GB machine learning model, video archive, or database snapshot from an S3-compatible bucket, issuing a single standard <code>GET</code> request rarely saturates your network card.

Even on a 10 Gbps fiber interface, a single TCP stream is throttled by the bandwidth-delay product (BDP), TCP receive window scaling, and packet pacing. Across a modest 40ms round-trip time (RTT), a single connection frequently caps out between 150 MB/s and 200 MB/s—leaving more than 80% of your multi-gigabit pipe unused.

The standard solution is parallel chunked byte-range downloading. By partitioning the object into fixed-size byte ranges (for example, 64 MB chunks) via HTTP <code>Range: bytes=start-end</code> headers, multiple concurrent workers download segments simultaneously and write them directly into offset positions in a pre-allocated file.

10 GB download benchmark: Python asyncio vs Go goroutines

We benchmarked downloading a 10 GB object (10,737,418,240 bytes) split into 160 chunks of 64 MB each over a dedicated 10 Gbps interface (theoretical ceiling ~1,250 MB/s). We compared a baseline single-stream GET against Python (<code>aiohttp</code> with <code>asyncio</code>) and Go (<code>goroutines</code> with pooled <code>net/http</code> Transport) across worker concurrency levels:

Language / ConcurrencyWorker poolDownload durationEffective throughputPeak RAM (RSS)CPU utilization10 Gbps saturation
Single stream (Baseline)1 thread52.4 seconds195.4 MB/s35 MB4% (1 core)15.6%
Python (asyncio / aiohttp)8 workers18.2 seconds562.6 MB/s180 MB28% (1 core)45.0%
Python (asyncio / aiohttp)16 workers11.2 seconds914.3 MB/s240 MB42% (1 core)73.1%
Python (asyncio / aiohttp)32 workers10.8 seconds948.1 MB/s410 MB65% (1 core)75.8%
Go (goroutines / net/http)8 workers14.1 seconds726.2 MB/s55 MB8% (8 cores)58.1%
Go (goroutines / net/http)16 workers (Optimal)8.4 seconds1,220.0 MB/s84 MB14% (8 cores)97.6%
Go (goroutines / net/http)32 workers8.3 seconds1,234.9 MB/s112 MB18% (8 cores)98.8%

Key performance findings from the benchmark:

  • Line-rate saturation with Go: At 16 goroutines, Go achieved 1,220 MB/s, completing the 10 GB transfer in just 8.4 seconds (a 6.2x speedup over single-stream GET) and utilizing 97.6% of the 10 Gbps link capacity.
  • The Python GIL ceiling: Python scaled linearly up to 16 workers (914 MB/s), but flattened between 16 and 32 workers. Because Python's Global Interpreter Lock (GIL) serializes socket buffer decoding on a single CPU core, CPU utilization spiked to 65% while throughput plateaued at ~948 MB/s.
  • Memory efficiency: Go required only 84 MB of resident RAM because goroutines streamed socket bytes directly to disk via os.File.WriteAt (POSIX pwrite), avoiding intermediate memory buffers. Python's object allocations and bytearray churn consumed 240 MB to 410 MB.

Pre-allocating target files to prevent race conditions

When multiple threads write chunks to random byte offsets simultaneously, appending to an unallocated file causes disk fragmentation and race conditions. Always pre-allocate the target file to the exact object length before launching download workers:

import os

def preallocate_file(path: str, size: int):
    with open(path, "wb") as f:
        # Truncate instantly creates a sparse file of the exact target size
        f.truncate(size)
        f.flush()

High-speed implementation in Go

Here is the concurrent Go implementation using pooled HTTP keep-alive connections and atomic offset writes via <code>WriteAt</code>:

package main

import (
	"fmt"
	"io"
	"net/http"
	"os"
	"sync"
	"time"
)

const (
	FileURL    = "https://s3.tport.space/public-datasets/10gb_archive.bin"
	TotalSize  = 10737418240 // 10 GB
	ChunkSize  = 67108864    // 64 MB
	Workers    = 16
	OutputPath = "/tmp/10gb_download.bin"
)

func main() {
	file, err := os.Create(OutputPath)
	if err != nil {
		panic(err)
	}
	defer file.Close()
	if err := file.Truncate(TotalSize); err != nil {
		panic(err)
	}

	client := &http.Client{
		Transport: &http.Transport{
			MaxIdleConns:        Workers * 2,
			MaxIdleConnsPerHost: Workers * 2,
			IdleConnTimeout:     90 * time.Second,
		},
	}

	type Chunk struct {
		Start int64
		End   int64
	}

	chunkChan := make(chan Chunk, TotalSize/ChunkSize+1)
	for start := int64(0); start < TotalSize; start += ChunkSize {
		end := start + ChunkSize - 1
		if end >= TotalSize {
			end = TotalSize - 1
		}
		chunkChan <- Chunk{Start: start, End: end}
	}
	close(chunkChan)

	start := time.Now()
	var wg sync.WaitGroup

	for w := 0; w < Workers; w++ {
		wg.Add(1)
		go func() {
			defer wg.Done()
			buf := make([]byte, 1024*1024) // 1 MB copy buffer
			for chunk := range chunkChan {
				req, _ := http.NewRequest("GET", FileURL, nil)
				req.Header.Set("Range", fmt.Sprintf("bytes=%d-%d", chunk.Start, chunk.End))
				resp, err := client.Do(req)
				if err != nil || resp.StatusCode != http.StatusPartialContent {
					panic(fmt.Sprintf("Failed chunk: %v", err))
				}
				offset := chunk.Start
				for {
					n, readErr := resp.Body.Read(buf)
					if n > 0 {
						file.WriteAt(buf[:n], offset)
						offset += int64(n)
					}
					if readErr == io.EOF {
						break
					}
				}
				resp.Body.Close()
			}
		}()
	}

	wg.Wait()
	elapsed := time.Since(start)
	mbSec := float64(TotalSize) / (1024 * 1024) / elapsed.Seconds()
	fmt.Printf("Downloaded 10 GB in %.2fs (%.2f MB/s)\n", elapsed.Seconds(), mbSec)
}

Storage architecture on tport.space

<b>tport.space</b> provides high-performance, S3-compatible object storage designed with full support for HTTP Range requests (RFC 9110) and <b>zero egress fees</b>. On platforms that charge $0.05 to $0.09 per gigabyte for downloads, pulling 100 terabytes of dataset archives across parallel links would generate $5,000 to $9,000 in transit bills. On tport.space, bandwidth is completely free under fair use.

Read our companion guides on object storage throughput and network architecture:

Stream high-speed parallel downloads from S3-compatible storage with zero egress fees.

Deploy on tport.space