Connection pooling in Kubernetes

Mutha Nagavamsi
2 min readJul 24, 2023

--

Let’s address the elephant in the room. 🐘

Connection pooling is just HUGE for performance!

QUICK HELP: If you resonate with my work, please consider joining me on Youtube and Substack. I totally appreciate your support. Thank You.

It reduces the costly overhead of creating new database connections for each pod request.

Imagine we have three pods: A, B, and C, and a connection pool that has four active connections to a database

1️⃣ Initially, pod A and B use connection pools 1 and 3 respectively to happily query the database.

2️⃣ Later, pod C joins, utilizing connection pool 4, resulting in three active connections. The database needs a workout session to relax.

3️⃣ Uh-oh! Pod B’s connection is lost, prompting a brief waiting period on pool 3.

4️⃣ Lastly, pod A and C also disconnect. Pool 1 and 4 enter a waiting period, while pool 3 becomes available. The database is now HAPPY :)

The overall picture:

🔁 When pod B’s connection is disconnected, pool 3 begins a short waiting period.

Kubernetes connection pooling.

⏳ During this waiting period, the connection pool performs necessary cleanup operations. This waiting period helps optimize the connection pool’s performance.

🔄 After the waiting period, the connection pool makes the connection ready for reuse.

This process ensures smooth and uninterrupted access to the database and works best at scale.

That’s it for today; Hope you are HAPPY after reading this. ☺️

I’m Mutha, follow me for simplified tech, AI and cybersecurity content.

--

--

Mutha Nagavamsi

I'm Building a 100K Community of Happy People. 65771 on all social. Follow me, I spread Kubernetes and Technology with JOY 😁 - https://bento.me/muthanagavamsi