• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Incrementally decreasing performance in EJB3

 
Ranch Hand
Posts: 144
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi guys,

I've run into an odd issue. I have a method that persists a rather complicated entity object (multiple OneToOne, OneToMany and ManyToMany relationships to other entities, all of which fetchtype.LAZY, no cascading).

Now, if I call that method 1000 times in a row it gets increasingly slow. Is there any known issue with EJB3 entity persistence that I should be aware of? I've read some things about FlushMode.AUTO being the issue but that seemed to be JBoss specific.

Any input would be much appreciated.
 
Ranch Hand
Posts: 2187
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Now, if I call that method 1000 times in a row it gets increasingly slow.


Post the code of the method you are calling.

Please explain how you call the method 1000 times. How long does the method take to execute on the fifth time? How long does it take on the 1000th time?
[ July 16, 2008: Message edited by: James Clark ]
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It is not a good idea to fetch all the 1000 records and store it in to a HttpSession object. if you are doing like this the definitely you will get the performance issue.
You can do

1. restrict the number and size of the retrieving data.
2. suppose you restrict it to 100 but you need 1000 then you have to hit the data base 10 times.
3. use refersh() after each flush() method.
4. Use some valuable pool size also.
 
R van Vliet
Ranch Hand
Posts: 144
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi guys,

Thanks for the replies, I was ill the past week hence the slow reaction.

The code of the method is something like this (cant paste the actual code, NDA etc.) :



So, extremely basic, there are 4 @OneToOne, 1 @OneToMany and 2 @ManyToMany annotions present in the entity, all correctly mapped, no cascading, all lazy.

Performance of the method goes up slowly :



The call is done in a for loop within a unit test. I really think it has something to do with flushmodes. If I use COMMIT instead of AUTO the problem is gone, but I'd still like to know why this happens.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic