N
Neon12mo ago
stormy-gold

Read replica/primary limits

- Based on this image, it looks like replica using same compute (resources) with primary. So for eaxample on Scale plan it still will be in sum maximum 8CU (for example 4CU primary + 4CU read replica or 6CU primary 2CU read replica, so it can be 8CU for primary and 8CU for read replica) right? - Max connection on 8CU will be 3604 in sum (primary + all read replicas) right? - Is there any replica lag? thank you
No description
19 Replies
stormy-gold
stormy-goldOP11mo ago
🤔
stormy-gold
stormy-gold11mo ago
No, they don't share compute resources. A replica is a separate postgres service (compute) which can autoscale independently from the primary. max connections will primary + replicas cpu max connections. this is dependent on the CPU choice for each.
stormy-gold
stormy-goldOP11mo ago
so on Scale plan primary can scale up to 8CU and each replica can scale up to 8CU?
stormy-gold
stormy-gold11mo ago
yes I believe it's max 10 replicas The can be replica lag, these aren't sync replicas. So a long running query on a replica will cause it to lag with the primary. You can always spin up a new replica instantly to work around this.
stormy-gold
stormy-goldOP11mo ago
so primary 8CU + replica 8CU will be up to 3604+3604 max connections?
stormy-gold
stormy-gold11mo ago
yes
stormy-gold
stormy-goldOP11mo ago
nice
stormy-gold
stormy-gold11mo ago
that is max w/o connection pooling - direct to database connections
stormy-gold
stormy-goldOP11mo ago
about replicas i mean when i write into primary what is avg lag when change is available in replica
stormy-gold
stormy-gold11mo ago
hmm, hard to give an avg lag number. very dependent on the work the replica is doing. with very little load avg would be very low
stormy-gold
stormy-goldOP11mo ago
understand, is there any chart or number on dashboard how long it taking this sync between? and last question - when i have for example 1000 projects (tenants) i need for each project separated resources (CU) or its shared between? i hope its shared between projects 😬
ambitious-aqua
ambitious-aqua11mo ago
Each project has its own resources
stormy-gold
stormy-gold11mo ago
In the monitoring (and exported metrics) you'll see the delay in bytes and delay in seconds for your replica
No description
stormy-gold
stormy-goldOP11mo ago
if each project has its own resources it will be "quite" expensive if there will be 100+ tenants 🤔 how much cost 1CU per hour? $0.16?
stormy-gold
stormy-gold11mo ago
the CPU will autoscale and scale to zero when inactive if you're not billing tenants on a metered basis you could run it all in a single database with multiple postgres databases using a databse (project) per tenant gives you insights into what customers are using. but if you're billing in a different way you could centralize this into a single database (project). but again, with autoscale and scale to zero you're not paying for inactive or low activity tenants, certainly some overhead there but very little and less complexity if one of your tenants takes off in usage.
stormy-gold
stormy-goldOP11mo ago
I probably dont understand what you mean by “you could run it all in a single database with multiple postgres databases” If 1CU costs $0.16, we can calculate something like 0.5CUx4hours per day = 0.08x4x30 per month = $9.60 per tenant per month, that seems a little steep for just one tenant
like-gold
like-gold11mo ago
I think what Bryan is trying to say is that in a single Neon project, you can create a database per tenant via create database tenant_x. Does this clarify?
No description
ambitious-aqua
ambitious-aqua11mo ago
Note that for the above approach there's a maximum of 500 databases ^,
stormy-gold
stormy-goldOP11mo ago
I see, free accouts can be on shared resource and paid on separated each one sounds like good idea to me, now im trying to understand pricing, so what is price for 0.25CU per hour please? Im trying to calculate avg price for db for paying tenants

Did you find this page helpful?