wget-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

wget | Increase receive buffer size to reduce CPU usage (!33)


From: @rockdaboot
Subject: wget | Increase receive buffer size to reduce CPU usage (!33)
Date: Sun, 12 Feb 2023 17:47:32 +0000


Tim Rühsen created a merge request: 
https://gitlab.com/gnuwget/wget/-/merge_requests/33

Branches: rockdaboot/dynamic-buf-size to master
Author:   Tim Rühsen




The buffer size was a 8kB, while we can get up to 64kB per IP packet.
Increasing the receive buffer size to 64kB reduces the number of reads up to 8x.

In practice, downloading an Ubuntu .iso file now takes much less CPU (user and 
system). Also the wall time decreased significantly.

**Stock Debian Wget 1.21.3**
```
time wget 
'https://releases.ubuntu.com/22.04.1/ubuntu-22.04.1-desktop-amd64.iso' -O 
/dev/null
real    2m1,303s
user    0m6,937s
sys     0m14,506s
```

**Wget 1.21.3 + this PR, CFLAGS=-O2**
```
$ time src/wget 
'https://releases.ubuntu.com/22.04.1/ubuntu-22.04.1-desktop-amd64.iso' -O 
/dev/null
real    1m18,779s
user    0m2,958s
sys     0m2,514s
```

**curl 7.87.0 (OpenSSL/3.0.7, Debian)**
```
$ time curl 
'https://releases.ubuntu.com/22.04.1/ubuntu-22.04.1-desktop-amd64.iso' -O 
/dev/null
real    1m18,988s
user    0m3,583s
sys     0m7,805s
```

**Conclusion**
Wget 1.21.3 behaves exceptionally worse than this MR and curl. It stayed ~30% 
below the possible network speed (400 Mbit/s).

Curl and this MR both use the full available bandwidth, so the wall time is the 
same.
But this MR's CPU usage is 52% less than the CPU usage of curl !

This MR replaces !32.

-- 
Reply to this email directly or view it on GitLab: 
https://gitlab.com/gnuwget/wget/-/merge_requests/33
You're receiving this email because of your account on gitlab.com.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]