Grails MySql进程列表

i have a grails application with a webflow. I store my inner flow objects of interest in the converstaion scope. After entering and leaving the flow a few times, i see that the single user connected to the DB (MySql) generates a lot of threads on the MySql Server which are not released. The processlist in mysql show me the threads in sleeping mode and a netstat on the client shows me established connections to the mysql server. I assume the connections are held active and not released. But why is that? What do grails exactly do when entering and leaving a flow? Why are so many connections opened and not closed?

Any help would be appreciated.

regards, masiar

#0

Grails uses hibernate, which in turn uses connection pooling; these are idle connections, waiting for traffic.

You can learn more about Hibernate's connection pooling at: https://www.hibernate.org/214.html

This is actually desirable behavior; it can take a non-negligible amount of time to open a new connection, much more time than it takes to send a query down an open one.

"Premature optimization is the root of all evil" - unless you are seeing a performance problem related to the database, I'd leave this alone.

#1

Think of the hibernate pooling like a steady and ready pool of cars having their engines turned on at all time for you or your buddies to jump in and go to anywhere you want..., well no, to the database. No need to wait for a taxi or to jump start your own car before you are up and running... all good here

Conversations are meant to stick around as long as they are needed. Often you dive down into workflows and upon finishing them, you return to your old, and thus still alive conversation. It is meant like that... all good here too

推荐文章

声明没有var关键字的变量

声明没有var关键字的变量

推荐文章

将java与c结合

将java与c结合

推荐文章

android honeycomb-如何识别键盘已切换到符号/数字模式?

android honeycomb-如何识别键盘已切换到符号/数字模式?

推荐文章

在同一个echo命令中的元素上鼠标悬停时在php的echo命令中显示元素

在同一个echo命令中的元素上鼠标悬停时在php的echo命令中显示元素

推荐文章

公共方法中的私有参数

公共方法中的私有参数

推荐文章

用gnuplot python绘制线

用gnuplot python绘制线

推荐文章

SQLite中的PRAGMA table_info('mytable')是否有等效的SELECT语句?

SQLite中的PRAGMA table_info('mytable')是否有等效的SELECT语句?

推荐文章

德尔菲:异或,十六进制,加密

德尔菲:异或,十六进制,加密

推荐文章

C++ Linux/shell脚本运行子进程并获取它们的返回状态

C++ Linux/shell脚本运行子进程并获取它们的返回状态

推荐文章

带有继承的奇怪扩展方法问题

带有继承的奇怪扩展方法问题

推荐文章

NET如何在LINQ“select new”中确定相等的对象?

NET如何在LINQ“select new”中确定相等的对象?

推荐文章

即使在停止传播后,mouseenter事件也调用了两次

即使在停止传播后,mouseenter事件也调用了两次

推荐文章

iScroll和固定文档问题

iScroll和固定文档问题

推荐文章

通过VBA将HTML复制到Word,剪贴板将丢失特殊字符

通过VBA将HTML复制到Word,剪贴板将丢失特殊字符

推荐文章

在iOS网络视图中添加Facebook的Like按钮

在iOS网络视图中添加Facebook的Like按钮

推荐文章

有没有办法让顶级的班级成为私人的?

有没有办法让顶级的班级成为私人的?