Considerations When Scaling with Multiple Source Accounts

Last updated: July 18, 2025

While distributing load across multiple source accounts is an effective way to increase throughput, it’s important to strike a balance. Simply creating millions of unique accounts to maximize parallelism introduces its own set of challenges.


🚫 The Problem with Excessive Account Creation

Creating millions of distinct @world:{random} accounts for the sake of parallelism:

  • Bloats the database: Each account adds a row to the accounts table, even if used just once. Over time, this results in a massive number of mostly inactive or redundant rows.

  • Increases storage and index overhead: PostgreSQL will need to maintain indexes and stats for all these accounts, impacting query performance and increasing I/O.

  • Adds management complexity: Monitoring, auditing, and querying such a large volume of "throwaway" accounts becomes harder and less meaningful.

You don’t get linear performance gains by infinitely increasing account count — there’s a natural ceiling.


📉 The Real Bottleneck: Parallelism Limits

Even if you scale horizontally by adding accounts, you are still fundamentally bound by:

  • PostgreSQL’s connection concurrency limits (number of active writers).

  • CPU and I/O capacity of the database server.

  • Row-level lock granularity, which is optimized but not unlimited.

This means that regardless of how many accounts you create, you can't go faster than the maximum number of concurrent transactions your database can effectively handle.


Practical Recommendation

Rather than starting with a massive pool of random source accounts, we recommend a staged, controlled approach:

  • Start with 20 @world:{random} accounts.

    • This already gives you 20x parallelism over a single account bottleneck.

    • Most applications see significant throughput gains at this level.

  • Monitor performance and scale incrementally.

    • If performance remains a constraint, increase the pool gradually (e.g., 50, 100).

    • Each step should be validated with actual throughput and resource metrics.

This keeps your system performant, predictable, and easier to maintain.


📌 Summary

Approach

Benefit

Trade-off

Single source account

Simple, but bottlenecked

Row-level locking limits concurrency

Pool of 20 accounts

20x parallelism

Requires routing logic in app

Thousands of accounts

Maximum theoretical parallelism

DB bloat, harder to manage, limited by DB’s physical capacity