I have a question i need some opinions on
I have a linux cloud server now that is hosting a few sites and is a little bogged down memory wise primarily MySQL i am looking to add a node or 2 but realised it doesn’t cost any more to have 2 smaller VPS 1 dedicated to MySQL and one for the web server.
What would be the better solution?
1 big server 4 nodes running all services
2 small servers 2 nodes each with services separated?
This is a general architectural decision that is made by people using all stacks out there. LAMP, MSFT, et al. It really depends on how you define “Better”…
Some people will say you should always separate your web server from your DB server. Sometimes that’s because of political decisions made within an enterprise. You’ll see one team dedicated to web and another DB team, so to keep the bureaucracy running smoothly big orgs separate the software onto different hardware.
It’s not only political though, there are other rational reasons as well that are relevant to a smaller organization — security is one. If your web server gets hacked, which is more likely because it must be exposed to the world to serve its pages, then your DB server can remain unscathed — hidden safely behind a private IP or firewall. Your system is also more scalable when separated, because you can grow both servers independently.
The downsides of separating the software onto two boxes include the need to patch and maintain two separate machines, either virtual or hard. There is also a performance hit due to sending requests from the web server outside over the network to another machine. So while more scalable, it won’t necessarily make your website faster to separate the db and web services onto two separate machines.
Of course, that depends on your programming. Do you use indexes properly? How much of the processing is done in stored procedures vs. procedural PHP, .NET, etc? If 75% of your website’s work is done by the database server and you split it off into 50% of the total available horsepower, then your site will slow down when compared to having both systems on the same machine — and that’s without considering the network latency.
So really, to provide a reasoned opinion, I would need to know more about your priorities. Do you want the fastest page loads? Highest security? Least maintenance time/cost? Flexibility? Scalability? Cost?
If I can assume you want your site to be faster, then I would guess, and that’s about all it is with what I know now — a guess, that your site will be faster with one big box, because you can dedicate more ram to the database. If your web server only needs 10% of what is available and you give it a whole machine which is 50% of your total, then 40% is unused and could be used by MySQL to run queries.
So, if your web server only needs one node and you give it two, one is unused when you could put three to mysql if both web and db were running on the same 4 node server.
Anyway, hope this helps! Good luck!