By jk8db1e0d
Hello,
I have an app that has an API it calls. The API get’s called multiple times a second from the app’s users. One aspect of the API calls is the recording if usage statistics.
Currently I have all of this managed on a dedicated server at a local hosting company. I have however noticed that the CPU-loads tend to get pretty high on peak usage times.
I am wanting to upgrade to a more professional solution. From what I have researched it would be wise to create multiple droplets.
In the future I can clone the web server droplet to handle its load demands. I assume I can then use the Digital Ocean’s load balancer to mediate between the droplets.
But what about the mySQL database droplet? I can’t clone the database to balance it’s load - I would have duplicate data. How do I best go about dealing with it’s load? Same question is regarding the size. At the current rate the database grows approx. 5 GB a month. The more users come the faster it will grow. Is my only solution to expand the droplet’s disk space, or can I then split the database across multiple droplets? The usage statistics database itself constists of mainly 3 very large tables. I am sure I could split each table on a separate server, but that should make JOIN statements difficult.
I realize that some of these questions are very future-oriented, but if I am already setting everything up new, I want to setup up every thing so that it is less work when things need to expand. I am trying to prevent time-costly caveats unknowningly.
Thanks
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!
Thank you very much - this was very helpful.
One more question - what droplet sizes would you suggest? Up until now I have put everything on one larger server, so I have no idea what requirements the two instances would need.
Currently have 15 requests / sec. which peaks around 40 req. / sec. And the database is currently at 15 GB with approx. 105 mil. records (InnoDB).
Is something like: a 2GB, 1 vCPU enough for the web server instance and a 3GB, 1 vCPU (later with block storage attached) enough for the database instance?
Which is more RAM hungry? Database or web server?
Thanks
Heya,
I believe this is what you were looking for https://mariadb.com/blog-tags/load-balancing https://mariadb.com/kb/en/library/documentation/replication/high-availability-performance-tuning-mariadb-replication/setting-up-replication/ tho i may be wrong as i’ve no real experience with databases.
Hi @jk8db1e0d
For the database storage you can attach a block storage device to your droplets and mount it where your database stores its data that is usually /var/lib/mysql.
For scaling your database workload you can use percona XtraDB Cluster which allows you to run three droplets or more and distribute the workload on all three of them also it can scale very well in the future.
I hope this helps you, please reply if you still have any questions.
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.