Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes EJB and other Java EE Technologies and the fly likes Proposed architecture Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Proposed architecture" Watch "Proposed architecture" New topic
Author

Proposed architecture

Pankaj Kumarkk
Ranch Hand

Joined: Apr 17, 2011
Posts: 108
I am not sure if this is the right forum to discuss. If not please suggest which forum I should post my question to.

The below is not at all related to SCEA certification.

I have to design a heavy traffic web application and would like to discuss the technical architecture of same.

The requirement is as below:

Design a retail mart which wants to get into business of selling products online. The retail mart has a variety of products and it has 2 main geographies to serve (US and Japan). The web application should provide localized content based on the geography from where the user is accessing the web application.
The application needs to have online payment functionality and the purchased items should be shipped to customers within 5 working days.

The application needs to be have following NFRs
- Scalable. There is likelihood that the application usage would grow over time and thus the architecture should be scalable to attend to increasing volmes
- Performance: The application should have quick response time. The reponse time should be equivalent in both geographies(USA and Japan)
- High availability application
- DR: In case of a server failure the DR site should be up and running with latest data within 1 hr

Can you help me propose an effective architecture for this application.

Below is my take on the architecture:

Logical architecture:
Web application with following tiers:
Presentation Tier:
Comprises of Servlets/JSP with Strut2
Would use Struts capability to give localized content based on resource bundles

Middle Tier
Consist of Application Layer and DAO layer
The application layer would contain all the business logic.The layer would be implemented using Spring with POJOs
The DAO tier would integrate with Oracle database. The DAO objects would use Hibernate for interacting with database. We would utilize Hibernate's 2nd level cache (using JBoss Tree cache) to cache very frequently purchased items data so that same item can be fetched from cache 2nd time around.
The cache would be "transactional" cache and would be refreshed whenever an item is updated or deleted.
The DAO would use stored procedures for specific functions which require quicker response.(Not clear here)

Database Tier
Would use stored procedures

For delivery module:
The module will be responsible for taking orders and then ensuring that items are shipped to customer address

This module would be designed as a asynchronous application as it is a offline activity. The billing module would send orders as JMS messages which the delivery module would pick up and process. Please comment on this.

To handle the NFRs below is the proposal:
- Scalable. There is likelihood that the application usage would grow over time and thus the architecture should be scalable to attend to increasing volmes
Soln: The application would be multi-clustered deployment which would be front ended by a load balancer. This would ensure that we can add a new cluster as and when a need arises

- Performance: The application should have quick response time. The reponse time should be equivalent in both geographies(USA and Japan)
Soln: I would like to have physical server in each of these locations(ie one in USA and one in Japan). My question is how would I divert the trafic from japan to the physical server located in Japan
Is there any reference material which I can read to understand this aspect of deployment more.

- High availability application
Soln: Would be handled through multi-cluster deployment

- DR: In case of a server failure the DR site should be up and running with latest data within 1 hr
Soln: I am at a loss wrt solution for this requirement

I would like to know if there are any suggestions/opinions/recommendation anyone has on the above architecture
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6661
    
    5

Soln: The application would be multi-clustered deployment which would be front ended by a load balancer. This would ensure that we can add a new cluster as and when a need arises


Where do you store session state ? In the DB ? Can the DB scale with the application tier ?

My question is how would I divert the trafic from japan to the physical server located in Japan
Is there any reference material which I can read to understand this aspect of deployment more.


Lookup routers / load balancers that have affinity.


SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30138
    
150

Since this is not about the SCEA exam, I'm moving it to our JEE forum. (JEE or Spring would be the most appropriate places.) Since you didn't decide whether to use Spring, I'm going with the more general one.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Pankaj Kumarkk
Ranch Hand

Joined: Apr 17, 2011
Posts: 108
My question is how would I divert the trafic from japan to the physical server located in Japan
Is there any reference material which I can read to understand this aspect of deployment more.



Lookup routers / load balancers that have affinity.


Can you elaborate a little.
I have 2 questions here:
My soln is to have a physical server located in 2 geographies and the users of each geography feed from the server in their geography. This would mean that the both the app and DB needs to be in each geography.
Q1: Is this architecture good enough. Are there any better option
Q 2. How do we keep the data synchronized between 2 DB servers(so that same item can not be bought twice).
Q3: How do I configure the Lookup routers / load balancers for each georgraphy
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6661
    
    5

Q 2. How do we keep the data synchronized between 2 DB servers(so that same item can not be bought twice).


You are talking about the request being idempotent. It does not necessarily have to do with synchronizing the 2 databases. How do you differentiate a duplicate request from a user wanting to buy the same item in 2 different orders ?

There are ways to synchronize a DB over the network. It is expensive and any system that wishes to scale should adopt a model that is eventually consistent.

Q3: How do I configure the Lookup routers / load balancers for each georgraphy

This is low level detail. It is best left to a Network Operations Control team. From an architecture perspective, all one needs to know is that such technology exists and can be configured. You can route by IP proximity for example
Pankaj Kumarkk
Ranch Hand

Joined: Apr 17, 2011
Posts: 108
Hi Deepak,
Thanks for the response. I think I didn't provide enough information regarding the database configuration.

Q 2. How do we keep the data synchronized between 2 DB servers(so that same item can not be bought twice).
You are talking about the request being idempotent. It does not necessarily have to do with synchronizing the 2 databases. How do you differentiate a duplicate request from a user wanting to buy the same item in 2 different orders ?


Essentially I have a requirement to give same performance for users located in US and Japan. For this requirement, I intend to have 2 physical servers located in vicinity of US and Japan.
Thus the deployment structure would be

In US
Application Server + DB Server

In Japan
Application Server + DB Server

Thus I have copy of application and DB server set-up in 2 geographies. Since both these have common data therefore I I need to ensure that the data in 2 DB servers is in sync. Thus I asked how to keep data synchronized in 2 DB servers.


Q3: How do I configure the Lookup routers / load balancers for each georgraphy

This is low level detail. It is best left to a Network Operations Control team. From an architecture perspective, all one needs to know is that such technology exists and can be configured. You can route by IP proximity for example

Can you refer me to any link/reference where I can learn more about it. I intend to do a working POC for my architecture and thus want to set-up a working sample module.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Proposed architecture
 
Similar Threads
DAO Design Question
Oracle Objects JDBC vs Hibernate/Toplink
J2EE job wanted
Spring Hibernate JNDI look up question?
Why do transactions not start when bean definitions are moved to <application>-servlet.xml?