我正在用最新版本的Spring Boot编程一个应用程序.最近我的垃圾堆越来越大,无法回收.使用Eclipse MAT对堆进行的分析表明,在运行应用程序的一小时内,堆增长到630MB,Hibernate的SessionFact或yImpl使用了整个堆的75%以上.
Is正在查询计划缓存周围寻找可能的源,但我只找到了this个,但没有找到.属性设置如下:
spring.jpa.properties.hibernate.query.plan_cache_max_soft_references=1024
spring.jpa.properties.hibernate.query.plan_cache_max_strong_references=64
数据库查询都是由Spring的Query magic生成的,使用in this documentation这样的存储库接口.使用这种技术可以生成大约20个不同的查询.没有使用其他本机SQL或HQL.
@Transactional
public interface TrendingTopicReposit或y extends JpaReposit或y<TrendingTopic, Integer> {
List<TrendingTopic> findByNameAndSource(String name, String source);
List<TrendingTopic> findByDateBetween(Date dateStart, Date dateEnd);
Long countByDateBetweenAndName(Date dateStart, Date dateEnd, String name);
}
或
List<SomeObject> findByNameAndUrlIn(String name, Collection<String> urls);
as example f或 IN usage.
问题是:为什么查询计划缓存不断增长(它没有停止,它以一个完整的堆结束),以及如何防止这种情况?有没有人遇到过类似的问题?
版本:
- 弹簧靴1.2.5
- 冬眠4.3.10