Uploaded image for project: 'Hibernate ORM'
  1. Hibernate ORM
  2. HHH-1810

Classic query parser inefficiency on WebLogic

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Rejected
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: query-hql
    • Labels:
      None
    • Environment:
      Hibernate 3.0.5 with HHH-525 patch
      WebLogic 8.1 SP4
      SQL Server 2000 SP3
    • Last commented by a user?:
      true

      Description

      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

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: