I have a table whose content I'd like to keep mostly cached. Its rarely updated and the environment isn't clustered. The table doesn't contain more than 5000 elements and right now contains 1276 elements (it has only 5 columns).
Anyway we have an entity bean whose appropriate methods are read-only (not all methods) and it is marked as a cached entity. On this bean I have a home method that invokes a findAll() query and converts every bean to a transfer object. This operation takes 10 seconds...
So I placed output in every point:
1. The database gets a single query that seems to be effcient enough to a none DBA:
"DECLARE JDBC_CURS_1 CURSOR FOR SELECT t0_a.name, t0_a.minimumAmount, t0_a.medicalName, t0_a.comment FROM drug t0_a; FETCH FORWARD 5000 FROM JDBC_CURS_1;"
Its possible that the cursor is an expensive operation?
2. The method that converts the fields to a transfer object takes anything between 0 and 1 millisecond!
3. The invocation of the transfer method via the Local interface takes anywhere from 2 - 39 milliseconds!
I'd assume 3 is the cause since if you take an average time of 8-10 milliseconds you get pretty much the result I've seen.
Anyway I am aware that a Local bean call has overhead (for transaction+ security etc...) however this seems a bit much especially when the call is local to the bean itself? Am I missing something? Is this the type of performance I should expect from entity beans?
BTW I assume the bean is configured correctly since the queries in the DB seem right.
Forgot to mention... I'm using JBoss 3.0.6 but I tested this issue on 3.2.1 and the problem is also there. I am using Postgresql database with the latest development drivers that seem to be the only thing that actually works with postgres.