Architecture Weekly #189 - Mastering Database Connection Pooling
Welcome to the new week! This edition is the first one in a new newsletter format! What does that mean?
I know this can be a big change for you; I understand if you won’t like it and unsubscribe, but I genuinely hope you’ll stay with me and appreciate the new way. As I wrote in the previous release, I want to make this newsletter engaging, interesting, and filled with unique content. That takes time. I hope changing the format will help me free up more space to provide you with deep dives into Software Architecture. I think this will benefit you and make working on Architecture Weekly more sustainable for me. A paid subscription also gives you access to exclusive Discord community monthly webinars with access to recordings of all past ones (currently 20 with over 30 hours of content). Check them out here. I want to be fair, so I'm offering you a free month's trial. Here’s the link: https://www.architecture-weekly.com/b3b7d64d. You can check it out and decide if you like it and want to stay. I hope that you will! Feel invited to respond or comment! Still, off we go to Software Architecture! Efficiently managing database connections is crucial for any application that handles multiple requests. Without proper connection management, your application can quickly become slow, unreliable, and costly to maintain. Database connection pooling offers a smarter way to handle database connections. However, connection pooling isn't always ideal, especially in serverless architectures. Let's explore the mechanics of connection pooling, understand its importance, discuss when it might not be suitable, and explore how modern serverless solutions redefine connection management. Life without connection poolingImagine you're building a new e-commerce platform that helps small and medium-sized businesses create and manage their online stores. It provides features like product listings, inventory management, order processing, and customer analytics. Initially, the focus is on delivering basic functionalities like product management and checkout processes. You start with a simple architecture. The backend is written in Node.js and PostgreSQL database. The naive version of your database access code could look as: Each HTTP request opens a new database connection. This can work well for local development or small deployment, but setup quickly hits a wall as your user base grows. Users start complaining about slow load times, and your database server gets overwhelmed by too many open connections. Why does that become a problem? Opening a new database connection for every request involves a time-consuming process involving authentication, network setup, and session establishment. This adds significant latency, especially in high-traffic applications. Your database has a finite limit on how many concurrent connections it can handle. Without pooling, you risk overwhelming the database, leading to resource exhaustion and potential downtime. What is Connection Pooling?Database connection pooling is a technique that allows applications to manage database connections more efficiently by reusing a set of established connections. Instead of creating a new connection for each database request, the application maintains a pool of open connections that can be reused, significantly reducing the time and resources needed to establish connections repeatedly. How Connection Pooling WorksHere's a breakdown of how connection pooling operates in a technical environment:
Do you prefer visuals? There you have it! Connection pooling can significantly enhance performance and reduce latency by eliminating the latency added by setting up a connection each time. Implementing Connection PoolingEach mature development environment has a built-in connection pooling. For instance, for PostgreSQL:
We’ll use the last one to address our connection management-related performance bottlenecks. The code could look as follows:... ![]() Unlock this post for free, courtesy of Oskar Dudycz.A subscription gets you:
|
Older messages
Architecture Weekly #188 - 29th July 2024
Monday, July 29, 2024
This time in an unusual edition, we focused on the underestimated aspect of Software Design: resting. We discussed the typical mistakes we do and why repeating them will not help you in making right
Architecture Weekly #187 - 8th July 2024
Monday, July 8, 2024
This week, we discussed the challenges of finding the right architecture strategy and pivoting it when needed. We brought and discussed a few insightful articles on how/when/why to move to serverless,
Architecture Weekly #186 - 1st July 2024
Monday, July 1, 2024
This week, we covered the Polyfill JS supply chain attack that potentially touched 4% of the Internet. We also checked the DataDog report on the state of Cloud Spendings. We discussed whether it's
Architecture Weekly #185 - 24th June 2024
Monday, June 24, 2024
This edition is 50 shaded of coupling! Yeah, I know how that sounds, but we discussed why coupling is not an end goal but a metric to evaluate tradeoffs. We also discussed how to actually make
Architecture Weekly #184 - 17th June 2024
Monday, June 17, 2024
It's a new Monday, the right time for the new set of software architecture materials! This time, we started with visualisations that were made right for great explanations of queuing concepts. I
You Might Also Like
Stop Android photo surveillance 🔍
Friday, February 28, 2025
Cheaper streaming 📺; 1Password nightmare 💀 -- ZDNET ZDNET Week in Review - US February 28, 2025 machine eye A new Android feature is scanning your photos for 'sensitive content' - how to stop
Why Natural Language Coding Isn’t for Everyone—Yet
Friday, February 28, 2025
Top Tech Content sent at Noon! Boost Your Article on HackerNoon for $159.99! Read this email in your browser How are you, @newsletterest1? 🪐 What's happening in tech today, February 28, 2025? The
iOS Cocoa Treats
Friday, February 28, 2025
View in browser Hello, you're reading Infinum iOS Cocoa Treats, bringing you the latest iOS related news straight to your inbox every week. Animatable Protocol: Taming Unruly SwiftUI Animations In
Your new cheap TV streaming option 📺
Friday, February 28, 2025
GPT-4.5; AI work study; Smartwatch faceoff ⌚; Run your own cloud -- ZDNET ZDNET Tech Today - US February 28, 2025 tv watching DirecTV's new no-contract 'Genre Packs' start at $35 - and you
⚙️ GPT 4.5 - worth the cost?
Friday, February 28, 2025
Plus: Nvidia didn't come to the rescue
ASP.NET Core News - 02/28/2025
Friday, February 28, 2025
View this email in your browser Get ready for this weeks best blog posts about ASP.NET Core! ASP.NET Core updates in .NET 10 Preview 1 — by danroth27 .NET Aspire 9.1 is here with six great new
SWLW #640: The burdens of data, Creating a sense of stability, and more.
Friday, February 28, 2025
Weekly articles & videos about people, culture and leadership: everything you need to design the org that makes the product. A weekly newsletter by Oren Ellenbogen with the best content I found
12,000+ API Keys and Passwords Found in Public Datasets Used for LLM Training
Friday, February 28, 2025
THN Daily Updates Newsletter cover ⚡ LIVE WEBINAR ➟ The Anatomy of a Ransomware Attack Watch a Live Ransomware Attack Demo, Uncover Hacker Tactics and Learn to Defend Download Now Sponsored LATEST NEWS
The Sequence Research #500: Making Small Models Great Achieve GPT-o1 Levels in Math Reasoning with Microsoft rStar…
Friday, February 28, 2025
The new method represents an important evolution of reasoning for SLMs. ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏
🎧 The Perfect AirPods Alternative for Android — Features I Wish Netflix Would Copy From YouTube
Friday, February 28, 2025
Also: Are Ryobi Power Tools at Home Depot Worth Buying? and More! How-To Geek Logo February 28, 2025 Did You Know The crew of Apollo 11 took two tiny pieces of the Wright "Kitty Hawk" Flyer,