连接池大小与并发请求数
我必须开发一个高可扩展的Web服务,但连接池大小(Oracle DB)设置为50。
拥有这个大小意味着服务的并发请求数将最大为50,否则将没有新的连接可用,对吗?
但是通过配置,Weblogic 或 Glassfish 服务器是否可以同时接受超过 50 个请求?
我读到服务器接受“排队”的请求,直到线程处理它们。
关于“可扩展性”我也有一个问号,因为平均数据库调用需要 1.2 秒。 + 肥皂开销...==>每次呼叫响应时间为 2.3 秒。
我可以估计服务器将支持多少个并发用户(Weblogic 或 Glasfish 4gb)?
谢谢
I have to develop a high scalable webservice, but the connection pool size (Oracle DB) is set to 50.
Having this size means that the number of concurrent request served will be max 50 ,otherwise the no new connections will be available right ?
But by configuration is possible for the Weblogic or Glassfish server to accept more then 50 requests simultaneously ?
I read that the server accepts the request which are 'queued' until a thread is handling them.
Regarding 'scalability' I have a question mark as well because the average DB calls take 1,2 sec. + the soap overhead...==> in a 2,3 sec response time on each call.
Can I estimate how many concurrent users the server will support (Weblogic or Glasfish 4gb) ?
Thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
池中最多有 50 个连接并不意味着您一次只能处理 50 个用户。每个页面请求都应该生成可以相互交错的查询:因此,虽然您一次只能运行 50 个查询,但应该能够处理更多的页面请求。确保仅短时间连接到数据库会有所帮助。
使用连接池主要是为了避免一直建立新连接的成本(加上准备好的语句被缓存等),因此目的是尽可能频繁地重用它们。
当你说平均数据库调用需要 1.2 秒时:如果这是一个查询,我认为你想查看查询或表索引以减少这个时间(否则我担心你无论如何都会遇到可扩展性问题),但如果是多个查询,那么它们应该很高兴地与其他请求交错。
至于排队:weblogic 将对查询进行排队,但您可以设置超时,以便在设定的时间后查询未完成而返回。然后,您可以决定重试或告诉用户系统正忙,也许稍后再试。
Having a maximum of 50 connections in the pool doesn't mean you can only handle 50 users at any one time. Each page request should generate queries that can interleave with each other: so while you can only have 50 queries running at any one time, should be able to handle many more page requests. This can be helped by making sure you only connect to the database for short periods.
The use of connection pools is primarily to avoid the cost of setting up new connections all the time (plus prepared statements are cached etc.), so the intention is to re-use them as frequently as possible.
When you say the average DB call takes 1.2 secs: if this a single query I think you want to look at the query or table indexes to reduce this time (otherwise I'm afraid you are going to get scalability problems no matter what), but if it is multiple queries then they should interleave with other requests quite happily.
As regards queuing: weblogic will queue queries, but you can set a timeout so the query is returned unfulfilled after a set time. You can then decide to try again or tell the user the system is busy and perhaps try again later.
当您谈论 Web 服务时,您需要在连接池和并发请求之间保持最佳平衡。对于这个概念,您可以参考:https://dzone.com/articles/optimum -数据库连接池大小
When you are talking about web service, you need to keep a optimum balance between your connection pool and concurrent requests. For the concept you can refer: https://dzone.com/articles/optimum-database-connection-pool-size