Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Distributed Container

 
Fisher Daniel
Ranch Hand
Posts: 582
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear all,
Some articles,that i have read, talked about Distributed Container.
What is the meaning of "Distributed container" ?
thanks
daniel
 
Mike Curwen
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hard to say without the context of the particular article. I'm not sure I've heard of a "distributed container", as much as I've heard of a distributed application (distributed between multiple containers).

In any event...

If you have an application server with more than one servlet container, then your application can be 'distributed' between the two containers. Two containers can theoretically handle twice the load. A single, complete copy of your application is loaded into each container.

Another meaning of distributed is when you cluster servers. This is more than one physical box, each with a single (or even multiple) containers. Like on a server farm.
 
Fisher Daniel
Ranch Hand
Posts: 582
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One document that I read about Distributed Container is Servlet 2.4 Specification( Proposed Final Draft)...
It said that
"Context attributes are local to the VM in which they were created. This prevents
ServletContext attributes from being a shared memory store in a distributed
container."
Example we implement distributed container for our application into 2 different machines. Who is reponsible to redirect our request to first machine or the other one?
thanks
daniel
 
Hari babu
Ranch Hand
Posts: 208
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Distributed container is deploying your application in two diffrent systems but logically they appear a single application to the user. In other words its known as clustering the application. This is done for load balancing and better performance
 
Mike Curwen
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The segment of the spec you quoted:Context attributes are local to the VM in which they were created. This prevents ServletContext attributes from being a shared memory store in a distributed
container


This is just a warning to developers about the nature of a distributed container. Imagine two instances of the same servlet, one in each of two containers.

Request 1 goes to Container 1 and calls the following:

ServletContext.setAttribute("foo", "bar");

normally, the foo attribute would be available in a JSP through the application object, or in other servlets through ServletContext.getAttribute()

Request 2 goes to Container 2 and calls:

ServletContext.getAttribute("foo");

This would return null, and not the expected "bar" String. Because the containers do not share the ServletContext.


As for you second example...Who is reponsible to redirect our request to first machine or the other one

This is accomplished by the container. If the container is distributed, then generally speaking that container would only be useful if it did its own distribution. The onus is NOT on the developer to do the distributing. All you have to worry about are issues like above, and be aware that certain (all?) objects are not shared.
 
Alex Qiu
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Who is reponsible to redirect our request to first machine or the other one"
Does this has some relationship with the JNDI tree that build in the application server and can identify the servlet containers in distributed system ? or other implementation ?
Just curious ...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic