简体   繁体   中英

Pooling connection to mysql database server from django application server

I am designing the backend of my ios application. The backend has separate database and application server running mysql and django separately in different machines. Till now, I have connected my application server with my database server in simple way: I changed the database host in application server settings to point to remore database server and created a new remote host in database server configuration files allowing remote application server to access the database. All works fine and I have decided to go with this setup for production. Then when I was reading Instagram engineering blog, I saw them mentioning 'Pgbouncer' to pool connection to their postgresql database server. What is the need for something like this? Has this got something to do with only performance, or is this a production friendly approach to use something like this for communication between database and application server. Is my general approach mentioned too amateur?

Your approach is not amateur at all. The purpose of bouncer in your case would be to eliminate connection time that happens on each request django handles. For example, on Heroku, which is hosted on AWS servers, this could eat up 40-50ms of each request.

Now, if you had a master/slave setup or something like that, a connection pool would also provide you a failover functionality (just an example)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM