|By Kulvir Singh Bhogal, Brad Bouldin||
|March 30, 2004 12:00 AM EST||
The quest for increased application performance is a science in itself. IBM WebSphere Application Server includes a powerful caching technology called the dynamic cache service, which you can employ in your Web applications to dramatically improve performance.
In this article, we'll use the dynamic cache service to increase the performance of a simple Web application. We will then use Apache JMeter, an open source load generator, to load-test our cached application in order to measure the application performance gains achieved by leveraging the dynamic cache service.
As you will see, the potential performance gains realized by using the dynamic cache service can be achieved with minimal effort. No changes to your application code are required, which means there is no impact on application portability.
The dynamic cache service is the name given to a set of services provided by WebSphere Application Server. The types of caching services include servlet and JSP caching, a Java object cache facility, a cache for Web services, and a command cache. In this introductory article our example will focus on the use of the servlet and JSP caching facility.
Enter Stage Left - Our Application to Tweak
Our demonstration application is implemented as a servlet that fetches a large piece of content from a remote HTTP server, then performs some text processing and returns the result to the end user. Our servlet grabs content from the Gutenberg Web site, which hosts downloadable books in ASCII format (www.gutenberg.net). For those unfamiliar with the Gutenberg project, this site hosts downloadable books that have expired copyrights and are therefore freely available.
Our example servlet will perform some text processing on the downloaded book: it will italicize the introductory section in the book's text that describes the Gutenberg project. We will test the performance before and after turning on caching and then compare the results. Once caching is enabled, the book will be downloaded on the first servlet request and presented to the user. Subsequent servlet requests will be served from the cache.
The servlet code (see Listing 1) is simple and straightforward, and uses standard Java packages and classes to read, parse, and transmit the content.
The servlet opens a URL connection to a book on gutenberg.net (see Figure 1) and copies the output to the servlet's output stream. The first section of the book contains the Gutenberg preamble (disclaimers and such), which the servlet puts in italics. Once the servlet reaches the end of the preamble (marked in the text stream with "*END*" at the end of a line), the servlet stops italicizing and switches to a more readable font for books (Times). The servlet also logs how long it took to produce the result, which has the side effect of showing us when the servlet is called (versus served from the cache). This will be handy once we enable caching because the log will show that WebSphere is using the cached result and bypassing the servlet call completely.
You can download an EAR file containing the servlet and test the performance on your own system. The source code for this article can be downloaded from www.sys-con.com/websphere/sourcec.cfm.
To see the effect of using dynamic caching in our application, we'll juxtapose the performance of our application with and without caching enabled. To study our application's performance, we'll leverage Apache JMeter. It is beyond the scope of this article to delve into the details of how to use JMeter, but you can learn more about how to use JMeter at www.devx.com/webdev/Article/17950/0. JMeter allows us to simulate a load of requests against our application server and measure subsequent performance.
We used JMeter v1.9.1 from http://jakarta.apache.org/jmeter. Our test environment consisted of one machine running WebSphere Studio Advanced Edition 5.0.1 with the WebSphere v5.0 Test Environment on a Windows 2000 Pro machine configured with a single AMD 3000+ processor and 1GB of RAM. We ran JMeter on the same machine. Since this example is "I/O-bound," running JMeter on another machine does not significantly affect performance. We used WebSphere Application Server 5.0.1, but other versions will yield similar results.
We configured JMeter with a "Jakarta Users" thread group, using 5 threads and 100 iterations (see Figure 2).
Under the thread group we added an HTTP request to access our servlet. We used port 9080 to access our servlet's Web container directly (see Figure 3). Figure 4 shows the results of our baseline (precache) test.
It's not too surprising that the average servlet response time is almost 15 seconds; it takes time to process and transmit 901K of text. Because each request takes so long (by design), our throughput is a mere 18.7 requests per minute. Our next step is to enable the dynamic cache service and measure the performance improvement.
Enabling the Dynamic Cache Service in WebSphere Application Server
Enable the dynamic cache service in the WebSphere administrative console as follows: open the administrative console, click Servers > Application Servers in the navigation tree, click on your server, and select Dynamic Cache Service under Additional Properties. Select Enable service at server startup in the Startup state field and click OK.
Enable servlet caching as follows: in the administrative console, click Servers > Application Servers in the navigation tree, select your server, and click Web Container. Check the Enable servlet caching checkbox under the Configuration tab. Click Apply or OK.
To complete the configuration changes, click Save on the top menu bar, click the Save button, and then restart the application server.
Configuring Our Servlet to Use Dynamic Cache
To specify the cache settings for our servlet, we created a cachespec.xml file (see Listing 2), located in the WEB-INF subdirectory of our WAR file. Let's take some time to discuss some of the cache settings in this file.
We have only scratched the surface of the configuration parameters you can set for a cacheable object. For example, you can opt to persist cache entries to disk in case of overflows or the housing server being stopped. Refer to the WebSphere Information Center (www-306.ibm.com/software/webservers/appserv/infocenter.html) to find out more information about which parameters can be used to achieve the desired caching effect you'd like to associate with a specific cacheable object. These design considerations are of course specific to your enterprise application's business requirements.
The WebSphere Application Server continually monitors the cachspec.xml file for changes, so the changes will take place immediately when you save the file. You therefore don't need to restart your enterprise application or application server when you want to make adjustments to your caching strategy.
The Performance Gain with the Dynamic Caching Service Enabled
Once we saved our cachespec.xml file in the WEB-INF directory, WebSphere Application Server noticed the new file, and wrote the following line to System.out:
[2/2/04 17:09:50:812 CST] 435b6a5a ConfigManager I DYNA0047I: Successfully loaded
cache configuration file k:\wsad\workspace5\Dynamic Cache Example\Web
Then we reran our JMeter test. Figure 5 shows the results.
We started with a throughput of 18.7 transactions per minute, and with cachspec.xml in place we were able to achieve quite a bit more: 568 transactions per minute. The average time to serve a request went from 14.9 seconds down to a speedy 0.416 seconds. The dramatic improvement demonstrates the power of using WebSphere's dynamic caching service.
Our test servlet was deliberately constructed to demonstrate a dramatic effect, but most Web applications that do any processing or back-end calls will benefit substantially from using the dynamic cache service. It's important to point out that we didn't need to make any changes to our servlet code. We simply created a cachespec.xml file in our WEB-INF directory and witnessed an immediate performance improvement.
WebSphere Application Server 5.0 ships with a Cache Monitor application (see Figure 6) that allows you to use a Web browser to view reports on cache statistics, and also allows you do things like view the cache IDs of objects in the cache.
The Cache Monitor is located in the <WAS_ROOT>/installableApps directory (CacheMonitor.ear) and is easy to install and use. After you have installed the Cache Monitor enterprise application, open the URL: http://<your_server>:<your_port>/cachemonitor. You can use the Reset Statistics and Clear Cache buttons to clean out the cache and get ready for another load test after you tweak the caching policy settings in your cachespec.xml file. This saves time, since you won't have to restart the application server between load tests.
Java servlets and JavaServer Pages are typically used to present dynamic content to a Web site visitor. WebSphere Application Server's dynamic cache service can be used to serve requests for content from an in-memory cache. Servlet output is stored in memory, expediting delivery to the end user.
In this article, you used the dynamic cache service offerings on a Web application and witnessed the added performance benefits using Apache JMeter. The process of enabling WebSphere Application Server's dynamic cache service and modifying your Web application to use dynamic caching is rather simple. Leveraging these highly configurable caching options should be a major consideration for organizations trying to squeeze the most performance out of their application servers. You can learn more about the dynamic cache service in the WebSphere Information Center.
The authors would like to thank Lisa Tomita for her review of this article.
|Carlos Melvin 04/14/04 05:24:26 PM EDT|
I have been reading a little on dynamic cache service. I have yet to see any reference to a system other than Windows. Does this work on an AIX platform?
|Pierre Comtois 03/31/04 02:06:01 PM EST|
How would the cache work/react when using the same JSP as a template for dynamic data recovered from a DB. An application we implemented with older version of WAS involved using about 10 template JSPs and populated over 10000 different "pages" on-demand, a "page" being a template with simply different content. Each "page"''s content was retrieved by the servlet and command classes based on keys present on the URL.
The cloud market growth today is largely in public clouds. While there is a lot of spend in IT departments in virtualization, these aren’t yet translating into a true “cloud” experience within the enterprise. What is stopping the growth of the “private cloud” market? In his general session at 18th Cloud Expo, Nara Rajagopalan, CEO of Accelerite, explored the challenges in deploying, managing, and getting adoption for a private cloud within an enterprise. What are the key differences between wh...
Jan. 19, 2017 01:15 AM EST Reads: 6,095
"Tintri was started in 2008 with the express purpose of building a storage appliance that is ideal for virtualized environments. We support a lot of different hypervisor platforms from VMware to OpenStack to Hyper-V," explained Dan Florea, Director of Product Management at Tintri, in this SYS-CON.tv interview at 18th Cloud Expo, held June 7-9, 2016, at the Javits Center in New York City, NY.
Jan. 19, 2017 12:45 AM EST Reads: 4,688
The security needs of IoT environments require a strong, proven approach to maintain security, trust and privacy in their ecosystem. Assurance and protection of device identity, secure data encryption and authentication are the key security challenges organizations are trying to address when integrating IoT devices. This holds true for IoT applications in a wide range of industries, for example, healthcare, consumer devices, and manufacturing. In his session at @ThingsExpo, Lancen LaChance, vic...
Jan. 18, 2017 09:45 PM EST Reads: 6,517
WebRTC has had a real tough three or four years, and so have those working with it. Only a few short years ago, the development world were excited about WebRTC and proclaiming how awesome it was. You might have played with the technology a couple of years ago, only to find the extra infrastructure requirements were painful to implement and poorly documented. This probably left a bitter taste in your mouth, especially when things went wrong.
Jan. 18, 2017 09:30 PM EST Reads: 7,635
Big Data, cloud, analytics, contextual information, wearable tech, sensors, mobility, and WebRTC: together, these advances have created a perfect storm of technologies that are disrupting and transforming classic communications models and ecosystems. In his session at @ThingsExpo, Erik Perotti, Senior Manager of New Ventures on Plantronics’ Innovation team, provided an overview of this technological shift, including associated business and consumer communications impacts, and opportunities it m...
Jan. 18, 2017 09:30 PM EST Reads: 5,747
You have great SaaS business app ideas. You want to turn your idea quickly into a functional and engaging proof of concept. You need to be able to modify it to meet customers' needs, and you need to deliver a complete and secure SaaS application. How could you achieve all the above and yet avoid unforeseen IT requirements that add unnecessary cost and complexity? You also want your app to be responsive in any device at any time. In his session at 19th Cloud Expo, Mark Allen, General Manager of...
Jan. 18, 2017 07:30 PM EST Reads: 3,151
WebRTC is bringing significant change to the communications landscape that will bridge the worlds of web and telephony, making the Internet the new standard for communications. Cloud9 took the road less traveled and used WebRTC to create a downloadable enterprise-grade communications platform that is changing the communication dynamic in the financial sector. In his session at @ThingsExpo, Leo Papadopoulos, CTO of Cloud9, discussed the importance of WebRTC and how it enables companies to focus o...
Jan. 18, 2017 06:15 PM EST Reads: 4,201
Big Data engines are powering a lot of service businesses right now. Data is collected from users from wearable technologies, web behaviors, purchase behavior as well as several arbitrary data points we’d never think of. The demand for faster and bigger engines to crunch and serve up the data to services is growing exponentially. You see a LOT of correlation between “Cloud” and “Big Data” but on Big Data and “Hybrid,” where hybrid hosting is the sanest approach to the Big Data Infrastructure pro...
Jan. 18, 2017 05:30 PM EST Reads: 4,891
In his General Session at 16th Cloud Expo, David Shacochis, host of The Hybrid IT Files podcast and Vice President at CenturyLink, investigated three key trends of the “gigabit economy" though the story of a Fortune 500 communications company in transformation. Narrating how multi-modal hybrid IT, service automation, and agile delivery all intersect, he will cover the role of storytelling and empathy in achieving strategic alignment between the enterprise and its information technology.
Jan. 18, 2017 04:45 PM EST Reads: 4,601
Buzzword alert: Microservices and IoT at a DevOps conference? What could possibly go wrong? In this Power Panel at DevOps Summit, moderated by Jason Bloomberg, the leading expert on architecting agility for the enterprise and president of Intellyx, panelists peeled away the buzz and discuss the important architectural principles behind implementing IoT solutions for the enterprise. As remote IoT devices and sensors become increasingly intelligent, they become part of our distributed cloud enviro...
Jan. 18, 2017 04:30 PM EST Reads: 4,808
With major technology companies and startups seriously embracing IoT strategies, now is the perfect time to attend @ThingsExpo 2016 in New York. Learn what is going on, contribute to the discussions, and ensure that your enterprise is as "IoT-Ready" as it can be! Internet of @ThingsExpo, taking place June 6-8, 2017, at the Javits Center in New York City, New York, is co-located with 20th Cloud Expo and will feature technical sessions from a rock star conference faculty and the leading industry p...
Jan. 18, 2017 03:30 PM EST Reads: 3,699
"LinearHub provides smart video conferencing, which is the Roundee service, and we archive all the video conferences and we also provide the transcript," stated Sunghyuk Kim, CEO of LinearHub, in this SYS-CON.tv interview at @ThingsExpo, held November 1-3, 2016, at the Santa Clara Convention Center in Santa Clara, CA.
Jan. 18, 2017 02:45 PM EST Reads: 1,600
Things are changing so quickly in IoT that it would take a wizard to predict which ecosystem will gain the most traction. In order for IoT to reach its potential, smart devices must be able to work together. Today, there are a slew of interoperability standards being promoted by big names to make this happen: HomeKit, Brillo and Alljoyn. In his session at @ThingsExpo, Adam Justice, vice president and general manager of Grid Connect, will review what happens when smart devices don’t work togethe...
Jan. 18, 2017 02:00 PM EST Reads: 423
"There's a growing demand from users for things to be faster. When you think about all the transactions or interactions users will have with your product and everything that is between those transactions and interactions - what drives us at Catchpoint Systems is the idea to measure that and to analyze it," explained Leo Vasiliou, Director of Web Performance Engineering at Catchpoint Systems, in this SYS-CON.tv interview at 18th Cloud Expo, held June 7-9, 2016, at the Javits Center in New York Ci...
Jan. 18, 2017 01:00 PM EST Reads: 5,620
The 20th International Cloud Expo has announced that its Call for Papers is open. Cloud Expo, to be held June 6-8, 2017, at the Javits Center in New York City, brings together Cloud Computing, Big Data, Internet of Things, DevOps, Containers, Microservices and WebRTC to one location. With cloud computing driving a higher percentage of enterprise IT budgets every year, it becomes increasingly important to plant your flag in this fast-expanding business opportunity. Submit your speaking proposal ...
Jan. 18, 2017 01:00 PM EST Reads: 5,114
Discover top technologies and tools all under one roof at April 24–28, 2017, at the Westin San Diego in San Diego, CA. Explore the Mobile Dev + Test and IoT Dev + Test Expo and enjoy all of these unique opportunities: The latest solutions, technologies, and tools in mobile or IoT software development and testing. Meet one-on-one with representatives from some of today's most innovative organizations
Jan. 18, 2017 12:15 PM EST Reads: 1,559
20th Cloud Expo, taking place June 6-8, 2017, at the Javits Center in New York City, NY, will feature technical sessions from a rock star conference faculty and the leading industry players in the world. Cloud computing is now being embraced by a majority of enterprises of all sizes. Yesterday's debate about public vs. private has transformed into the reality of hybrid cloud: a recent survey shows that 74% of enterprises have a hybrid cloud strategy.
Jan. 18, 2017 12:00 PM EST Reads: 4,242
SYS-CON Events announced today that Super Micro Computer, Inc., a global leader in Embedded and IoT solutions, will exhibit at SYS-CON's 20th International Cloud Expo®, which will take place on June 7-9, 2017, at the Javits Center in New York City, NY. Supermicro (NASDAQ: SMCI), the leading innovator in high-performance, high-efficiency server technology, is a premier provider of advanced server Building Block Solutions® for Data Center, Cloud Computing, Enterprise IT, Hadoop/Big Data, HPC and E...
Jan. 18, 2017 12:00 PM EST Reads: 5,778
SYS-CON Events announced today that Linux Academy, the foremost online Linux and cloud training platform and community, will exhibit at SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. Linux Academy was founded on the belief that providing high-quality, in-depth training should be available at an affordable price. Industry leaders in quality training, provided services, and student certification passes, its goal is to c...
Jan. 18, 2017 12:00 PM EST Reads: 1,970
WebRTC is the future of browser-to-browser communications, and continues to make inroads into the traditional, difficult, plug-in web communications world. The 6th WebRTC Summit continues our tradition of delivering the latest and greatest presentations within the world of WebRTC. Topics include voice calling, video chat, P2P file sharing, and use cases that have already leveraged the power and convenience of WebRTC.
Jan. 18, 2017 10:30 AM EST Reads: 3,128