PostgreSQL connection problems

Source: Internet
Author: User

I have written programs in PostgreSQL and npgsql recently. Since there are more than 300 customers, some of them cannot be connected.

When max_connection is adjusted to 500, the problem is solved, but the memory usage is also soaring. When some data is missing, it is estimated that the problem can be solved through two aspects:

PostgreSQL connection pool, such as pgbouncer;

Npgsql connection parameters include pooling, minpoolsize, maxpoolsize, and connectionlifetime. For more information, see npgsql's usermanual.

Solution:

1. Add pooling = false to the connection string;

In this way, the client npgsql does not keep the connection in the pool, and the connection is actually closed every time it is closed, so that the PostgreSQL Server

The related mongos.exe process is also ended. If the parallel degree is not very high, max_connection is 100 enough.

In this case, the number of worker s.exe processes on the server is reduced, and the memory usage is also reduced. The disadvantage is that you need to create a new server every time you connect to it.

The cmds.exe process wastes some CPU resources. Select whether to use this option based on the project characteristics and server configurations. If the memory is a bottleneck

2. Changed connectionlifetime, which seems to have no effect.

 

3. Call clearallpools (), clearpool (), and other functions to promptly clear unused connections.

4. PostgreSQL supporting software pgpool and pgbouncer on Windows platforms are currently unavailable.

You can use them to tune performance.

 

 

Http://www.powerpostgresql.com/PerfList

Http://npgsql.projects.postgresql.org/docs/manual/UserManual.html

Http://www.revsys.com/writings/postgresql-performance.html

Http://blog.sina.com.cn/s/blog_4e808acf0100afrt.html

Http://www.kakapo.cn/blog/read.php? 142

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.