Sizing a pool
On This Lesson 4 topics
This lesson is planned. The outline below lists the topics it will cover. The full lesson has not been published yet.
In this lesson
size a pool from capacity, not by guesswork.
Planned topics
- Start with the database: total connections across all app instances must stay under what the server can serve (cores and disks, and
max_connections). - A common starting rule:
connections ≈ (core_count × 2) + effective_spindle_count; treat it as a start, then measure. - Little's law: concurrent connections needed ≈ requests per second × average time a connection is held.
- Multiply the pool by the number of app instances; autoscaling can overload the database.
- Shorter transactions need fewer connections; fix slow queries before enlarging the pool.
Draft outline details
Demonstration
a worked example: 400 req/s × 25 ms hold = 10 connections on average; add headroom; three instances means 4–6 per instance.
Check your understanding
200 req/s, each holds a connection 50 ms. About how many connections are busy on average?
Show answer
10.
Practice
Apply this lesson with the module's lab, exercises and quiz.
Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.