This project was done during Nov 2016 ~ Feb 2017, it is a fault tolerant load balancing database. Built with 4 AWS EC2 virtual machine instances.
-
Developed an elastic distributed database using MySQL replication and used it to serve as the backend for a multi-tier web application running TPC-W benchmark (AWS EC2, MySQL(replication), multi-tier web application)
-
Developed a load balancer to route the browsing queries to master and route the ordering queries to slaves in a round-robin manner (Maven, multi-thread, high availability & dynamic scalability distributed database)
-
Guarantee the high availability (HA) of the database in real-time using backup slave
-
Scale out/in the database server according to real-time workload and network delay
Among 4 AWS EC2 instances, 1 serves as master server, 2 serve as slave server, 1 serve as candidate server.
-
My own laptop serves as client emulator, load balancer, controller, executor with multi-thread technique.
-
Client emulator create 10 ~ 60 user session threads and sending read and write queries to load balancer.
-
Load balancer gets request from client emulator and redirect this query to one of slaves in a round robin manner. If availability can not be satisfied, it will put a SCALE OUT message into event queue(later executed by executor).
-
Controller is enabled every passing minute, and it calculates average network access latency(within this minute), if availability can not be satisfied, a SCALE OUT message will be put into event queue. If availability performance is beyond good(lantency less than 50ms), a SCALE IN message will be put into event queue.
-
Executor executes events in the event queue(SCALE OUT message has higher priority).
-
Master is the only server responses to clients' write query.
-
Implemented with MySQL replication, slaves listen to the master by pulling master's binary log when master's database get updated(write queries or update queries from clients).