MagicStack / MagicStack/asyncpg

Implementation of shared mode connection pool.

Open
#636 10 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
8.1k
Forks
468
PR merge metrics
No merged PRs in 30d

Description

* **asyncpg version**: 0.21.0
* **PostgreSQL version**: 12.4
* **Do you use a PostgreSQL SaaS? If so, which? Can you reproduce
the issue with a local PostgreSQL install?**: no
* **Python version**: 3.8.3
* **Platform**: Linux 4.18.0-193.19.1.el8_2.x86_64
* **Do you use pgbouncer?**: no
* **Did you install asyncpg with pip?**: yes
* **If you built asyncpg locally, which version of Cython did you use?**:
* **Can the issue be reproduced under both asyncio and
[uvloop](https://github.com/magicstack/uvloop)?**: yes

Currently, asyncpg implements connection pool by blocking the acquired connection in an asyncio.LifoQueue. In [aioredis](https://github.com/aio-libs/aioredis), the connection pool uses so-called shared mode connection which sends the command directly to the connection's StreamWriter and awaits the result from a background asyncio.Future consuming results from StreamReader indefinitely. Is it possible to implement a similar connection pool to optimize the performance of query?

Contributor guide

No contributing guide indexed for this repository

Research direction

The issue names asyncpg's connection pool and the aioredis connection-pool implementation as starting points, but no files or tests. Read both pool designs first, then establish how query performance and concurrent command handling should be measured; completion requires an agreed shared-mode design, implementation scope, and performance evidence.

Written by the indexing model from the issue text.

Assessment

Tech stack
postgresql, python
Domain
databases
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.