-->
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.  [ 2 posts ] 
Author Message
 Post subject: Large query strings in the cache using a lot of memory
PostPosted: Tue Feb 02, 2010 5:40 pm 
Beginner
Beginner

Joined: Thu Jun 21, 2007 1:47 pm
Posts: 46
I've been debugging the memory use of our application and I found that in some cases hibernate generated some pretty extensive SQL queries, up to 40KB in length.

These strings go into the query cache as keys and use a lot of memory (potentially). It's also not necessary for the queries to be so big - they're a symptom of mapping errors gone unnoticed that were resulting in really big query strings.

Although I can find these by looking at a heap dump or by turning on query logging on the database and sort of manually scanning for really long lines, I'm wondering if anyone has some ideas on how to automatically detect and log queries over a certain size.

I've tried adding a listener on the ehcache itself, but since all the fields of the hibernate QueryKey are private I have to use toString() to check the length, which would result in some overhead on each use of the cache. Maybe not the worst thing in the world, but...

Does anyone know another good place to hook into this and automatically detect these large queries, or even better detect mappings that will result in over-zealous deep fetches?


Top
 Profile  
 
 Post subject: Re: Large query strings in the cache using a lot of memory
PostPosted: Wed Feb 03, 2010 6:17 pm 
Expert
Expert

Joined: Tue May 13, 2008 3:42 pm
Posts: 919
Location: Toronto & Ajax Ontario www.hibernatemadeeasy.com
I've never seen anything that logs the queries by size. :(

_________________
Cameron McKenzie - Author of "Hibernate Made Easy" and "What is WebSphere?"
http://www.TheBookOnHibernate.com Check out my 'easy to follow' Hibernate & JPA Tutorials


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.