We have been using Weblogic EJB's in a clustered environment and have done some simple benchmarks comparing that to a Hibernate/Swarmcache implementation.
So far I have been impressed with Hibernate performance for most of the tests - it outperforms the WL implementation except for finders that return multiple rows from the database - for example find all records in a 5000 row table is at least 30% slower than Weblogic.
It would be great to beat Weblogic in all tests. We have not profiled Hibernate to find where it is spending its time - but I wonder if anyone has any ideas for the slowdown - is this a known issue?
We are using version 2.1
The mapping is very simple - there are no relations - each table is separate. Here is the mapping:
Code:
<class name="APIRW" table="API" discriminator-value="0">
<cache usage="nonstrict-read-write" />
<id name = "apiId" column="id" unsaved-value="null">
<generator class="net.sf.hibernate.id.TableHiLoGenerator">
<param name="table">id_gen</param>
<param name="column">entity_id</param>
</generator>
</id>
<property name="apiName" column="api_name" type="string" />
<property name="description" column="description" type="string" />
<property name="isGenerallyAccessible" column="is_generally_accessible" type="boolean" />
<property name="authorizeDefaultRole" column="authorize_default_role" type="boolean" />
<property name="creationTime" column="creation_time" type="timestamp" />
<property name="lastUpdateTime" column="last_update_time" type="timestamp" />
<property name="whoModified" column="who_modified" type="string" />
</class>
Here is the relevant block of code
Code:
public List findAllObjects() throws PersistenceException {
List objects = new ArrayList();
Session session = null;
try {
session = sessionFactory.openSession();
objects = session.find("from s in class " + className);
} catch (HibernateException e) {
throw new PersistenceException(e);
} finally {
if ( null != session ) {
try {
session.close();
} catch (HibernateException e1){
throw new PersistenceException(e1);
}
}
}
return objects;
}