Hi guys, I have a really serious problem so any input from you is greatly appreciated. I am using as an application server JBoss 3.0.0 and Oracle9i as a Database. Changing the app server is not possible. I have a very long time consuming process which eventually ends with the exception: 11:03:51,921 ERROR [LogInterceptor] TransactionRolledbackException, causedBy: java.lang.OutOfMemoryError 11:03:51,921 ERROR [STDERR] java.rmi.RemoteException: null; nested exception is: java.lang.OutOfMemoryError Embedded Exception null; nested exception is: java.lang.OutOfMemoryError 11:03:51,921 ERROR [STDERR] at it.deltadator.common.util.IdGenerator.getId(IdGenerator.java:33) 11:03:51,921 ERROR [STDERR] at t.deltadator.cdg.be.consuntivo.ejb.ses.ManagerCompetenziazioneBean.saveCompetenziazione(ManagerCompetenziazioneBean.java:146) 11:03:51,968 ERROR [STDERR] at it.deltadator.cdg.be.consuntivo.ejb.ses.ManagerCompetenziazioneBean.executeCompetenziazioneConsuntivo(ManagerCompetenziazioneBean.java:287) ................. Let me explain you the usecase. I have two tables A and B. In table A there are two columns: DateStart and DateEnd. Let's assume I have a record in table A with DateStart= '1 January 2004' and DateEnd = '1 July 2004'. For each day occuring between these two dates, I have to create a record in table B. So using this example, I have to create around 180 records inside table B (31 for January, 29 for February,..., 30 for June, 1 for July).
The problem appears when I have hundreds of records inside table A. Imagine that for 1000 records inside table A with DateStart= '1 January 2004' and DateEnd = '1 July 2004' I have to create 180 * 1000 = 180.000 records inside table B!!! I can see why JBoss runs out of memory. I have to tell you that for each record inside A is started and ended a transaction. So there is no global transaction. I would like to hear from you some ideas about how to implement this usecase. Currently it's using Business Delegate + Session Bean + Entity Beans. In my opinion it's better to put everything inside a Stored Procedure and just call that, but the client wants to see the progress (a progress bar with a message like "101st from 200 processed...")and that's why we are using this architecture. As a temporary solution we've increased the memory allocated for the JVM but I want to find a better solution. Thanks for all your suggestions. Sergiu.
Hi, I don't think the problem is with JBoss. It would be nice if you code show the code where u have done db operations. ur code might be creating some extra objects/too many connections r geting opened. there can n no. of possiblities. cheers , neeraj.
When you have this kind of "batch processing" it is always better to uses direct JDBC call which actually transfers considerable data caching to the database, though your JVM / App server still have to maintain the objects that are still referenced but will occupy less memory space than the EJB's (as you know each ejb object created has a lot of memory over head). You can also do it with a DB stored procedure and still display the progress to the client by making a RMI call from the oracle database to your application by embedding a RMI client java function in the database but the process may be bit tedious (or may be not ... if you try it let me know).
posted 16 years ago
Actually I have proposed a solution like this: BusinessDelegate ----> Stored Procedure(pk_record_tableA) so for each record from tableA I call this stored procedure. This way I still can inform the user about the progress of the usecase. I know this couples the application with the database but the price is so small if we think to the performance we gain. I'm told to stick to CMP for now. Maybe in the future... Thanks guys. [ January 24, 2004: Message edited by: sergiu truta ]
...watch me...as I'm walking the path...
sunglasses are a type of coolness prosthetic. Check out the sunglasses on this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop