-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 .

Sameh
  • 101

1 Answers1

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.

Carcer
  • 1,067