Hibernate 3.5.0会导致极端的性能问题(Hibernate 3.5.0 causes extreme performance problems)

编程入门 行业动态 更新时间:2024-10-24 22:18:02
Hibernate 3.5.0会导致极端的性能问题(Hibernate 3.5.0 causes extreme performance problems)

我最近从hibernate 3.3.1.GA更新到hibernate 3.5.0,我遇到了很多性能问题。 作为测试,我向我的数据库添加了大约8000个实体(这反过来导致其他实体被保存)。 这些实体以20个批次保存,因此出于性能原因,事务不会太大。

当使用hibernate 3.3.1.GA时,所有8000个实体在大约3分钟内保存。 使用hibernate 3.5.0时,它的启动速度比使用hibernate 3.3.1慢。 但它变得越来越慢。 在大约4,000个实体中,有时需要5分钟来保存一批20个。如果我然后转到mysql控制台并从mysql通用查询日志中手动输入一个insert语句,其中一半在0.00秒内运行完美。 其中一半需要很长时间(可能是40秒)或超时“ERROR 1205(HY000):超过锁定等待超时;尝试从MySQL重启事务”。

在我应该注意的3.5.0版本的hibernate事务管理中有什么变化吗? 我改变以体验这些无法解决的性能问题的唯一方法是替换以下hibernate 3.3.1.GA jar文件:com.springsource.org.hibernate-3.3.1.GA.jar,com.springsource.org.hibernate.annotations- 3.4.0.GA.jar,com.springsource.org.hibernate.annotations.common-3.3.0.ga.jar,com.springsource.javassist-3.3.0.ga.jar与新的hibernate 3.5.0发布hibernate3 .jar和javassist-3.9.0.GA.jar。

谢谢。

I've recently updated from hibernate 3.3.1.GA to hibernate 3.5.0 and I'm having a lot of performance issues. As a test, I added around 8000 entities to my DB (which in turn cause other entities to be saved). These entities are saved in batches of 20 so that the transactions aren't too large for performance reasons.

When using hibernate 3.3.1.GA all 8000 entities get saved in about 3 minutes. When using hibernate 3.5.0 it starts out slower than with hibernate 3.3.1. But it gets slower and slower. At around 4,000 entities, it sometimes takes 5 minutes just to save a batch of 20. If I then go to a mysql console and manually type in an insert statement from the mysql general query log, half of them run perfect in 0.00 seconds. And half of them take a long time (maybe 40 seconds) or timeout with "ERROR 1205 (HY000): Lock wait timeout exceeded; try restarting transaction" from MySQL.

Has something changed in hibernate's transaction management in version 3.5.0 that I should be aware of? The ONLY thing I changed to experience these unusable performance issues is replace the following hibernate 3.3.1.GA jar files: com.springsource.org.hibernate-3.3.1.GA.jar, com.springsource.org.hibernate.annotations-3.4.0.GA.jar, com.springsource.org.hibernate.annotations.common-3.3.0.ga.jar, com.springsource.javassist-3.3.0.ga.jar with the new hibernate 3.5.0 release hibernate3.jar and javassist-3.9.0.GA.jar.

Thanks.

最满意答案

即使我在Hibernate 3.5.0-Final中可以看到与事务管理相关的一些内容,你所描述的内容肯定不正常(我找不到任何有关此类问题的公开问题)。 所以,虽然没有看到任何代码很难说什么,但如果你改变的唯一的东西是Hibernate工件的版本,那么很可能在某处有回归。

我建议创建一个没有任何Spring东西的测试用例来隔离Hibernate的任何潜在问题(无论如何你都需要报告问题)。

Even if I can see a few things related to transaction management in Hibernate 3.5.0-Final, what you're describing is certainly not normal (and I can't find any open issue about such a problem). So, while it's hard to say anything without seeing any code, if the only thing you changed is the version of Hibernate artifacts, then there is very likely a regression somewhere.

I suggest to create a test case WITHOUT any Spring stuff to isolate any potential problem with Hibernate (that you'll need anyway to report the problem).

更多推荐

本文发布于:2023-08-06 21:08:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1455004.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:性能   Hibernate   problems   performance   extreme

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!