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
Daily Coding Problem: Problem #1668 [Easy]
Tuesday, January 14, 2025
Daily Coding Problem Good morning! Here's your coding interview problem for today. This problem was asked by Microsoft. A number is considered perfect if its digits sum up to exactly 10. Given a
Django vs FastAPI, Interacting With Python, Data Cleaning, and More
Tuesday, January 14, 2025
Django vs. FastAPI, an Honest Comparison #664 – JANUARY 14, 2025 VIEW IN BROWSER The PyCoder's Weekly Logo Django vs. FastAPI, an Honest Comparison David has worked with Django for a long time, but
🤖 Yes, I Do Want a Drink-Carrying Robot — The Best Way to Give Old TVs Bluetooth
Tuesday, January 14, 2025
Also: How to Prevent Your Computer From Waking Up Accidentally, and More! How-To Geek Logo January 14, 2025 Did You Know Except for the letter Q, every letter of the alphabet shows up in the names of
Charted | AI's Perceived Impact on Job Creation, by Country 🔮
Tuesday, January 14, 2025
This chart presents Ipsos survey results on whether people believe AI will create many new jobs in their country. View Online | Subscribe | Download Our App Presented by Hinrich Foundation NEW REPORT:
HackerNoon Decoded: How Users Searched in 2024
Tuesday, January 14, 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, January 14, 2025? The
Hack Your Python Roadblocks -- Just 5 Seats Left
Tuesday, January 14, 2025
Hi there, A quick update: after last week's announcement, the Intermediate Python Deep Dive live course is almost full. We're down to just 5 spots left for the February cohort, and once they
Spyglass Dispatch: TikTok & Twitter
Tuesday, January 14, 2025
Sonos Switch • MySports Streaming • Amazon's Alexa Brain Freeze • Billionaire-Free Social Media • EU Backs off Big Tech The Spyglass Dispatch is a newsletter sent on weekdays featuring links and
5 AI Predictions for 2025 (AI hype dying; real opportunities rising)
Tuesday, January 14, 2025
plus, a new study: AI Economy = $15 trillion. ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏
Power BI Weekly #291 - 14th January 2025
Tuesday, January 14, 2025
Power BI Weekly Newsletter Issue #291 powered by endjin Welcome to the 291st edition of Power BI Weekly! No official Power BI blogs yet, so let's dive into the community articles. To start, Eugene
LW 165 - How Shopify Built Its Live Globe for Black Friday
Tuesday, January 14, 2025
How Shopify Built Its Live Globe for Black Friday Shopify Development news and articles Issue 165