English 中文(简体)
Web 应用程序的休眠会话连接关系
原标题:Hibernate session connection relationship for Web application

我是一个冬眠的新人,

从下面的链接,

Hibernate Session Connection Relationship I understood that one hibernate session object will hold one connection object.

所以,我的怀疑是,如果我把我的连接池大小配置为服务器上的 10 个大小。 在应用程序中,只有 10 个人可以同时工作吗?

如果我错了 请纠正我

最佳回答

部分是的。 这意味着只有10个 SQL 查询可以同时执行。 如果11个客户在同一时间访问同一页,而且大部分时间花在一些长期的 SQL 查询中,那么第11个客户很可能要等其余10个客户中的一个完成。

但这并不意味着您的应用程序仅限于10个会话/客户 。 例如, 在网络应用程序中, 用户通常打开一个页面, 浏览一段时间, 点击链接等 。 如果您的用户花费9 秒阅读页面, 1秒等待下一页, 那么只有10%的时间花在服务器上 - 因此您可以在用户中处理 100 个登录 。

此外,处理请求不仅涉及 SQL 查询。 发送数据、 解析、 转换... ---- 这需要时间 。

因此,基本上,你仅限于10个同时的 SQL 查询,但这意味着10x 或可能100x 以上的用户可以使用您的应用程序。

问题回答

对,但这并不限制用户数量为10个,因为在一个典型的应用程序中,用户点击链接,导致连接使用几毫秒(加载页面的时间),然后对页面看几秒或几分钟。

所以,如果空闲时间与忙碌时间的比率平均为100, 你可以期望有1000个用户共享你的游泳池中的10个连接, 一切都应该很好( 当然这是一个近似值, 不考虑连续、 长期的任务等等, 但是你明白这个想法 ) 。

总起来说:用户仅在交易期间使用连接,交易时间应该非常短(尽可能短 ) 。 这使得许多同时使用的用户成为可能。





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签