# connection-pooling

Published articles for connection-pooling.

This is one page of public article previews, not the complete archive. Follow Next page to continue. Summaries are not the original full articles.

## Ensure Activity execution on the same Worker

DevFeed: [Ensure Activity execution on the same Worker](<https://devfeed.tech/articles/ensure-activity-execution-on-the-same-worker-35996.md>)

Original publisher: [Read original article](<https://temporal.io/blog/task-queue-worker-affinity>)

Author: Cecil Phillip

Published: 2026-05-11T00:00:00Z

Content type: tutorial

Language: en

Sources: [Temporal Blog](<https://devfeed.tech/sources/temporal-blog.md>)

Topics: [execution](<https://devfeed.tech/topics/execution.md>), [Workers](<https://devfeed.tech/topics/workers.md>), [file](<https://devfeed.tech/topics/file.md>), [data](<https://devfeed.tech/topics/data.md>)

Tags: [caching](<https://devfeed.tech/tags/caching.md>), [connection-pooling](<https://devfeed.tech/tags/connection-pooling.md>), [data](<https://devfeed.tech/tags/data.md>), [execution](<https://devfeed.tech/tags/execution.md>), [files](<https://devfeed.tech/tags/files.md>), [queues](<https://devfeed.tech/tags/queues.md>), [temporal-concepts](<https://devfeed.tech/tags/temporal-concepts.md>), [worker](<https://devfeed.tech/tags/worker.md>)

### AI overview

This article explains how Temporal Worker-specific Task Queues can keep all Activities in a workflow on the same Worker, preserving data locality for file processing, ML model caching, and database connection pooling.

### Source excerpt

Stop re-downloading multi-GB files between Activities. Use Worker-specific Task Queues in Temporal to keep all Activities on the same Worker.

## AI agents break connection pooling by holding the slot while they think

DevFeed: [AI agents break connection pooling by holding the slot while they think](<https://devfeed.tech/articles/ai-agents-break-connection-pooling-by-holding-the-slot-while-they-think-39573.md>)

Original publisher: [Read original article](<https://ankit-rana.com/logs/21-llms-connection-pooling-ai-agents/>)

Author: hello@ankit-rana.com

Published: 2026-03-21T00:00:00Z

Content type: article

Language: en

Sources: [Ankit Rana | Mechanical Sympathy](<https://devfeed.tech/sources/ankit-rana-mechanical-sympathy.md>)

Topics: [connection pool](<https://devfeed.tech/topics/connection-pool.md>), [Artificial Intelligence](<https://devfeed.tech/topics/ai.md>), [Large Language Model](<https://devfeed.tech/topics/llm.md>), [Latency](<https://devfeed.tech/topics/latency.md>), [Databases](<https://devfeed.tech/topics/databases.md>), [PostgreSQL](<https://devfeed.tech/topics/postgresql.md>), [Back end](<https://devfeed.tech/topics/backend.md>)

Tags: [agents](<https://devfeed.tech/tags/agents.md>), [ai](<https://devfeed.tech/tags/ai.md>), [ai-agents](<https://devfeed.tech/tags/ai-agents.md>), [concurrent](<https://devfeed.tech/tags/concurrent.md>), [connection-pool](<https://devfeed.tech/tags/connection-pool.md>), [connection-pooling](<https://devfeed.tech/tags/connection-pooling.md>), [databases](<https://devfeed.tech/tags/databases.md>), [latency](<https://devfeed.tech/tags/latency.md>), [llm](<https://devfeed.tech/tags/llm.md>), [performance](<https://devfeed.tech/tags/performance.md>), [postgresql](<https://devfeed.tech/tags/postgresql.md>)

### AI overview

This article explains how AI agents can exhaust database connection pools by holding connections during LLM inference. It describes the resulting queueing and latency problems, including cases where the database remains lightly loaded, and recommends releasing the connection before calling the model.

### Source excerpt

Connection pooling assumes an implicit contract that transactions stay microscopic, roughly 50 ms of database time per request. An agent that holds a pooled connection while waiting 3 to 5 seconds for LLM inference breaks that assumption: 100 concurrent agents can occupy every slot in a 100-connection pool while the database sits at 2 percent CPU. Fetch, release the connection immediately, then call the model asynchronously.

## Postgres and Connection Pooling

DevFeed: [Postgres and Connection Pooling](<https://devfeed.tech/articles/postgres-and-connection-pooling-41170.md>)

Original publisher: [Read original article](<https://www.craigkerstiens.com/2014/05/22/Postgres-and-Connection-Pooling/>)

Author: Map

Published: 2014-05-22T20:55:56Z

Content type: tutorial

Language: en

Sources: [Craig Kerstiens](<https://devfeed.tech/sources/craig-kerstiens.md>)

Topics: [connection pool](<https://devfeed.tech/topics/connection-pool.md>), [Databases](<https://devfeed.tech/topics/databases.md>), [Object-relational mapping](<https://devfeed.tech/topics/orm.md>), [SQLAlchemy](<https://devfeed.tech/topics/sqlalchemy.md>), [Django](<https://devfeed.tech/topics/django.md>), [Rails](<https://devfeed.tech/topics/rails.md>), [Ruby](<https://devfeed.tech/topics/ruby.md>), [SSL](<https://devfeed.tech/topics/ssl.md>)

Tags: [connection-pool](<https://devfeed.tech/tags/connection-pool.md>), [connection-pooling](<https://devfeed.tech/tags/connection-pooling.md>), [database](<https://devfeed.tech/tags/database.md>), [django](<https://devfeed.tech/tags/django.md>), [orm](<https://devfeed.tech/tags/orm.md>), [postgres](<https://devfeed.tech/tags/postgres.md>), [postgresql](<https://devfeed.tech/tags/postgresql.md>), [python](<https://devfeed.tech/tags/python.md>), [rails](<https://devfeed.tech/tags/rails.md>), [ruby](<https://devfeed.tech/tags/ruby.md>), [sqlalchemy](<https://devfeed.tech/tags/sqlalchemy.md>), [ssl](<https://devfeed.tech/tags/ssl.md>)

### AI overview

A primer on database connection pooling explains how pooled, persistent, and standalone connections reduce connection-establishment overhead, including SSL negotiation. It discusses framework support in Ruby, Python, Rails, and Django, and notes Postgres connection and memory considerations.

### Source excerpt

Connection pooling is quickly becoming one of the more frequent questions I hear. So here's a primer on it. If there's enough demand I'll follow up a bit further with some detail on specific Postgres connection poolers and setting them up. The basics For those unfamiliar, a connection pool is a group of database connections sitting around that are waiting to be handed out and used. This means when a request comes in a connection is already there whether in your framework or some other pooling process, and then given to your application for that specific request or transaction. In contrast, without any connection pooling your application will have to reach out to your database to establish a connection. While in the most basic sense you may thinking connecting to a database is quick, often theres some overhead here. An example is SSL negotiation that may have to occur which means you're looking at not 1-2 ms but often closer to 30-50. The options There's really two major options when it comes to connection pooling: Framework pooling Standalone pooler Persistent connections Framework pooling Today many modern application frameworks have at least some basic level of connection pooling. This means as your application server starts up it will create a pool of connections to use. It's worth noting that while most modern frameworks have pooling, not all do, and further it may not be enabled by default. If you're using the Sequel ORM for Ruby or SQLAlchemy for Python you're well covered here. Further Rails is in pretty good shape also, though you may want to configure the pool size. For Django it's a bit of a mixed story. For some time Django did not have pooling at all. As of Django 1.6 you now have persistent connections by default and the ability to enable a pool. Persistent connections Persistent connections don't offer all of the benefits of pooling, but can often work well enough. Persistent connections is the act of maintaining a connection to your database once it's

## Fixing Database Connections in Django

DevFeed: [Fixing Database Connections in Django](<https://devfeed.tech/articles/fixing-database-connections-in-django-41129.md>)

Original publisher: [Read original article](<https://www.craigkerstiens.com/2013/03/07/Fixing-django-db-connections/>)

Author: Map

Published: 2013-03-07T20:55:56Z

Content type: tutorial

Language: en

Sources: [Craig Kerstiens](<https://devfeed.tech/sources/craig-kerstiens.md>)

Topics: [Django](<https://devfeed.tech/topics/django.md>), [Database](<https://devfeed.tech/topics/database.md>), [PostgreSQL](<https://devfeed.tech/topics/postgresql.md>), [Cloud](<https://devfeed.tech/topics/cloud.md>), [SSL](<https://devfeed.tech/topics/ssl.md>), [Heroku](<https://devfeed.tech/topics/heroku.md>)

Tags: [cloud](<https://devfeed.tech/tags/cloud.md>), [connection-pooling](<https://devfeed.tech/tags/connection-pooling.md>), [database](<https://devfeed.tech/tags/database.md>), [django](<https://devfeed.tech/tags/django.md>), [heroku](<https://devfeed.tech/tags/heroku.md>), [performance](<https://devfeed.tech/tags/performance.md>), [postgresql](<https://devfeed.tech/tags/postgresql.md>), [python](<https://devfeed.tech/tags/python.md>), [ssl](<https://devfeed.tech/tags/ssl.md>)

### AI overview

The article explains that Django's per-request database connections can add substantial latency, especially in cloud environments where SSL negotiation contributes to connection time. It presents connection pooling and persistent connections as ways to reduce that overhead and discusses Django packages that support pooling.

### Source excerpt

If you're looking to get better performance from your Django apps you can check out Pro Django, PostgreSQL High Performance, or read some my earlier posts on Postgres Performance. All of these are of course good things to do - you can also start by correcting an incredibly common but also painful performance issue, that until 1.6 is unaddressed in Django. Django's current default behavior is to establish a connection for each request within a Django application. In many cases any particularly in distributed cloud environments this is a large time sink of your response time. An example application running on Heroku shows a typical connection time of 70ms. A large part of this time is the SSL negotiation that occurs in connecting to your database, which is a good practice to ensure security of your data. Regardless, this is a long time in simply establishing a connection. As a point of comparisson its commonly encourage that most queries to your database are under 10ms. An example that highlights this in a small lightweight application shows the bulk of a request time being within a connection displayed by New Relic: One option to remedy this is by running a connection pooler on your Database side such as Pgpool or PgBouncer. In fact Ask the Pony already highlighted these potential gains. While running an external DB they're essentially testing the benefits of conncetion pooling. This is an obvious gain and can be in a much more lightweight format. Connection Pooling in Django As Django establishes a connection on each request it has an opportunity to both pool connections and persist connections. There are two major options for pooling, each works quite well with Django and provides some dramatic improvements. While the first request may take the 70ms of connection time, subsequent requests show absolutely no connection time since the connection already exists. This is highlighed by these two comparissons of before and after in actually the times it grabs a connectio

## Postgres Pooling with Django

DevFeed: [Postgres Pooling with Django](<https://devfeed.tech/articles/postgres-pooling-with-django-41119.md>)

Original publisher: [Read original article](<https://www.craigkerstiens.com/2012/10/02/Postgres-Pooling-with-Django/>)

Author: Map

Published: 2012-10-02T20:55:56Z

Content type: tutorial

Language: en

Sources: [Craig Kerstiens](<https://devfeed.tech/sources/craig-kerstiens.md>)

Topics: [Django](<https://devfeed.tech/topics/django.md>), [SQLAlchemy](<https://devfeed.tech/topics/sqlalchemy.md>), [Databases](<https://devfeed.tech/topics/databases.md>), [Object-relational mapping](<https://devfeed.tech/topics/orm.md>), [Cloud](<https://devfeed.tech/topics/cloud.md>), [Heroku](<https://devfeed.tech/topics/heroku.md>)

Tags: [connection-pooling](<https://devfeed.tech/tags/connection-pooling.md>), [database](<https://devfeed.tech/tags/database.md>), [django](<https://devfeed.tech/tags/django.md>), [load-balancing](<https://devfeed.tech/tags/load-balancing.md>), [orm](<https://devfeed.tech/tags/orm.md>), [performance](<https://devfeed.tech/tags/performance.md>), [postgres](<https://devfeed.tech/tags/postgres.md>), [python](<https://devfeed.tech/tags/python.md>), [replication](<https://devfeed.tech/tags/replication.md>), [sqlalchemy](<https://devfeed.tech/tags/sqlalchemy.md>), [ssl](<https://devfeed.tech/tags/ssl.md>)

### AI overview

This article discusses database connection pooling for Django applications using Postgres. It reviews pgPool and pgBouncer, notes possible operational caveats, and presents SQLAlchemy with django_postgrespool as a Django database backend that provides connection pooling.

### Source excerpt

A feature thats glaringly missing within Django and common in many other frameworks including many Java frameworks and Rails is connection pooling for your database connection. As most Django users are Postgres users the default answer is to use something like pgPool or pgBouncer. This are tools that you can run that will persist a connection to your Postgres database intended to offer: Connection Pooling Replication Load Balancing Its of not that PgBouncer is intended very specifically for pooling while pgPool does much more. Each of these in many cases can come with caveats though. If there are issues within your network they may not re-establish the connection properly. They also are not known to handle SSL renegotiation very well. Finally given running one more piece of software to reduce connection times it seems like a lot of overhead to simply reduce the connection time to your database. Is connection time a real problem? Given a well refined app, with a well refined schema with appropriate indexes your view should be doing things pretty quickly. If this is the case without some form of connection pooling and running in a cloud environment (in this case Heroku) your application performance looks like: If you'll notice that about 50% of our request time was in Postgres. The hard part to see is how much of this is actually doing something. In this case its issuing some very basic queries then rendering a very basic view. The solution By using something in the other Python ORM, SQLAlchemy, we can take advantage of its connection pooling. Large thanks to Kenneth Reitz for packaging this up into an easy to install and easy to use format as a Django DB backend. Using django_postgrespool it will take advantage of connection pooling and we can then see the performance after: