Skip to main content

Unclog the server bottleneck with active containers

A browser-based solution to data-processing redundancy

Aashish Patil (aashishpatil@acm.org), M.S. candidate, Department of Computer Science, University of Southern California
Aashish completes his MS in Computer Science (Computer Networks) from the University of Southern California (USC) this Fall. You can contact him at aashishpatil@acm.org.

Summary:  Regular developerWorks contributor Aashish Patil offers yet another inventive solution to a common problem. In this article, Aashish shows you how to use containers to overcome data-processing redundancy, which can otherwise drain the life out of your handheld or Web server.

Date:  06 Apr 2004
Level:  Introductory
Activity:  724 views

In server-side control architectures such as Java ServerFaces (JSF) or Struts, a majority of the control events must be handled on the server side to update the state of the control. For every user event, the entire page data is sent back to the server as part of the form submission. Even data that has not changed or is not affected by the user event is sent to (and back from) the server. It is obvious that handhelds, overburdened Web servers, and possibly wireless networks would benefit from the avoidance of redundant data processing in these instances; the question is how to implement a solution.

The problem for the developer distributing a server-side control component is that he or she does not know the kind of environment the component will be used in. The component might run on a page that contains a lot of other components; on a page that exists within deeply nested frames; or as part of a composite control component, such as a drop-down list and text box. While every environment poses its own particular challenges, the composite control component is a particularly strong candidate for data-processing redundancy. It is possible that the majority of internal events generated by one of the composite controls results in an update of the other controls within the portlet.

In this article, I'll consider a conceptual solution for the problem of data-processing redundancy in a composite control component.

A working example

For a working example, consider a much simplified portlet consisting of a drop-down list and a text box. The text box is updated based on the selection in the drop-down list. In a sever-side event model such as MVC (Model View Controller), all of the control data is sent to the server every time a user makes a selection in the drop-down list. Keep in mind that the user selection is an event internal to the portlet. If the component is contained on a page with other controls, however, the entire page is sent back and forth to the server for every event affecting only the two controls in the portlet.

It seems obvious that you should be able to simply refresh the single component instead of the whole page -- but how to do it?


<activeContainers> to the rescue

One possible solution to the problem would be to designate certain areas of the Web page as separate containers. In the case of an event, only the container would be refreshed without affecting the other containers or supercontainers on the page.

For the purpose of this article, I call these containers <activeContainers>. The first point of concern in implementing the described solution is how to differentiate between events that refresh only within the confines of the <activeContainer> and those that require a whole page refresh. For example, while one link in the drop-down list might lead only to the text box, requiring an update of just the container state, another might navigate to a new Web page altogether, which requires a whole page submission or refresh.

Using attributes to designate type

To differentiate between the two types of event, you must designate the events that result only in an update of the container state. For this, you might use an attribute specifying either an internal or an external event, as shown below.

<a href='/doUpdate' type='internal'/>

For an input component with its type declared as internal, the browser would know to refresh only the <activeContainer> and not the entire page data.

More advanced solutions

In Figure 1, below, you see a slightly more advanced working example, with two <activeContainer>s within one Web page. It should be possible to submit the data of one <activeContainer> rather than the whole page, including the second <activeContainer>. For this, a browser needs to treat the data within an <activeContainer> tag in a special manner. For example, a browser might use a separate user-interface Panel to draw the components in a given <activeContainer>. In this case, only the Panel that drew the components within the <activeContainer> tags is refreshed.


Figure 1. A more advanced activeContainers solution
Two activeContainers on one Web page

In this example, a variation on selective refresh, the user still experiences the page as a whole; only the browser knows to differentiate one <activeContainer> from another.

In another advanced implementation of the <activeContainer>s solution, a container could specify dependents -- that is, other <activeContainers> to be refreshed whenever the main <activeContainer> is refreshed.


What about using Frames?

The <activeContainer>s solution isn't the only possibility for resolving data-processing redundancy in server-side architectures. IFrame is another possible solution that comes to mind. Unlike <activeContainer>s, however, an IFrame implementation requires previous planning and design, making it not so distributable. In addition, IFrame requires that data be stored in a separate document, creating a dependency on that separate document.

In fact, an <activeContainer> can be considered a way of generating IFrames or Frames on the fly. Unlike IFrames or Frames content, however, an <activeContainer> is still a part of the main page; it is simply a dynamic way to inform the browser of the existence of self-contained data.


Conclusion

The purpose of an <activeContainer> is to isolate (scope) refreshable data for improved performance. Like Frames and IFrames, the <activeContainer> solution is dependent on browser support. A browser must be aware of the <activeContainer> tag and render or refresh tagged data in a special manner based on their internal events.

While currently only a conceptual solution, <activeContainer>s are an idea that could make life much easier for developers. For wireless networks it means less redundant data on the network and less probability of bit errors, and, hence, less retransmission at the transport level. In the long run, the <activeContainer>s solution has the potential to contribute to a longer battery life for handhelds. The bottom line is less work for overburdened servers on any type of network.


Resources

About the author

Aashish completes his MS in Computer Science (Computer Networks) from the University of Southern California (USC) this Fall. You can contact him at aashishpatil@acm.org.

Comments (Undergoing maintenance)



Trademarks  |  My developerWorks terms and conditions

Help: Update or add to My dW interests

What's this?

This little timesaver lets you update your My developerWorks profile with just one click! The general subject of this content (AIX and UNIX, Information Management, Lotus, Rational, Tivoli, WebSphere, Java, Linux, Open source, SOA and Web services, Web development, or XML) will be added to the interests section of your profile, if it's not there already. You only need to be logged in to My developerWorks.

And what's the point of adding your interests to your profile? That's how you find other users with the same interests as yours, and see what they're reading and contributing to the community. Your interests also help us recommend relevant developerWorks content to you.

View your My developerWorks profile

Return from help

Help: Remove from My dW interests

What's this?

Removing this interest does not alter your profile, but rather removes this piece of content from a list of all content for which you've indicated interest. In a future enhancement to My developerWorks, you'll be able to see a record of that content.

View your My developerWorks profile

Return from help

static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Web development, Java technology
ArticleID=10929
ArticleTitle=Unclog the server bottleneck with active containers
publish-date=04062004
author1-email=aashishpatil@acm.org
author1-email-cc=

My developerWorks community

Tags

Help
Use the search field to find all types of content in My developerWorks with that tag.

Use the slider bar to see more or fewer tags.

Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere).

My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Use the search field to find all types of content in My developerWorks with that tag. Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere). My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Rate a product. Write a review.

Special offers