Closed gene1wood closed 10 years ago
This feeds into a deeper architectural question about how we want to manage the read/write split in the code. IIRC the persona codebase gets around this by basically running two copies of the app, sending read requests to one copy and write requests to another. @chilts may be able to offer some options based on the connection-pool work he's been doing.
It'd be easy enough to set up a read pool and a write pool using the different configs. Presumably we then choose which pool we want to get a connection from for each API call.
e.g. db.createAccount()
would be the write pool, but db.accountDevices()
could be the read pool.
However, if there are other (read security) reasons to run two separate apps, then yeah, we'd have to think about it a bit more than this. :)
@chilts I was thinking of this thing you showed me: https://github.com/felixge/node-mysql#poolcluster But maybe it's overkill for our situation at this time.
@gene1wood feel free to tell me if you want any ENV VAR names changed to make it betterrer. :sailboat:
Currently there is one config for mysql hostname, username, password, etc. which is used to both read and write to the database.
Since we're running on multiple DB servers we will need to different mysql connections, one to the write master, and one to the read load balancer, each with separate config values (hostname, user, pass, etc)