Currently, I am hosting a backend for my mobile app and website with one droplet running nodejs and mongodb. The service lets the user upload and view pictures (around 2-300 kb). These images are stored with GridFS. Right now we don’t have that many users because we haven’t launched it yet (test phase). However, everything is working just fine right now.
In the near future, we are expecting a lot more users - about 2 000 users uploading and viewing photos during one day. One uploaded photo will remain in my server for about a month.
I don’t expect any really detailed answers here, but I was hoping someone could point me in the right direction in terms of how I should be organizing this service. What are the best tools suited for the job?
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!
<blockquote>1. Is it stupid to store these photos in the droplets? Should we consider using a third party service for that purpose? Is the current setup sustainable?</blockquote>You’re eventually going to run out of space, however, since you have GridFS set up, you can just add more droplets. It might get expensive later on since droplets don’t have a lot of space so you might want to look into caching the most recently accessed files on a droplet while hosting everything on Amazon S3 or a similar service. <br><blockquote>2. What would be the best way to organize the application server with nodejs and the database (mongodb). Should the database be stored on a dedicated droplet, and is it okay to have it on the same droplet?</blockquote>A MongoDB cluster should help so that if one server fails and goes down, another server becomes the primary and kicks off. You can start off with two droplets and an arbiter hosted on your app server. I recommend reading all about replication before setting it up: <a href=“http://docs.mongodb.org/manual/replication/”>http://docs.mongodb.org/manual/replication/</a>. <br><blockquote>3. What is the smartest way to ensure a fault-tolerant and load-balanced service with this setup?</blockquote>You can load balance your nodejs by running it on two or more app servers and load balancing between them using HAProxy: <a href=“https://www.digitalocean.com/community/articles/how-to-use-haproxy-to-set-up-http-load-balancing-on-an-ubuntu-vps”>https://www.digitalocean.com/community/articles/how-to-use-haproxy-to-set-up-http-load-balancing-on-an-ubuntu-vps</a>. <br>As for MongoDB, I answered that in #2. <br> <br>I hope that helps! :]
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.