To avoid exceeding our database’s
# spicedb
g
To avoid exceeding our database’s connection limit (RDS Postgres with 1.6K max connections), we apply this pattern at the moment -> replicas (number of SpiceDB pods) × (readMaxOpen + writeMaxOpen) ≤ db.max_connections – headroom. When having a RDS proxy in front of the database, do you have any suggestions on how to configure properly the readMaxOpen and writeMaxOpen connections on SpiceDB level? Should the logic remain the same? Thanks in advance.
y
that being something like pgbouncer?
g
Yes exactly @yetitwo
y
i think i'd default to it remaining the same
though i guess i don't know enough about how those kinds of load balancers work
if it would just be moving the connection contention issue around, it probably isn't helpful
if it's doing some sort of multiplexing such that it gets around connection contention, it could be fine to let that value float a bit
g
Thanks @yetitwo indeed its applying a sort of multiplexing in the background. As I've tried to explain above currently we do share our connections in a logical way between the SpiceDB Read (datastoreConnPoolReadMaxOpen) and Write pools (datastoreConnPoolWriteMaxOpen). Our main problem is that we do have to switch the connection numbers between Read/Write sporadically (in most of the time we need more Read connections but there are some situations where we're replicating permissions where the Write connections are also important). We are just hoping that the proxy will help us a bit with the management of the SpiceDB connection handling.
y
yeah, makes sense. i'd say the next thing to try would be to give yourself enough connections such that your workload isn't saturating the connections (so whatever the max that you've configured for each of read and write is) and then test it and see how it behaves.
we don't run pgbouncer in our own infra so we don't have a ton of experience with it