Before you bring your application to a live (or even test) environment there are a number of different things you should check. Based on our experience with jZeno in production environments we've compiled a checklist that is hopefully useful to you.
I know... this is obvious - but you don't want to know how many people will forget about this in the midst of a go-live frenzy ! Specifically you want to have at least indexing on the foreign keys of one-to-many and many-to-many relationships, as well as on frequently used search criteria.
The application model we promote often results in side-objects being swizzled from the database before returning from a business facade to the presentation layer. To make your database access more efficient you should enable batch-fetching on most of your domain model classes (unless you have a good reason not to). It is very important to realize that you should specify something like batch-size="50" on the class tag in you hbm.xml files, as well as on the one-to-many and many-to-many relationships (that's on the list and set tags).
<class name="package.Booking" table="capacity.dbo.Booking" mutable="true" batch-size="50" >
<list/set name="preferredRoutings" lazy="true" cascade="all-delete-orphan" batch-size="50" >
This will make sure that when you do swizzle side-objects they will get loaded in a single SQL statement as much as possible. You don't want to issue a single select for each individual object. Hibernate will issue :
select * from XYZ where (id=1 or id=4 or id=8 or id=17 or ...)
when batch fetching is enabled.
When you swizzle your side objects through PersistencySupport.swizzle() (and you should), batch fetching will be optimized by doing breadth-first execution of all requested property-paths.
A lot of applications will reference a small and relatively fixed subset of it's data during a single execution period. In this type of database access it is beneficial to cache often-used objects in-memory. In order to do so you should add
<cache usage="read-write"/>
tags to your hbm.xml (in both the class tags, as well as the set/list/.. tags), and configure ehcache.xml correctly.
Objects that never change can be cached as well (<cache usage="read-only"/>
). And if you have objects that change very infrequently
you may want to still mark them read-only, with a time-out period that is acceptable. (if possible ofcourse).
We advise you to specify at the very least a global cache tag in ehcache.xml like this :
<defaultCache maxElementsInMemory="100000" eternal="false" timeToIdleSeconds="1800" timeToLiveSeconds="1800" overflowToDisk="false" />
This allows up to 100000 domain objects to be cached by hibernate, and each object will stay in the cache for a maximum of 30 minutes. Obviously you can gain better perfomance by configuring ehcache more fine-grain, as described on the ehcache site.
As described in the how-to on object creation, jZeno can largely take object creation away from the interactive request thread (which handles a web request from a user). If you take advantage of this, don't forget to activate this in your production/test environment (configuration.properties) :
use.precreation=true
The included servlet engine (winstone) that comes with the download is only intended for development/evaluation purposes. You should deploy to a servlet engine that is supported by your organisation. In most cases this simply requires you to copy your application folder to the deploy target folder of that container.
We use both Tomcat as BEA Weblogic, and we'll explain how we deploy to these 2 below :
Deploy to Tomcat 4.1
Most of our applications are running on Tomcat (every application on it's own tomcat instance - see below). In this case all you need to do is copy your application's web folder to tomcat's webapps folder and rename it to reflect the application's desired URL.
Deploy to BEA Weblogic 9
For deployment on BEA we first create a .WAR archive (ant WAR task) that contains the content of the application's web folder. We then deploy this on BEA by using the regular administrative web interface and upload the new WAR file to the server.