[Building Sakai] Slow hibernate call

Sam Ottenhoff ottenhoff at longsight.com
Wed Jul 2 07:08:17 PDT 2014


It's often enlightening to see exactly what Hibernate is querying from your
database as it may very well be executing hundreds of queries to re-create
the desired Hibernate object.  I believe the easiest way to do this is to
turn on MySQL full query logging and then to step through the relevant
actions inside a tool like Samigo.  If you want a high-level overview of
the queries, you can use a tool like pt-query-digest from the free Percona
toolkit:

  http://www.percona.com/doc/percona-toolkit/2.2/pt-query-digest.html

Alternatively, you can use a tool like Yourkit and its SQL query profiling
to spot the most-executed calls.  My instinct is that your slow Hibernate
actions are really many SQL calls being made by Hibernate, but if you can
find one query that is slow either via logging or Yourkit, your next step
should be taking the query directly to MySQL and using the EXPLAIN function
to find out how MySQL is processing the query.


On Wed, Jul 2, 2014 at 10:02 AM, Paul Dagnall <pdagnall1 at udayton.edu> wrote:

> Hi
> I'm working on a Samigo custom and have come upon a bit of a performance
> issue.
>
> I call publishedAssessmentService.getPublishedAssessment(string).
> Eventually this method calls...
>
> List sectionList = getHibernateTemplate().find(
>                 "from PublishedSectionData s where
> s.assessment.publishedAssessmentId=? ",
>                 assessment.getPublishedAssessmentId());
>
> This hibernate call is taking up to 5 seconds to execute. The query:
>
> select * from SAM_PUBLISHEDSECTION_T where ASSESSMENTID = 478438
>
> ... will return results immediately.
>
> Any ideas?
>
> Paul Dagnall
> Application Developer & Administrator
> University of Dayton
>
>
> _______________________________________________
> sakai-dev mailing list
> sakai-dev at collab.sakaiproject.org
> http://collab.sakaiproject.org/mailman/listinfo/sakai-dev
>
> TO UNSUBSCRIBE: send email to
> sakai-dev-unsubscribe at collab.sakaiproject.org with a subject of
> "unsubscribe"
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://collab.sakaiproject.org/pipermail/sakai-dev/attachments/20140702/5dc21465/attachment.html 


More information about the sakai-dev mailing list