JavaServer Pages (JSP) has become a really popular choice for developing high-transaction, web applications. The reasons are simple. JSP is based on Java and is therefore platform independent. It helps maintain complex, information-rich, dynamic web applications and extend existing systems. Further Java IDEs like Eclipse and NetBeans have come a long way and they help speed up enterprise development quite a bit.
This popularity of JSP has meant that it is being used quite frequently in developing high-traffic web apps. And, this is causing performance bottlenecks as you try to add more users and transaction load on your JSP application. Although, JSP application can scale very nicely to multiple web servers, the database server cannot.
As a result, your JSP application response time become very slow as you add more users and transaction load. And, this can cause you to lose revenue due to unhappy customers.
Figure 1: Database bottleneck in enterprise JSP applications
The main reason for the database becoming a bottleneck is that while you can add more and more servers to the JSP application server farm, you cannot do the same at the database tier. This results in limited scalability at the data tier. The solution to this is simple. You can remove these JSP Servlets performance bottlenecks by using an enterprise-level in-memory distributed cache for storing the frequently used data.
Think of a distributed cache as an in-memory database that can scale linearly to multiple servers and therefore never has the performance bottlenecks. However, it is not a replacement of your database which is the master record of your data. It is merely used to store frequently used data temporarily.
The following illustration shows how you can use a distributed cache to achieve a considerable performance boost.
Figure 2: Source listing of a sample JSP using distributed caching
At a conceptual level, the following illustration shows how you can use a distributed caching infrastructure with any Java application server such as Apache/Tomcat, JBoss, WebLogic or WebSphere:
Figure 3: Distributed cache being used in JSP Servlets application for data storage
Unlike a database server, a distributed cache can scale out into multiple cache servers clustered together thus boosting the overall performance and reliability. It can scale by using such schemes as partitioning and replicating of data among multiple inexpensive cache locations. It can add further reliability by reliable fail-safe mechanisms, such as replicating each partition to at least one other server in the cache cluster. This way, even if one cache location goes down, there is no loss of data.
NCache is a feature-rich distributed cache that boosts ASP.NET performance and scalability. Here are some simple steps you could take to quickly benefit from it: