-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Hibernate Query Plan Cache consumes a lot of memory
PostPosted: Tue Feb 14, 2017 7:29 pm 
Newbie

Joined: Tue Feb 14, 2017 7:19 pm
Posts: 2
Hi,

In Hibernate 4, it seems that by default query cache or second level cache are disabled.

But I still see a lot of memory being consumed by query plan cache(from memory analyzer)..any idea why the query plan cache could be consuming when the default says query cache disabled.

Thanks


Top
 Profile  
 
 Post subject: Re: hibernate query plan cache
PostPosted: Wed Feb 15, 2017 3:50 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1628
Location: Romania
What you're seeing there, it's not the second-level Query cache, but the HQL Query Plan Cache. The HQL Query Plan Cache is used to reuse the parsing phase of the entity query AST.

If the Query Plan Cache consumes a lot of memory, it could be because you are generating lots of HQL queries. Are you using bind parameters or every entity query contains the parameter values inlined? If you don't use bind parameters, you are risking SQL Injection attacks.

You can control the Query Plan Cache using the following two configuration properties:

1. hibernate.query.plan_cache_max_size
2. hibernate.query.plan_parameter_metadata_max_size

However, there's a trade-off between memory consumption and CPU, so make sure that you don't set those too low as you might turn your memory issue into a CPU bottleneck.


Top
 Profile  
 
 Post subject: Re: Hibernate Query Plan Cache consumes a lot of memory
PostPosted: Wed Feb 15, 2017 6:22 pm 
Newbie

Joined: Tue Feb 14, 2017 7:19 pm
Posts: 2
Thanks very much Vlad. Was able to see the changes reflect in plan cache.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.