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.
The Problem: JSP Servlets Performance Bottlenecks:
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.
The Solution: Distributed Caching:
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.
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:
Distributed Cache – Scaling JSP Servlet Performance:
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.
How Does NCache Help?
NCache is a feature-rich distributed cache that boosts JSP Servlets performance. Following are simple steps to quickly start using it in your application on any leading application server such as Apache/Tomcat, JBoss, WebLogic or WebSphere:
1. Install NCache: On your Java web server and two cache servers
2. Create a cache: Through a GUI based NCache Manager tool
3. Cache application data in NCache: If you want to use NCache for object caching in your JSP application, you will need to make NCache API calls to store and fetch your Java objects from the cache.
4. Reference: “NCClient.jar” and “NCActivate.jar” files in your project.
5. Include: “javaReg.Properties” file into the CLASSPATH of your project.
6. Use: import com.alachisoft.ncache.web.caching.*; in your project.
7. Monitor NCache performance: NCache performance can be monitored through a rich set of PerfMon counters.