Only 48 hours left in the trailboss' kickstarter!

New rewards and stretch goals. CLICK HERE!



  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Available and scaleable web site using Java EE  RSS feed

 
P Kuling
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have used Java EE before, but I have never used it with an intent to create a high availability and scalable web site. In other words I want to create a web site which almost never is down.

I had this three tier architecture in mind:
  • Persistence: Hibernate in its pure form or Java Persistence API (JPA) with Hibernate as persistence provider.
  • Business: Manager classes annotated as Stateless Session Beans (SLSB's).
  • Presentation: Servlet's + Java Server Pages (JSP)


  • An example for the use case when a user submits a comment on a blog using this architecture: (It's not a formal use case, no nit picking! )
  • System uses a JSP to display a blog entry to the visiting User.
  • User types in a comment and presses the "Submit Comment" button, the comment is sent to the server by the web browser of the User.
  • System receives the User comment through a Servlet (the User comment is sent as a POST request).
  • [list]System uses the manager for blog entries to add the comment to the blog entry: It's communication from the Presentation layer to the Business layer.[/list][list]System processes the comment a bit to remove trailing white space and it also checks for filthy words and replaces them with "&%!%�#!". After that it stores the blog comment: It's communication from the Business layer to the Persistence layer.[/list]
  • System makes the appropriate JPA calls to store the blog comment. It's done in the Persistence layer.
  • System forwards the user to the appropriate JSP page from the Servlet. This is done in the Presentation layer (we're back after our call to the business method to store the blog comment).
  • User sees the updated page which includes his blog (most often last, in case there aren't a lot of people commenting at the very same time.).


  • What do I need to do more to get an available and scalable site? I need a combination of load balancing and fail-over in a clustered environment. Is my basic architecture (above) well suited for these requirements? And if not, what should I change?
     
    Reza Rahman
    author
    Ranch Hand
    Posts: 580
    5
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Mr. Kuling,

    You basic architecture from a software development standpoint is fine. The only thing I would say is to look into JSF and perhaps JBoss Seam on the presentation tier instead of using Servlets and JSP. Even in the best of hands, Servlets and JSP gradually turns into spaghetti code.

    From a HA (High Availability) standpoint, as long as you are using Java EE APIs, you are more or less set since most Java EE application servers are designed for clustering and fail-over from the ground-up. All you need to make sure is that the data center is setup for application server HA. You should also make sure that the web server and database servers are HA enabled. Otherwise, you will have potential bottlenecks/single points of failure there. I would also look into distributed caches or data grids like Oracle Coherence that plug into Hibernate/JPA to provide additional run-time performance and reliability.

    Regards,
    Reza

    P.S.: My guess is that you will be asked to provide your full name by one of the bartenders shortly :-). You way want to change it proactively.
    [ November 13, 2008: Message edited by: Reza Rahman ]
     
    P Kuling
    Greenhorn
    Posts: 10
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Mr. Rahman,

    Thank you for your answer! It feels good that someone as experienced as you think the architecture is fine.

    Regarding the Servlet + JSP approach for the presentation layer we're looking at a number of technologies. We have looked a bit at JSF and it didn't really blow our minds. Even the author of JavaServer Faces from O'Reilly doesn't think the JSF + JSP combination is good, he suggests using something else than JSP in combination with JSF. But we don't have time to create something like that and we've seen no viable alternatives.

    Do you have any tips on how the deployment of a available and scalable web site using Java EE and the above architecture is done? For example which participants will be in the solution? (Load balancers, Java EE-servers, replicated database servers etc)

    P.S. I read somewhere (here at the ranch) that an initial and surname was enough. But I'll try to find it again and if I don't find it I'll change it. Thank you for pointing it out to me.
    [ November 14, 2008: Message edited by: P Kuling ]
     
    Reza Rahman
    author
    Ranch Hand
    Posts: 580
    5
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Mr. Kuling,

    The doubt about JSP+JSF is reasonable. It indeed does not play well with the JSF component model. However, I can tell you that I've had very good developer feedback on a Seam+JSF+Facelets combination. Personally, I think JSF is just as good if not better then Struts 1, Struts 2, Spring MVC, WebWork and the like. JSF is certainly leading in terms of deployment numbers in the web framework arena (of course, that alone means little). That being said, JSF has it's fair share of detractors as well (IMO, this is mostly the hyper-competitive types). I have not tried Wicket yet, so won't comment on it.

    As to the deployment scenario, luckily it is pretty cut and dry provided you are dealing with a decent systems team. Here is a simple text-based deployment diagram:



    * By clustered, I mean load balanced, failed-over and replicated. The cache/grid need not be replicated, depends on the use-case.

    Hope this helps.

    Regards,
    Reza

    P.S.: Some of this is already in EJB 3 in Action (performance tuning chapter). Feel free to check it out.
    [ November 14, 2008: Message edited by: Reza Rahman ]
     
    It is sorta covered in the JavaRanch Style Guide.
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!