MagicStack / MagicStack/asyncpg
Making pool connection cycling async
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Python
- Star
- 8.1k
- Fork
- 469
- Merge trung bình
- 18 phút
- Pull request đã merge (30 ngày)
- 4
Mô tả
- 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?
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu bằng cách đọc entry point Pool.connect và các tùy chọn pool hiện có để chủ động luân phiên các kết nối. Theo dõi thời điểm việc thiết lập kết nối xảy ra đối với các request đến và xác định những thay đổi cần thiết cho việc luân phiên trong background; được xem là hoàn tất khi các client của pool không còn phải chịu độ trễ thiết lập kết nối đó.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- postgresql, python
- Lĩnh vực
- backend, databases
- Loại issue
- Tính năng
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 35/100