oracle 如何设置Oracle连接池大小?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4348982/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 22:06:40  来源:igfitidea点击:

how to set Oracle connection pool size?

asp.netoracleconnection-pooling

提问by nandin

We have been getting this Oracle connection pool exception a lot recently for our ASP.NET website. This is the detailed exception message:

最近,我们的 ASP.NET 网站经常收到此 Oracle 连接池异常。这是详细的异常消息:

Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached.

超时已过。在从池中获取连接之前超时时间已过。这可能是因为所有池连接都在使用中并且达到了最大池大小。

This is our connection string

这是我们的连接字符串

User ID=user1;password=password1;DATA SOURCE=Datasource1 

Can you tell me how to set max pool size to 1so that I can debug it on my local?

你能告诉我如何将最大池大小设置为1以便我可以在本地调试它吗?

Another question is: what is the recommended pool size for a website with 10,000 users? and if max pool size is reached, how to fail gracefully?

另一个问题是:对于拥有 10,000 个用户的网站,推荐的池大小是多少?如果达到最大池大小,如何优雅地失败?

Thanks a lot!

非常感谢!

回答by demas

I have used such connection string to set the connection pool size:

我已经使用这样的连接字符串来设置连接池大小:

const string connString = "server=localhost;" +
                              ....
                             "Min Pool Size=3;" +
                             "Max Pool Size=3";

But you don't need to set connection pool size bigger. Such error message I have got when I forget to close connections. Check your code to find places where you open connections, but don't close them. It can help you.

但是您不需要将连接池大小设置得更大。当我忘记关闭连接时,我收到了这样的错误消息。检查您的代码以查找您打开连接的位置,但不要关闭它们。 它可以帮助你