"If a worker wants to do his job well, he must first sharpen his tools." - Confucius, "The Analects of Confucius. Lu Linggong"
Front page > Programming > gs-fastcopy: get CPU count for upload workers

gs-fastcopy: get CPU count for upload workers

Published on 2024-08-09
Browse:537

See previous post: Introducing gs-fastcopy

I shipped the enhancement gs-fastcopy-python#10: Inspect processor count for better upload defaults.

Previously, we were defaulting to 8 workers (Google's default). On a system with more than 8 cores, that's leaving a lot idle!

Now, we inspect the available CPU count. We honor os.get_schedaffinity on systems that support it (processors available to this process not just in general) otherwise, we use os.cpu_count().

Benchmarking results: [source sheet]

Bar chart showing time taken to complete upload operation, with and without compressing first

Note how adding workers speeds up the process, but yields diminishing returns. I think that's when the network transfer itself becomes more the bottleneck, but it's likely that tweaking chunk sizes would help too.

Also note the more dramatic effects when using compression (using pigz, parallel gzip). pigz would've picked up on the max workers before, what's new here is including them in the upload as well.

Release Statement This article is reproduced at: https://dev.to/dchaley/gs-fastcopy-get-cpu-count-for-upload-workers-3ke7?1 If there is any infringement, please contact [email protected] to delete it
Latest tutorial More>

Disclaimer: All resources provided are partly from the Internet. If there is any infringement of your copyright or other rights and interests, please explain the detailed reasons and provide proof of copyright or rights and interests and then send it to the email: [email protected] We will handle it for you as soon as possible.

Copyright© 2022 湘ICP备2022001581号-3