MagicStack / MagicStack/asyncpg

Making pool connection cycling async

オープン
#255 コメント 5 件 リアクション 5 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
Python
スター
8.1k
フォーク
468
PR マージ指標
30日以内にマージされた PR はありません

説明

* **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?

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず、Pool.connect のエントリポイントと、接続を事前にローテーションするための既存のプールオプションを読みます。受信リクエストに対する接続確立がいつ発生するかを追跡し、バックグラウンドでローテーションするにはどのような変更が必要かを判断します。完了の条件は、プールクライアントが接続確立のレイテンシを負担しなくなることです。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
postgresql, python
領域
backend, databases
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。