question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Build: improve `upload` step

See original GitHub issue

We are using Django storages to delete/upload/sync the files from the builders into S3. This is good because it uses the same Django storages’ API, without matter what’s the backend behind the scenes.

However, S3/the API does not support “in bulk” uploads/deletion. So, there a lot of API requests have to be done to delete/upload a full directory. The code that does this is at https://github.com/readthedocs/readthedocs.org/blob/0a9afda92e38331d21f6915909818be0f7e74e17/readthedocs/builds/storage.py#L48-L136

This amount of API requests make the upload process slow. In particular, when there are many files. We talked about improving this by using something like rclone (https://rclone.org/) or similar. There is a django-rclone-storage (https://pypi.org/project/django-rclone-storage/) where we can get some inspiration for this.

Slightly related to: https://github.com/readthedocs/readthedocs.org/issues/9179

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:23 (23 by maintainers)

github_iconTop GitHub Comments

2reactions
humitoscommented, Dec 13, 2022

Noting here that we should take into account the symlink issue that we found in the last weeks when swapping the backend. In #9800 all the logic was moved into safe_open (used for opening user’s configuration files and also when uploading the files to the storage) which will help on this. We will need to use the same logic [^1] immediately before uploading the files with rclone

[^1]: check the symlink target is inside DOCROOT (or more specifically, the project’s path if possible)

2reactions
agjohnsoncommented, Nov 30, 2022

There is a django-rclone-storage

I also assumed we were talking about this solution as the first to try.

I’m rather hesitant to fiddle with threading in our own application implementation, or really trying to get too technically correct here. We don’t have many projects being negatively affected by this issue, so our solution should match the severity.

A drop in replacement is a great option. Even if it’s only twice as fast, that’s good value for little effort.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why is My Upload Speed Slow? How to Increase ... - Guru99
Step 2) Click on the Network option in the pop-up Resource Monitor window. Then check the Total (B/sec) parameter. Step 3) Right-click on...
Read more >
Easy steps you can take to increase your upload speed
Check your download and upload speed with our broadband speed checker, then follow our tips for increasing your upload speed.
Read more >
How to Increase Internet Upload Speed
If your upload speed isn't where you want it to be, there are steps you can take to increase throughput and get the...
Read more >
How to optimize upload speed? - Hightail - Zendesk
How do I optimize my upload speeds? The upload speed that you have when uploading files to a Space or sending files through...
Read more >
Best practices for speeding up builds - Google Cloud
On this page · Building leaner containers · Using Kaniko cache · Using a cached Docker image · Caching directories with Google Cloud...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found