Em đang có 1 node chạy bằng go, nếu em dùng connection pool để kết nối node này đến Postgres thì đó có phải là connection per request không ạ.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Request ở đây ý em là 1 câu truy vấn select, update, delete à?
Request ở đây là 1 http request, giống như lifetime scope trong .net vậy á anh.
Khi đọc hướng dẫn này: https://cloud.google.com/sql/docs/postgres/samples/cloud-sql-postgres-databasesql-limit thì anh thấy là sử dụng lý thuyết connection pool thông thường. Vậy thì nếu 1 request của em chỉ có 1 try vấn thì nó sẽ là 1 connection / 1 truy vấn. Tuy nhiên nếu request của em có nhiều truy vấn thì có thể nhiều connection được sử dụng trong 1 request
Postgres có thể handle được từ 100-300 concurrency connection, vậy nếu mình có số lượng request gửi tới lớn hơn limit của database thì các request tới sau sẽ bị error đúng ko anh.
Nó sẽ chờ cho đến khi nào có connection được nhả ra em ạ. Tuy nhiên nếu mãi mà không có connection mới thì request cũng sẽ bị timeout