Administrators/Optimize performance/Database

Several databases
Since version 2014.07 the Arcavias Core is able to use one database for each domain. This enables really big setups as the load can be distributed to up to 16 databases and is not limited by the hardware of the single database server!

The available domains are:


 * cache
 * attribute
 * catalog
 * coupon
 * customer
 * job
 * locale
 * log
 * media
 * order
 * plugin
 * price
 * product
 * service
 * supplier
 * text

By default, all these domains use the default database defined in the resource.php in the "./config" directory of the Arcavias Core. To add a second database server for one domain, duplicate the configuration of the "db" section, change the key to "db- " and adapt the host, port, database, username and password settings as necessary, e.g.:

'db' => array( 	'adapter' => 'mysql', 	'host' => '192.168.0.1', 	'database' => 'shop', 	'username' => 'arcavias', 	'password' => 'secret', 	'stmt' => array( "SET NAMES 'utf8'", "SET SESSION sql_mode='ANSI'" ), 	'limit' => 2, ), 'db-order' => array( 	'adapter' => 'mysql', 	'host' => '192.168.0.2', 	'database' => 'shop_order', 	'username' => 'arcavias', 	'password' => 'secret', 	'stmt' => array( "SET NAMES 'utf8'", "SET SESSION sql_mode='ANSI'" ), 	'limit' => 2, ),

All order related operations will then be sent to the second database server while all other operations will still happen by using the first database. You can easily add more databases for different domains.

Note: The log, customer and order domain are normally perfect choices for moving to a different database as these domains usually involve a lot of write operations. The other domains are updated rather seldom or only when product updates occur and the cache database is better offloaded to a Redis server.

Use read-only replicas
If your setup has to handle extremely high traffic and despite of using a database per domain and a cluster of Redis servers for caching, your database still needs to cope with more (read) requests than a single server can answer, using MySQL replication is the solution. You can setup several read-only slave MySQL servers that receive changes from the master while the slave servers only answer the read requests from the web servers.

For this kind of setup you need some web servers that are identically configured besides the configuration for the databases. A database slave is asked by a group of web servers for the required data while other groups of web servers will ask other database slaves.

Caution: It's important that in this setup all content changes in the shop are done on the MySQL master and then propagated to the slaves automatically! This doesn't work with the following domains as the shop needs to save or update data there on behalf of the users:


 * cache
 * coupon
 * customer
 * log
 * order