oracle 一个数据库服务器一次可以有多少个打开的连接?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4784458/
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
How many open connections can a database server have at a time?
提问by macha
Hello I am trying to under database resident connection pooling with Oracle 11g. Now one question I have on my mind is, if I have a 1 database server on the backend. How many concurrent requests can my database server handle at a given moment, would it be one or would it be more than one at the same time.
您好,我正在尝试使用 Oracle 11g 进行数据库驻留连接池。现在我想到的一个问题是,是否在后端有 1 个数据库服务器。我的数据库服务器在给定时刻可以处理多少个并发请求,它是一个还是同时多个。
To para-phrase my question, if Client1 requests a select query of say top 100 results, and Client2 requests a select of something else, does the server handle both at the same moment, or finishes the first request that it received and then attends the next request??
解释一下我的问题,如果 Client1 请求选择前 100 个结果的查询,而 Client2 请求选择其他内容,服务器是同时处理这两个请求,还是完成它收到的第一个请求,然后参加下一个请求??
回答by David
Per the docs here: http://download.oracle.com/docs/cd/E11882_01/network.112/e10836/listenercfg.htm
根据此处的文档:http: //download.oracle.com/docs/cd/E11882_01/network.112/e10836/listenercfg.htm
this is specific to the platform. (This would also vary by database system, but you mentioned Oracle 11g, so that's what I answered specifically.)
这是特定于平台的。(这也会因数据库系统而异,但您提到了 Oracle 11g,所以这就是我专门回答的。)
Note:
The default number of concurrent connection requests is operating system-specific. The defaults for TCP/IP on the Linux operating system and Microsoft Windows follow:
?Linux operating system: 128
?Microsoft Windows XP Professional SP2: 10
?Microsoft Windows 2003 Server Enterprise Edition: 200
笔记:
并发连接请求的默认数量是特定于操作系统的。Linux 操作系统和 Microsoft Windows 上 TCP/IP 的默认值如下:
?Linux 操作系统:128
?Microsoft Windows XP Professional SP2:10
?Microsoft Windows 2003 Server 企业版:200
For other databases, you can always google "Maximum Concurrent Connections (insert DB type here)"
对于其他数据库,您可以随时谷歌“最大并发连接数(在此处插入数据库类型)”
And in reality technically, a single processor can only handle a single calculation at a time, so in reality, when you ask "At the same moment" technicallythe answer is no.
实际上,从技术上讲,单个处理器一次只能处理一个计算,因此实际上,当您从技术上说“同时”时,答案是否定的。
Threadingmay make it LOOK like they are happening at the same moment, but likely they are not. Threading, in conjunction with computers powerful enough to do things very quicly makes things appearlike they are happening at the same time by handling the individiual tasks, but in reality, it's not. But that's a bigger topic than can be covered here.
线程可能会使它们看起来像是在同一时刻发生,但可能并非如此。线程与功能强大到可以非常快速地做事的计算机相结合,通过处理各个任务,使事情看起来像是同时发生的,但实际上并非如此。但这是一个比这里可以涵盖的更大的主题。
回答by DCookie
As @David states, a processor can do only one thing at a given instant.
正如@David 所说,处理器在给定的时刻只能做一件事。
That said, your question is not easy to give a simple answer for. The server is going to handle the queries in a queued fashion in it's simplest case (ignoring such things as resource limits). However, as soon as the first query has to give up control due to disk I/O or any other resource request, the second query gets a chance. It very well may complete before the first one, depending on what each query is doing.
也就是说,你的问题不容易给出一个简单的答案。在最简单的情况下(忽略诸如资源限制之类的事情),服务器将以排队方式处理查询。然而,一旦第一个查询由于磁盘 I/O 或任何其他资源请求而不得不放弃控制,第二个查询就有机会。它很可能在第一个之前完成,这取决于每个查询正在做什么。
回答by stivlo
A DBMS can handle many connection simultaneously, typically in the hundreds. However normally a few queries (could be 2-3) per core will proceed at the same time.
一个 DBMS 可以同时处理许多连接,通常是数百个。但是,通常每个内核会同时进行几个查询(可能是 2-3 个)。
@David it's true that a single processor can handle only a single calculation at a time, but when the load is disk bound, it has a lot of spare time to process other queries, while waiting for the data to be loaded.
@David 确实,单个处理器一次只能处理一个计算,但是当负载受磁盘限制时,它有很多空闲时间来处理其他查询,同时等待数据加载。
回答by Alex Poole
The queries will be executed concurrently, usually. The number of connections that can be handled depends on the server, the listener configuration, and the processes and sessions initialisation parameters. If you try to open too may connections you'll get an error.
通常,查询将并发执行。可以处理的连接数取决于服务器、侦听器配置以及进程和会话初始化参数。如果您也尝试打开连接,您会收到错误消息。
If you're using connection pooling then each of those pooled connections is using up one of the database instance's sessions and one of its processes. (Someone may correct me on the difference between dedicated and shared listeners, but that's roughly right). Each request (query) over a pooled connection uses the already set-up connection, so it doesn't need a new TCP/IP socket and doesn't have the overhead associated with socket/session creation - which is one of the reasons you use pooling in the first place.
如果您正在使用连接池,那么这些池中的每一个连接都会耗尽数据库实例的一个会话及其进程之一。(有人可能会纠正我的专用听众和共享听众之间的区别,但这大致正确)。池连接上的每个请求(查询)都使用已经建立的连接,因此它不需要新的 TCP/IP 套接字并且没有与套接字/会话创建相关的开销 - 这是您首先使用池化。
Whether you're using a pooled or standalone connection, the process that executes your query is independent of any others and doesn't wait for any other queries to finish. If you're doing updates then that's not necessarily true - you may wait for another process to finish its own update - but if you're just querying then that isn't a factor.
无论您使用的是池连接还是独立连接,执行查询的进程都独立于任何其他进程,并且不会等待任何其他查询完成。如果您正在进行更新,那么这不一定是正确的 - 您可能会等待另一个进程完成自己的更新 - 但如果您只是查询,那么这不是一个因素。
You may get contention for resources, so two queries running at the same time might take slightly longer than either of them takes to run on their own, but they're still both running at the same time.
您可能会争用资源,因此同时运行的两个查询可能比它们单独运行所需的时间略长,但它们仍然同时运行。