Discussions

Performance and scalability: Servlets/JDBC vs. servlets/EJB performance comparison/benchmark

  1. I have a PHB who believes that EJB has no ___performance___ benefit against straightforward servlets/JSP/JDBC. Personally, I believe that EJB is more scalable instead of using JDBC with servlets/JDBC with conneciton pooling.

    However, I am at a lost on how to prove it. There is all the theory, but I would appreciate it if anyone has benchmarks or comparison of servlets/JSP/JDBC and servlvets/JSP/EJB performance, assuming that they were tasked to do the same thing ( e.g. performance the same SQL statement, on the same set of tables, etc. ).

    Or some guide on how to setup such a benchmark and prove it internally.

    In other words, the PHB needs numbers, showing performance and scalability.

    Thanks
  2. Maybe both your PHB and you are right, EJB has no
    performance benefit but is more scalable...
    BTW,what is PHB stand for?
  3. I thnk you are confused here and you are comparing apples to oranges. JDBC is the java based database connection tool. EJB is something totally different. Using EJB will not mean that you will get rid of JDBC!

    Secondly, anything that scales better then anything else is ipso facto faster. You may see a speed difference under a small load, but under a large load, the better scaling technology will show better performance. it is a tradeoff: better performance now with a lower user ceiling or somewhat slower performance now but much better performance under a load.

    Ben Ricker
    System Administrator
    US-Rx, Inc.
  4. I can't agree. EJB is no more scalable than servlets+JDBC, and as a matter of fact it is a lot less scalable if done incorrectly. The container services such as object pooling, TX and security management add quite a bit of overhead, compared to plain vanilla JDBC. Having said that, the price is generally worth paying for for many people.
  5. Eric,
     I think you are confused about scalability and performance,
    agree with Ben's second point.
  6. I fully understand the difference between scalability and performance. I can agree that stateless session beans are more scalable than regular Java classes because of object instance pooling, but I am not sure how much more scalable stateful sessions are compared to Java classes cached in HTTP session. As for entity beans, without using proprietary optimzation schemes implemented by app server vendors the overhead is pretty large.
  7. how much more scalable stateful sessions are compared to >Java classes cached in HTTP session.

    There is nothing to prevent application server to implement
    object pooling for stateful session beans.

    >As for entity beans, without using proprietary optimzation >schemes implemented by app server vendors the overhead is >pretty large.
    That's what EJB created for..encapsulate the complexity.. free the developers and let the app server do their job...
  8. Well, maybe you can share with us the logical reasons or your personal experiences on this paradox we have here.

    So you say that Servlets with EJBs don't have better perfomance than Servlets with JDBC but neverthelesss they "scale" better.

    Well, it doesn't make much sense to me.

    Cheers,
    Costin
  9. Well,to me it is a common sense...otherwise why are we talking about EJB on TheServerSide?

    lol

  10. Well, common sense is a very tricky thing.

    The reality is that EJBs don't scale better, by their design they waste a lot of performance in the hope you'll get other nice things, and they are awfully immature.

    To say that EJbs scale better, well, that's really something to lol at.

    Who ever said he's talking about EJBs because they scale better ?