Question

I'm a newb looking for guidance on properly setting up my droplet to get the best performance

Posted January 28, 2021 324 views
DigitalOcean Droplets

I have a droplet sized at 2 vCPUs & 4GB / 25GB Disk ($40/month). The droplet houses my Hasura postgres DB.

I have a mobile app that users can create beer league type schedules that relies heavily on websocket technology for instant updating as several users at a time across several different screens (think 40-80 people interacting per schedule) where these players will all be viewing schedules concurrently and need to be notified instantly of updates (scores/standings/in progress matches).

During the highest traffic nights I have anywhere from 5-10 leagues running at a time and loading the schedule takes 3-7 seconds (feels like an eternity) since the traffic is spiked during these times.

How can I keep things running smooth and loading quickly when I hit these traffic spikes? I just upgraded that droplet to the current plan and it’s definitely helped, but it doesn’t feel like enough. Do I need to upgrade my droplet again? I purchased the basic load balancer for the droplet, but I have no idea what I’m doing and don’t even know if that’s the purpose of the load balancer.

If I have a load balancer set up, do I need multiple droplets for it to be effective? If I have multiple dropelts, how do I set them up to all hit the same database at the same time?

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.

×
Submit an Answer
2 answers

Research the DigitalOcean autoscaling options. Autoscale works buy having a preconfigured web server template that fires up additional servers based on a metric like CPU utilization. When your web server hits that threshold another server will be booted up and share the load. Of course, the web servers need to share a common database so your database needs to be centralized on its own droplet or container (Kubernetes) and you will need a load balancer to share the load across the web servers.

Based on these factors, you can expect the cost of your Digital Ocean services to increase but it’s probably not as expensive as you might think. Only the database needs a decent size droplet in your case. The web servers can be the $5 droplets. I don’t know how DigitalOcean handles load balancers but you could use another $5 droplet to handle that to if they are too expensive.

  • So I’ve created 2 new $5 droplets and placed them in the load balancer. I now have my main droplet that stores the database and the 2 smaller ones behind the load balancer. Is that all I have to do? Should I have created a snapshot of the main droplet and then duplicated it onto the smaller droplets first?

    Also after I added the 2 new droplets to the load balancer, the health of my main droplet has steadily decreased. Is that normal?

Hi there. The first thing I said in my reply was research DigitalOcean autoscaling options, I did not intend the reply to be anything more than a little guidance.

There will probably be some documentation on the DO site somewhere to help you configure this, but it is not as simple as adding droplets to a load balancer. Front end servers will need to be configured, the load balancer will need to be configured and your back-end may need some configuration.

As a safeguard, always backup your app and database before making any significant changes and create a rollback plan to put things back how they were before you started.

Don’t drop any more cash into your setup until you understand everything that needs to happen, otherwise you may get caught by some surprises or face technical challenges that if you cannot overcome yourself, will require paid assistance.

I would advise you to lab it up on your personal computer before you try it on the DigitalOcean platform.

Good luck.