-2

Okay I have a VPS (DO 512 MB) and AWS RDS free tier . I wanna get the maximum performance , please help me cause I'm a little confused . I run a nginx server on the VPS and it can handle 1K traffic/Sec without much panic . My problem is do I host the MySQL on the VPS or on AWS ? You migh say benchmark it , right !? I did , and here's the results (i have a pretty small database 500 Row , 15 columns ) i tested query executing time from my local location connecting to both of the servers . i ran a big query to test them 4 times to be 100% sure of results ,both servers are optimized using the same parameters .

AWS -RDS - MYSQL

  • 1st time :2.97
  • 2nd time :2.88
  • 3rd time :1.61 4th
  • 4rd time :3.19

VPS - MYSQL

  • 1st time :1.88
  • 2nd time :1.81
  • 3rd time :2.14
  • 4th time :1.88

i get even faster VPS results executing queries Locally( on the VPS). and i got php+mysql test with Loader.io and here's the results too . VPS loader.io TEST AWS loader.io TEST Even though the VPS mysql is faster in all ways but it uses a lot of system resources (5.7% MEM X 6 Process) . is the speed difference worth the resources eaten from the VPS? any recommendation .

0

1 Answer 1

1

If your system has the capacity to host the database, it will always be faster to run it locally than involve the network. It does not seem like your VPS is overloaded in this case, so you should stick to running your DB on the VPS, as your testing clearly indicates it is faster.

It is common for systems which are distributed to replicate their databases on each server to improve performance locally. For instance, one of the sites I administrate is load-balanced over three servers, and each of them is running a copy of the database as part of a replica set; all the writes are sent to the master, but all reads are done from the server's local replica, to avoid network overhead and latency.

5
  • I agree with this. RDS will be more reliable, with automatic backups and patching, but running a local server will be faster. I don't know what a "DO 512MB VPS" is - if it's outside AWS the additional latency will kill performance.
    – Tim
    Jan 10, 2016 at 2:14
  • I expect in this context the DO means DigitalOcean.
    – Carcer
    Jan 10, 2016 at 2:21
  • Makes sense. Using a remote database is going to be fairly slow because of latency, so local is better unless data integrity is more important than performance.
    – Tim
    Jan 10, 2016 at 2:23
  • I totally agree with you @tim performance is more important , and yes its digital ocean I like the replica idea I'm using it . When doing the write and the master is sending it to the slave does it affect the read time of the slave ? , and thank you a lot .
    – Sameh
    Jan 10, 2016 at 5:53
  • MySQL replicas aren't entirely trivial to set up. Once you write to the master the slave will be updated at some point, but I don't think there are any guarantees how quickly - maybe in 1ms, maybe in 1h if something goes wrong.
    – Tim
    Jan 10, 2016 at 5:58

Not the answer you're looking for? Browse other questions tagged .