Design Question

Discussions

EJB design: Design Question

  1. Design Question (5 messages)

    Hi
    I am developing an application in java and basically in doubt about the design
    I need to choose. My system will be used by 500 - 700 people and literally these people live on the system, which makes me to think more carefully.

    Client UI: Will be a swing based one. Because of the complexity of the client
    UI, html UI is never an option. ( This part I am clear)

    Now the question is what to do on the server side:
    =================================================
    Here are my requirements:
    a) I need it to be be able to support 500-700 users.
    b) Should be able to run on 2 or more machines so that even if one goes down another
       can pick it up. ( clustering ????)
    c) should give a good respnse time

    I know I am not in a unique situation as many of you would have faced this situation, your experience can be very valuable to me.

    OK Here are my thoughts
    =======================
    1. Initially I though I can use EJB. As I thought I can use an application
    server like jboss which gives clustering, load balancing, connection pooling
    etc.
                               "but"
    I want to minimize hits to my database. I just want to write one query which
    reads from multiple tables, fill an object with that data and send it to the
    client where it will display the data. Entity bean looks fine for 1 table but
    since my query involves multiple tables and potentially 100 records can come
    out of the query, EJB solution does not appeal me here. I read we can use
    some mapping tools but it looks messy with too many dependencies.

    2. Then I considered RMI service at the backend. Just RMI service taking the
    calls from clients and use general DAO concept ( Make the query, parse the
    resultset and fill the DAO ) and send it back.
                                  "but"
    can it support 500-700 users, can i run on multiple servers so that if one fails
    others can pick it up.

    3. The last Servlet, write a servlet which receives the client requests and since servlet spaws a thread per client and Resin / Tomcat have cluster, load
    balancing capabilities (? I am assuming) I can write/use generally available
    connection pooling classes and complete the project.
    However note:
    1. since the client is written in java
    2. and this is an intranet application
    how far this is advisible.

    Now I am lost, and could use help of some experienced guys to make my decesion.
    Regards

    Threaded Messages (5)

  2. I think this is safe:

    jdo for database access
    stateless session beans = api to a database
    statefull client gui, mvc

    This is a lightweight solution that garantees flexibility and scalability. We used this setup, and find it very easy to add functionality (even changing database tables), and improve performance (clustering, load balancing, insert cache in front of the stateless components).

    Don't focus on j2ee patterns, just don't use entity beans, focus on sound OO principles and distributed system design.

    We have successfully implemented this strategy to build a web application having 5000 users (100 simultaneous, updating the database), it currently runs on 2 machines, wihthout performance problems.
  3. Reply[ Go to top ]

    "I want to minimize hits to my database. I just want to write one query which
    reads from multiple tables, fill an object with that data and send it to the
    client where it will display the data. Entity bean looks fine for 1 table but
    since my query involves multiple tables and potentially 100 records can come
    out of the query, EJB solution does not appeal me here. I read we can use
    some mapping tools but it looks messy with too many dependencies. "

    I think direct JDBC is a good alternative here (fast-lane reader pattern). You can also use stored procedures for better performance considerations. You can create an easy framework that will be transaction-aware and you can use session facade for referencing methods of this framework. The result of a framework's activity will be populated to composite value object and passed back to a session facade method that will pass it back to a client. Business delegate pattern will be valuable on a client side as well as MVC paradigm.

    "2. Then I considered RMI service at the backend. Just RMI service taking the
    calls from clients and use general DAO concept ( Make the query, parse the
    resultset and fill the DAO ) and send it back."

    Nothing personal against RMI. Another tip: you can increase your development time if you pass the rowsets from your JDBC queries directly to your client and parse them out there. For sure, it will decrease coupling between the layers and will not be a major drawback as long as you do not plan to introduce another client types - you'll have less fuss with double definition of value objects on both sides.
     
    "can it support 500-700 users, can i run on multiple servers so that if one fails
    others can pick it up"

    No problems with that - just keep track of your session conversational data on a server. The best option for that will be stateful session bean which are usually easily replicated over cluster components.

    "3. The last Servlet, write a servlet which receives the client requests and since servlet spaws a thread per client and Resin / Tomcat have cluster, load
    balancing capabilities (? I am assuming) I can write/use generally available
    connection pooling classes and complete the project."

    I am not sure what you meant under the servlet here. Why would you need the servlet?
     
    "However note:
    1. since the client is written in java"

    Another option - take a look at SWT from IBM. This could be really alternative to Swing. Anyway, it will be much more faster and you'll stick together with "beautiful" native components. ;)
     
    "2. and this is an intranet application
    how far this is advisible."

    No problems with that. It could be easily converted to internet afterwards - JProxy (www.jproxy.com) can easily tunnel RMI over HTTPS.

    Alex
  4. Hi Alex
    Thanks for the reply...
    However I did not understand this part
    "No problems with that - just keep track of your session conversational data on a server. The best option for that will be stateful session bean which are usually easily replicated over cluster components. "
    Can you please elaborate on this. Does it mean I should have a Stateful Session Bean which checks the User Login/PWD and from then on maintain Session Info. Can you point me to a link which talks in detail about your idea. It will be very helpful to me.
    Thanks
    Modha/-
  5. Modha.[ Go to top ]

    I mean that you use stateful bean for storing your session-specific information only. You can provide authentificaton somewhere else.

    Look for an interview with Inderjeet Singh (J2EE Blueprints Architect from Sun) here:

    https://www.theserverside.com/events/library.jsp

    You'd better check for questions 5-9 regarding state-specific issues.

    Alex
  6. Reply: Join many tables in a DAO[ Go to top ]

    Hi Alex,

    the fast-lane reader pattern solves the problem of how to generate reports from massive data from just one table, but I have not found yet any place that tell me how can I join many tables using features like group by, sum, max and others group functions in my select in a eficient way. Can I put a complex select (join tables with group function) in a DAO ? I think that solution generate a specific DAO and since I have many reports each one with a complex select I´ll have to generate many DAO´s breaking reusability. But in other way generates just the data I need and saves me from merge many VO´s from many DAO´s to generate my complex report, this turns my reports very sllow.

    Thank´s in advance