java - Splitting MySQL Database into separate databases -


i have requirement mysql database being used in application scaling aggressively. in no state migrate nosql database.

i have figured out following areas can try splitting current database multiple databases:

  1. there tables have static content, i.e. changes barely.
  2. there user tables store user data upon interaction changes drastically.

now, if split database 2 different databases, how handle transaction? how write data access layer, have connections both databases? application uses spring & hibernate end. there calls join user tables , content tables in current schema.

the architecture follows current structure: controller -> service -> dao layer.

so, if willing refactor dao layer communicates database, approach should follow? know hibernate orm willing letting go if there better hibernate.

multiple databases on same server? approach not improve performance on own. ram, fast disks, optimization, partitioning, , correct indexing have far greater payback.

if have multiple databases on 1 server can connect them single connection, , use database names table names in sql. transactions work fine within single connection.

transactions across multiple connections , multiple servers harder. there's feature in mysql called xa transactions handle this. has plenty of overhead, , therefore useful high-value transactions in banking.

in jargon of trade, adding servers called "scale-out." alternative "scale-up," in add more ram, faster direct-access storage, optimization, , other stuff single server more.

there several approaches can take scale-out problem. classic 1 use mysql single-master multiple-load-balanced slave replication. that's path that's taken, can without reinventing lot of wheels. in solution writing single instance. queries data can use multiple read-only load-balanced instances.

http://dev.mysql.com/doc/refman/5.5/en/replication-solutions-scaleout.html

this popular approach have mix of long-running reporting queries , short-running interactive queries. reporting can run on dedicated slave servers.

another approach multiple-master replication using mysql cluster. https://dev.mysql.com/doc/refman/5.5/en/mysql-cluster-replication-multi-master.html

another approach, if have money spend, go supported mysql cluster. oracle, mariadb, , percona have such products on offer.

scale-out big job no matter how approach it. there's documented experience other people have done it. example, https://www.facebook.com/note.php?note_id=23844338919


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -