-
Notifications
You must be signed in to change notification settings - Fork 157
Read replicas connections from Massive #633
Comments
There have not been any efforts in that direction on Massive, or, as far as I'm aware, the lower-level driver chain with pg-promise and node-pg. I'd be thrilled to have the option available though! It sounds like there are two parts: connection configuration needs to include the replicas and the connection process needs to set up the appropriate pools (there's some relevant discussion in #381 you might want to look at, although my proxy experiments didn't wind up going anywhere), and then queries need to be routed appropriately. I think both your ideas sound solid: send Other than that, glad you've liked using Massive thus far :) |
Is there at least a way to have 2 instances of massive running at the same time? One for writes and one for reads? We will manually use the correct one. |
I feel that query routing based on query types would be better suited for pgpool instead of re-implementing it at the application layer. 🤔 Application should not be bothered with such details as to how many replicas there are, where are they, which queries should be sent to them etc. There seem to be plenty of solutions for that already, why re-invent the wheel. 😄 |
@momirov sure, tracking and managing them is on you but it's perfectly possible to spin up as many instances as you like. |
When I try to initialize 2 instances I get a warning:
When I try to use second instance I get an error:
I'm using query file for this query. Init script:
|
oh right, I factored the test initialization into a This could get complicated and I don't have time to really dig in at the moment, but if you'd like to try hacking at it feel free! |
Hi!
Here at Airtm we're very happy to use Massive due to its simplicity and embrace of PostgreSQL full potential.
However we're growing faster and we need to handle more demand on our main DB server. So, for us, it's a time where we can spread horizontally than refactoring business logic.
Has anyone considered adding support for read replicas connections from Massive? I mean, there was a feature request on Sequelize like 6 years ago and it's working just fine. We're very hesitant to add such a heavy dependency on our services and we're willing to contribute code to Massive. This issue report is a heads up on any existing effort to sum up, or if there isn't any, to contribute such feature on Massive.
Reviewing Sequelize contribution on read replicas, their only criteria to choose a master or slave replica is if the involved DML query starts with
SELECT
or not. Another proposal is to send a property in theoptions
object to force use of master replica in any operation, such asfind
,findOne
,count
and others on Massive instance.If you have any thoughts about this please let us know. We'll start to work on some PoC as soon as we find some spare time to try it out.
The text was updated successfully, but these errors were encountered: