Should I set max pool size in database connection string? What happens if I don't?

后端 未结 3 1320
慢半拍i
慢半拍i 2020-12-24 00:03

This is my database connection string. I did not set max pool size until now.

public static string srConnectionString = 
                       \"server=loca         


        
相关标签:
3条回答
  • 2020-12-24 00:51

    "currently yes but i think it might cause problems at peak moments" I can confirm, that I had a problem where I got timeouts because of peak requests. After I set the max pool size, the application ran without any problems. IIS 7.5 / ASP.Net

    0 讨论(0)
  • 2020-12-24 00:55

    Currently your application support 100 connections in pool. Here is what conn string will look like if you want to increase it to 200:

    public static string srConnectionString = 
                    "server=localhost;database=mydb;uid=sa;pwd=mypw;Max Pool Size=200;";
    

    You can investigate how many connections with database your application use, by executing sp_who procedure in your database. In most cases default connection pool size will be enough.

    0 讨论(0)
  • 2020-12-24 01:10

    We can define maximum pool size in following way:

                    <pool> 
                   <min-pool-size>5</min-pool-size>
                    <max-pool-size>200</max-pool-size>
                    <prefill>true</prefill>
                    <use-strict-min>true</use-strict-min>
                    <flush-strategy>IdleConnections</flush-strategy>
                    </pool>
    
    0 讨论(0)
提交回复
热议问题