However, there are several disadvantages with this
method. A conceptual drawback of this method is that
handling database selection in the application side
(or tier) blurs the separation between application and
database. Read-write splitting with MySQLnd
MS
is naive as it assumes all queries starting with
SELECT as read statements, but there could be
write statements starting with SELECT. Master
failover is not instantaneous as it takes some time
(which might be several minutes) to determine
if the master is failed before promoting a slave
to master, and this causes database unavailability
for that time. Since all the web servers (PHP
servers) needs to be configured for MySQLnd
MS
plugin, this could be annoying when one need to
change environment, for example when adding a
new slave. A possible solution to minimize the
changes that need to be done on the PHP-MySQLnd
configuration file is to use a proxy server such as
HAProxy between PHP driver and database together
with PHP-MySQLnd (Severalnines, 2016). Proxy
server provides a single point database access to
the application. Since HAProxy is not SQL-aware,
MySQLnd
MS is required to understand the type of
SQL statement.
A better approach is to use a SQL-aware proxy
server such as MaxScale, which not only provides a
single point access to the application but it also fully
decouples application and database processes. The
proxy server redirects a SQL query to an appropriate
database server/node. The method is applicable for
both master-slave and cluster-based database setups.
MaxScale, which is considered a next generation
database proxy, is an open source project developed
by MariaDB. It can load balance both connectionsand
individual database requests, filter requests according
to a set of defined rules, and monitor availability,
utilization, and load on back-end servers to prevent
requests from going to overburdened and unavailable
resources (Trudeau, 2015; MaxScale, 2016). We
use database proxy method using MaxScale in our
implementation.
3 EXPERIMENTAL SETUP
Experiments are performed in a single machine
OpenStack cloud setup using DevStack. DevStack
is installed in a VMware virtual machine (VM) on
a MacBook Pro machine. VMware was chosen as
it supports nested virtualization. The specification of
the computer and the VM used is given below.
Specification of the computer:
• CPU: Intel(R) Core i7 3.1GHz processor
• Memory: 16GB
• OS: MacOS Sierra
Specification of the VMware VM:
• CPU: 2 processor cores
• Memory: 9GB
• Hard disk: 50GB
• Network: two Network Interface Cards (NICs),
one with NAT to get access to the Internet via host
machine and one with vmnet2 which is used as a
public network interface for accessing VMs from
outside
• Advanced options: VT-x/EPT and code profiling
enabled
• OS: Ubuntu 16.04 LTS (Xenial Xerus)
Eight servers were provisioned in the OpenStack
cloud for a widely used LAMP stack (Linux, Apache,
MySQL, PHP) based cloud service (Infrastructure as
a Service-IaaS) architecture for a high availability
dynamic database-driven web application, which
consists of two Apache2 web servers that are load
balanced with two HAProxy 1.6 load balancers, three
MariaDB database servers, and a MariaDB MaxScale
server, all running Ubuntu 16.04 (Xenial Xerus) from
the cloud image available on the web (Ubuntu, 2016).
Figure 3 depicts the cloud system setup. All the
three database servers are installed with MariaDB
server v10.1, which comes with built-in Galera cluster
support. MaxScale v2.1 server is installed and used as
a database proxy server in both the master-slave and
Galera cluster setups.
In the master-slave database replication setup,
one server is used as the master and the other
two servers are used as slaves. Global transaction
id (GTID) based replication is used as it has
many benefits compared to the traditional bin-log
based replication (Combaudon, 2013). Automatic
master failover mechanism is implemented with
MariaDB replication manager (MRM). In the Galera
cluster-based setup, MariaDB 10.1 installed in the
three database servers are configured to use Galera
cluster. The three servers then act as three nodes of a
cluster. If there is any change in one node, the changes
will be updated in the other two nodes synchronously.
Synchronization method is set to use rsync. In both
setups, slaves are load balanced with equal server
weights.