• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 383
  • Last Modified:

EJB Performance issue


I have a XML file containing about 20K person names.
For each person I need to perform some update in my DB.
Then, when if the entire process completed successfully, I need to change a perform a final update in the DB. (I set a status - successfull)

The problem:
If I try to do all the process (20k persons) in a single transaction, I get a timeout exception.
So I splitted the TX in many small TX. One Tx per person.
Now, calling 20k EJB in a loop cause my application to slow down dramatically!!

Some guy told me to use a msg driven bean, but I dont see how this will solve my problem. Since I need to keep a trace of whats going on in my entire process in order to set the status (suddess/fail).

Someone have an idea?  
  • 2
1 Solution
Dejan PažinHead of SW DevelopmentCommented:

Calling them in a loop is certainly no good.

You can increase the timeout value. It wont speed up the process, but the client will wait for the reposnse, it wont throw the timeout exception.
You can set a buffer limit. Say parse 1000 persons from the XML file and make an EJB call for 1000 update. After it is completed, proceed with the second call. 1000 is just a number. You can choose a buffer size depending on your app server/ db/application performance.

kmapperAuthor Commented:
Well, ok, but how do I deciede wether 1000 is correct or not. If the server slows down, maybe this number would need to be 100..
If I decide to process 100 persons at every call, then I still make 250 EJB call which is too much...

I'm starting to think about bypassing the persistence framework and go against the DB via JDBC, how does it sound to you guys?

That certainly is a great approach. If your EJB does not have any complex business logic and if all that you are doing is updating several rows you can even consider using PLSql.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now