Skip to content

Connection pooling vs read replicas for a 50k-member forum

We used to raise max_connections whenever p99 login latency spiked. After about 4_000 concurrent sessions that stopped working — the wait moved to row locks on topic_subscriptions.

What we measured

  1. sqlx pool wait (target under 8ms).
  2. PostgreSQL wait_event for Lock vs IO.
  3. Valkey session GET p99, which stayed flat.

Feed SELECTs now hit a replica. Votes still go to primary. If you have run a forum past 50k DAU, how did you split read-your-writes from the home feed?

5 replies

We hit the same wall on connection. Replica lag was the surprise, not CPU.

Permalink

Staff view: please do not delete the thread if this is a duplicate. Link the canonical Issue instead.

Permalink

For campus we used entity_type=course and left the template as Question. Search Console looks sane.

Permalink

Posted a Guide recap of this thread so we are not asking people to mine comments.

Permalink

Weekly winners

Connection pooling vs read replicas for a 50k-member forum

We used to raise max_connections whenever p99 login latency spiked. After about 4_000 concurrent sessions that stopped working — the wait moved to row locks on topic_subscriptions.

What we measured

  1. sqlx pool wait (target under 8ms).
  2. PostgreSQL wait_event for Lock vs IO.
  3. Valkey session GET p99, which stayed flat.

Feed SELECTs now hit a replica. Votes still go to primary. If you have run a forum past 50k DAU, how did you split read-your-writes from the home feed?

Replies 5

System Administrator

@admin

We hit the same wall on connection. Replica lag was the surprise, not CPU.

Sarah Chen
StaffRegular

@sarah_product

Staff view: please do not delete the thread if this is a duplicate. Link the canonical Issue instead.

Leo Mensah

@leo_ops

For campus we used entity_type=course and left the template as Question. Search Console looks sane.

Maya Lin
Member

@maya_cloud

Posted a Guide recap of this thread so we are not asking people to mine comments.

System Administrator

@admin

Thanks — leaving this up for the next team that searches the same string.

Join the conversation

Sign in or create an account to share your thoughts, solutions, or feedback.