EJB Performance issue

Hi,

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?  
kmapperAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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.
0
sunray_2003Commented:
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.

0
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?

Tanx
0
sunray_2003Commented:
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.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java EE

From novice to tech pro — start learning today.