Discussions

Performance and scalability: J2EE Architeture

  1. J2EE Architeture (4 messages)

    Guys
    I am using weblogic server for my application which contains 20 beans and 7 servlets.

    I heard,It is good to load EJB's in weblogic and related servlets in a webserver(Apache,Netscape).
    Is it true?
    Thanks
    Lawrence

    Threaded Messages (4)

  2. J2EE Architeture[ Go to top ]

    I have this question as well.
    My instinct is this is right, as Servlets/JSPs are part
    of the "web tier" in Sun's J2EE Blueprints, and EJBs are
    not.

    However, what of the case where the Servlet (or JSPs and
    regular JavaBeans, loaded via the useBean tag) also
    access the database?

    I'd consider this kind of complicated, and would tend
    to make rules like: "If I am using EJB at all, all DB
    access should be through them." If I'm doing that, then
    yes, I'd put the Servlets/JSPs on Netscape or Apache,
    and the EJBs on WebLogic/whatever.

    In one project I am familiar with, one team wrote Servlets
    that hit to database. Another team used EJBs. There wasn't
    much collaboration. All the Servlets and JSPs ended up
    running on WebLogic. I think this might have been a firewall issue, but am not sure.

    But some people on the project expressed interest in moving
    the Servlets to Netscape. If they do this, they might have
    to do some additional firewall configuration since now the web server machine must talk to the database, as well as the app server machine.

    As I said, I don't care for the idea of hitting the database from both the web tier and the EJB tier, but it's
    just a gut feeling because it seems it would be harder
    to document/explain to new people.

    What does everyone else think?
  3. J2EE Architeture[ Go to top ]

    I strongly believe that you should stick to the MVC pattern as much as possible. Your servlet shoud only interact with the middle tier level, i.e. business logic. EJBs in your case represent this middle tier model. I am sure that you can get rid of this direct access to the DB. It will only make your design cleaner and less prone to writing bugged code.

    Think of EJBs as a sort of loose-coupled proxy between the user and the back-end system. Your view does not need to know anything about the database schema does it ?
  4. J2EE Architeture[ Go to top ]

    Hi,

    I had read an article which was posted in the JavaOne COnferance. It says that to acheive optimum performance EJBs, JSPs, Servlets r to be deployed on the App Server & Static content (like gifs & static HTML) should be deployed on the Web server.
  5. J2EE Architeture[ Go to top ]

    Of course that's quicker, since you potentially skip a roundtrip to the App Server.

    However, if all you're interested in is optimum performance then to be honest you'd be best off to write everything in Assembler (or straight machine code).

    Having taken a decision to use a structured language such as Java, I would assume that factors such as robustness, scalability and maintainability (maybe even portability)come into the picture. Each of which might impact on performance, but each might be a price you can afford to pay in order to produce a better-designed system.

    For all but the most basic development I'd wholeheartedly agree with Yann. You'll see why when you come to make changes to your code.