MagicStack / MagicStack/asyncpg
Making pool connection cycling async
Nessuno ha ancora preso questa issue.
- Lingua principale
- Python
- Stelle
- 8.1k
- Fork
- 468
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
* **asyncpg version**: 0.14
* **PostgreSQL version**: 9.5/9.6
* **Do you use a PostgreSQL SaaS? If so, which? Can you reproduce
the issue with a local PostgreSQL install?**: AWS RDS
* **Python version**: 3.6
* **Platform**: linux in docker
* **Do you use pgbouncer?**: Not in this instances
* **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)?**: We only use asyncio
We have some application containers that use asyncpg connection pools, every now and again my performance tracing on our application request handlers shows that the `connect` method in the `Pool` takes a significant amount of time (sometimes 150ms) when establishing a connection to our RDS postgres instance (same Region).
The Pool has options to control how often a connection is pro-actively cycled, but my concern is that this results in clients of the pool having to wait for a connection to be established - I would much rather push this into a background async task who's job it is to take connections in/out of service so that inbound http requests to our server never incur the latency of performing the connection themselves.
Is this already doable or would it require some changes to asyncpg?
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia leggendo l’entry point Pool.connect e le opzioni esistenti del pool per ruotare proattivamente le connessioni. Traccia quando avviene la connessione per le richieste in ingresso e determina quali modifiche sarebbero necessarie per la rotazione in background; il lavoro è completato quando i client del pool non incorrono più in questa latenza di stabilimento della connessione.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- postgresql, python
- Ambito
- backend, databases
- Tipo di issue
- Funzionalità
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100