-
1. Re: Performance problem with returning values from Stateless
mijez Apr 13, 2006 3:55 PM (in response to mijez)I'll try explain my problem. Sorry about my english:)
Here is method from my Stateless Session Bean:
.......
public Calculation getCalculationWithMappings(Long idCalculation) {
log.info("getCalculations START ");
Calculation calc = (Calculation) em
.createQuery(
"from Calculation calc where calc.idcalculation = :idcalculation")
.setParameter("idcalculation", idCalculation).getSingleResult();
for (Section section : calc.getSections())
for (Item item : section.getItems())
item.getItementries();
log.info("getCalculations STOP");
return calc;
}
================
Entity beans:
@Entity
@Table(name = "CALCULATION")
public class Calculation implements java.io.Serializable {
.... cut.....
@OneToMany(cascade = { CascadeType.ALL }, fetch = FetchType.LAZY, mappedBy = "calculation")
@OrderBy("idsectionincalc")
public List getSections() {
return this.sections;
}
+++++++++++++++++
@Entity
@Table(name = "SECTION", )
public class Section implements java.io.Serializable {
...cut
@OneToMany(cascade = { CascadeType.ALL }, fetch = FetchType.LAZY, mappedBy = "section")
@OrderBy("iditemincalc")
public List getItems() {
return this.items;
}
++++++++
And deeper - > in Item itementries, in every itementry - rmsInstance, In rmsInstance collection mapping with fetch type EAGER.
.......
In my backing bean:
CalculationAction ca = null;
try {
InitialContext ctx = new InitialContext();
ca = (CalculationAction) ctx
.lookup("WorkMonitor/CalculationActionBean/local");
} catch (Exception e) {
log.fatal("CalculationActionBean", e);
}
Calculation newCalc = ca.getCalculationWithMappings(...some Long value);
log.info("initCalculationTree START");
initCalculationTree(newCalc);
And here is most important:
21:13:17,331 INFO [CalculationBean] selectCalculation START
21:13:17,346 INFO [CalculationActionBean] getCalculations START
21:13:18,206 INFO [CalculationActionBean] getCalculations STOP
21:13:30,253 INFO [CalculationBean] initCalculationTree START
Whay returning this value takes so long. Fetching calculation from DB is fast ( value before getCalculations STOP and START) -
2. Re: Performance problem with returning values from Stateless
mijez Apr 14, 2006 2:14 AM (in response to mijez)I'm trying to solve this, but now I think its a problem with returning huge values.
Container process takes up 100% cpu-time for 12 seconds. It seems like the container is doing some heavy calculations before control is passed back to the client - value is return.
I think this may be a BUG!!! Can anybody verify this? -
3. Re: Performance problem with returning values from Stateless
mijez Apr 17, 2006 3:08 AM (in response to mijez)Do I have to post it to JIRA?
-
4. Re: Performance problem with returning values from Stateless
bdecoste Apr 17, 2006 12:01 PM (in response to mijez)Can you post (here or JIRA) all of your source and I'll take a look.
-
5. Re: Performance problem with returning values from Stateless
mijez Apr 17, 2006 2:46 PM (in response to mijez)Ok I found explanation for this long returning time. Now, because I only read from DB, I annotated my method in Stateless Session Bean with:
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
Now, it's working quite fast. Thanks anyway.