• 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

EJB vs. Object Pool

 
slicker
Posts: 1108
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I currently use ojbect pools, (~30K composite objects, 20 total in pool), to transactions and no security issues. (I need large StringBuffers to capture xml inquiry, build xml response, compress response, etc.)

Is there a point to use EJB here? We use the object pools b/c we REALLY need speed. Unfortunately, although we get speed, we also get a nice memory leak from the pools. We currently are hitting 2million req per day and should eventually hit 3mil.

I guess my real question is: Can EJB be used solely as a way to re-use memory? Are there third party Ojbect pools that I would benefit from more instead?

Thanks for any help!
 
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I do not know mcuh about EJB's.But still I would like to put my view regarding this.Please correct me if I am wrong.

Apart from pooling of the beans , EJB provide many functionalities and transaction support to the application.It should be carefully used in application , which would really use a lot of features of EJB ,not just for pooling.
If only used for pooling then normal pooling would be better than EJB's.
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

we also get a nice memory leak from the pools.


What have you observed that makes you so sure it is the pools that are causing memory leaks?? After all, there are plenty of other ways to "leak" memory.

Bill
 
John Dunn
slicker
Posts: 1108
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Bill.

A long time ago, we removed all creation of objects that occur during an Inquiry/Request pass. So we basically we have everything we need up front. I'm pretty certain our problem lies in the final
StringBuffer.toString() call that creates underlying new objects, AND on the opening of Streams to pass data back to a client. I don't think these composite objects we use to store all our needed objects, get gc-ed b/c, the pool of objects never die. I'm using iPlanet 6.0, and they warn you against using pools, but we absolutely must have the speed, so we were willing to live with the trade offs. Well as much as I need the speed I also need to consider handling another 1 million requests, so I'd like the same speed with a set up that can correct g/c the shared objects I use.
Could Spring help out here?
 
William Brogden
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I'm pretty certain our problem lies in the final
StringBuffer.toString() call that creates underlying new objects, AND on the opening of Streams to pass data back to a client. I don't think these composite objects we use to store all our needed objects, get gc-ed b/c, the pool of objects never die.



toString() creates just one String - assuming thats a local variable it will be eligible for GC as soon as the method exits. Are you sure Streams are closed correctly?

How do you provide for reseting variables in a pool object when it has finished a response?

Bill
reply
    Bookmark Topic Watch Topic
  • New Topic