MagicStack / MagicStack/asyncpg

Making pool connection cycling async

Offen
#255 5 Kommentare 5 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Vorherrschende Sprache
Python
Sterne
8.1k
Forks
468
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

  • 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?
    : 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?

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne damit, den Einstiegspunkt Pool.connect und die vorhandenen Pool-Optionen für das proaktive Durchlaufen von Verbindungen zu lesen. Verfolge, wann der Verbindungsaufbau für eingehende Anfragen erfolgt, und ermittle, welche Änderungen für das Durchlaufen im Hintergrund erforderlich wären; abgeschlossen ist die Aufgabe, wenn Pool-Clients diese Latenz beim Verbindungsaufbau nicht mehr haben.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
postgresql, python
Bereich
backend, databases
Issue-Typ
Feature
Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.