Administrators/Optimize performance/Database

From Aimeos documentation

Administrators | Optimize performance
Other languages:
English 100% • ‎русский 100%

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-<domain>" and adapt the host, port, database, username and password settings as necessary, e.g.:

  1. 'db' => array(
  2. 	'adapter' => 'mysql',
  3. 	'host' => '',
  4. 	'database' => 'shop',
  5. 	'username' => 'arcavias',
  6. 	'password' => 'secret',
  7. 	'stmt' => array( "SET NAMES 'utf8'", "SET SESSION sql_mode='ANSI'" ),
  8. 	'limit' => 2,
  9. ),
  10. 'db-order' => array(
  11. 	'adapter' => 'mysql',
  12. 	'host' => '',
  13. 	'database' => 'shop_order',
  14. 	'username' => 'arcavias',
  15. 	'password' => 'secret',
  16. 	'stmt' => array( "SET NAMES 'utf8'", "SET SESSION sql_mode='ANSI'" ),
  17. 	'limit' => 2,
  18. ),

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.

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.

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