From: Hemanta G. (JIRA) <no...@at...> - 2006-06-02 03:49:16
|
Classic query parser inefficiency on WebLogic --------------------------------------------- Key: HHH-1810 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1810 Project: Hibernate3 Type: Improvement Components: query-hql Environment: Hibernate 3.0.5 with HHH-525 patch WebLogic 8.1 SP4 SQL Server 2000 SP3 Reporter: Hemanta Gupta Priority: Minor Attachments: QueryTranslatorImpl.java With around 1600 named queries in the system, SessionFactory.checkNamedQueries() takes around 5 1/2 min on WebLogic 8.1, as compared to < 1/2 min on JBoss 4.0.3. The classic query translator is being used, mainly because the new AST based translator has issues on WebLogic (http://hibernate.org/250.html#A24). The issue boils down to the classic query parser trying to load bad class names on a system with relatively inefficient classloading. The parser breaks down queries into tokens and then tries to resolve many of the tokens (even the obviously 'bad' ones like '=', '(', ')', 'AND', 'OR', etc) as Java classes by calling ReflectHelper.classForName() on the tokens. Because of the way the method is written, ClassLoader.loadClass() and then Class.forName() will both be called before it can be determined that a token doesn't resolve to a Java class. This overhead is really killing performance on WebLogic. I patched QueryTranslatorImpl.getEntityPersisterUsingImports(String) to skip tokens which can't resolve to Java classes (i.e are not Java identifiers or are HQL keywords). The file is attached. After applying this patch, the time taken by SessionFactory.checkNamedQueries() went down to around 20 sec on WebLogic. The patch isn't too beautiful or exhaustive, but it did the trick on our environment. Please also see the forum thread at http://forum.hibernate.org/viewtopic.php?t=943427 -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |