Report this

What is the reason for this report?

How many uploads can my server handle ?

Posted on July 7, 2015

Hi,

I’m running the 10 dollar a month droplet with fedora linux and nginx. Behind nginx I’m running a Flask REST endpoint with gunicorn (running 4 workers)

I have a web app that uploads approx 5 - 10 mb of images as base64 strings to the flask endpoint.

My question is “How many simultaneous uploads will this end point be able to handle ?”

The app I’ve made is for a humanitarian relief project and I haven’t had chance to do loads of testing (things have been moving quite rapidly). Initially we were planning to only run with approx 10 people but now there is a an issue and we may need to increase the amount of people using the app, possibly to 50. Maybe to 100.

Thanks,

Ben



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

We wouldn’t know as it’s application/platform dependent. You’d need to run a benchmark and find out, ApacheBench (ab) can help you with this.

Heya,

The number of simultaneous uploads your server can handle depends on several factors, such as:

  1. Network Bandwidth: If many users are uploading simultaneously, it could saturate your droplet’s available bandwidth, especially if each user is uploading multiple megabytes of data.

  2. CPU and Memory Usage: Handling uploads, especially decoding and processing base64 strings, can be CPU-intensive. Additionally, large uploads could increase memory usage, especially if your application is buffering the entire image in memory.

  3. Disk I/O: If you’re saving these images to disk, the disk’s I/O capacity can also become a bottleneck.

  4. Gunicorn Workers: With 4 workers, theoretically, you can handle 4 simultaneous requests. However, this doesn’t mean you can only have 4 users, because the process of uploading involves a period where the server is simply receiving data and the worker is essentially waiting. Depending on the real-world scenario, a single worker might be able to handle multiple uploads from different users if these uploads are staggered.

To answer your question:

  • For 10 users: It’s likely that your server will handle this without any issues, especially if the uploads are not all occurring at the exact same second.

  • For 50 users: It starts to depend on how simultaneous these uploads are and the aforementioned factors. If all 50 users try to upload at the exact same moment, you might see some slowdowns or even timeouts. However, if their uploads are staggered even by a few seconds, it might be manageable.

  • For 100 users: This would definitely push the limits of a $10/month droplet, especially if uploads are near-simultaneous. You may see noticeable slowdowns, timeouts, or even out-of-memory issues.

Recommendations:

  1. Upgrade Your Droplet: If you anticipate a sharp increase in users, consider upgrading your droplet temporarily to handle the load. You can scale down later if needed.

  2. Monitoring: Make use of monitoring tools like htop, iotop, and iftop to monitor CPU, disk I/O, and network bandwidth respectively. This will give you insights into potential bottlenecks.

  3. Load Testing: Consider using tools like locust or ab (Apache Benchmark) to simulate multiple users uploading data to your server. This will give you a better understanding of how your server reacts under load.

  4. Optimize Flask & Gunicorn: If not already done, ensure that Flask is running in ‘production’ mode, and consider increasing the number of Gunicorn workers if CPU and memory resources allow.

  5. Content Delivery Network (CDN): If your project grows further, consider using a CDN or a service like Amazon S3 to handle uploads, which can alleviate the load on your server.

  6. Error Handling in Your App: Ensure your web app gracefully handles errors. If the server becomes overloaded and starts returning 5xx errors, the app should ideally retry the upload after waiting for a bit.

Finally, thank you for working on a humanitarian relief project. Such initiatives make a big difference, and I hope your technical setup supports your mission effectively!

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.