Should PostgreSQL connections be pooled in a Python web app, or create a new connection per request?

前端 未结 5 481
隐瞒了意图╮
隐瞒了意图╮ 2021-02-04 17:26

I\'m building a web app in Python (using Flask). I do not intend to use SQLAlchemy or similar ORM system, rather I\'m going to use Psycopg2 directly.

Should I open a new

5条回答
  •  悲哀的现实
    2021-02-04 18:10

    The answer depends on how many such requests will happen and how many concurrently in your web app ? Connection pooling is usually a better idea if you expect your web app to be busy with 100s or even 1000s of user concurrently logged in. If you are only doing this as a side project and expect less than few hundred users, you can probably get away without pooling.

提交回复
热议问题