我需要在我的(grails)Web应用程序中使用C3P0共享库吗? [英] Do I need to use C3P0 pooling library in my (grails) web application?

查看:88
本文介绍了我需要在我的(grails)Web应用程序中使用C3P0共享库吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对连接池库并不熟悉。我刚刚通过博客文章发现它),我不确定我应该使用基于grails / hibernate / mysql的web应用程序。



所以我的问题很简单:在哪种情况下你会建议将连接池库集成到grails应用?永远,永不,或只有超过一些连接的门槛?



:如果您曾在您的Web应用程序中成功使用过C3P0,那么我将非常感谢您听取您的反馈意见(就可见的积极效果而言)。

解决方案 div>

无论哪个池实施,您都应该在您的Web应用程序中始终使用连接池。打开与数据库的连接是一项非常昂贵的任务,能够重复使用已经存在的空闲连接,极大地提高了您的网站性能。



连接可以由应用程序服务器(Tomcat,JBoss,Glassfish ...)或您的应用程序。后者更容易设置,但每个部署都很难定制。在应用程序上配置连接池并设置您的网站使用它可以轻松调整连接池参数,例如:最小连接数保持打开,最大空闲时间等等。


I am not familiar at all with connection pooling library. I've just discovered it through this blog article) and I am not sure that I should use one in my web application based on grails/hibernate/mysql.

So my question is simple : in which situations would you suggest to integrate a connection pooling library into a grails application? Always, Never or only over some connections threshold?

P.S. : If you have ever used successfully C3P0 in your web application, I will greatly appreciate to hear your feedback (in terms of visible positive effects).

解决方案

Regardless of which pooling implementation, you should use a connection pool always in your web application. Open a connection with the database is a very expensive task and being able to reuse a already existing and idle connection greatly improves your site performance.

A connection can be managed by the application server (Tomcat, JBoss, Glassfish...) or by your application. The latter is easier to setup but it's hard to customize per deployment. Configuring a connection pool on the application and setting your site to consume it makes easy to the fine tune the connection pool parameters, like: minimum connections to keep open, max idle time and so on.

这篇关于我需要在我的(grails)Web应用程序中使用C3P0共享库吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆