Shipping ItLesson 34 of 74

Module 4 · Load, cost and the traffic that is not customers

It is almost always the database

In this lesson

  • 10 min read
  • 7 reading sections
  • Knowledge check
  • Lesson 6 of 10 in this chapter

This chapter’s goalFind your first real ceiling with a load test and raise it using caching, pooling or a queue, without raising the bill.

This chapter’s media

The film explains chapter ideas. The audiobook narrates the complete teaching text.

FormatEnglishहिंदी
Chapter filmNot availableNot available
Full audiobookNot availableNot available

A little at a time

Explore an idea, try it, then check what stays.

Step 1 of 8Free · no account needed
Lesson steps

Connections run out before anything else

Postgres defaults to max_connections = 100, and each connection is a separate operating system process using several megabytes. This is not a setting to raise casually; a thousand connections mostly means a thousand processes competing to do nothing.

Now count what your application opens. Three containers, each with a pool of 20, is 60. Add a background worker, a migration job, your own psql session and a metrics exporter and you are near the limit while serving very little traffic.

Serverless makes this dramatically worse: every concurrent function instance opens its own connection, and there is no shared pool. A hundred concurrent invocations is a hundred connections, and the error is immediate and total:

Text
FATAL: sorry, too many clients already

Your place and first choices stay on this browser. Classroom credit is recorded separately.

Every lesson here is open. Your progress is recorded once you pass the Agents and Automation exam.

Stuck on something?Ask Tri, your AI tutor

How to cite: Addaly (2026) ‘It is almost always the database’, in Shipping It. Edited by M. Mun. Addaly. Available at: https://addaly.com/learn/cloud-and-shipping/the-database-is-the-bottleneck (Accessed: 29 November 2026).