|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.
Manufacturers are embracing the Industrial Internet the same way consumers are leveraging Fitbits – to improve overall health and wellness. Both can provide consistent measurement, visibility, and suggest performance improvements customized to help reach goals. Fitbit users can view real-time data and make adjustments to increase their activity. In his session at @ThingsExpo, Mark Bernardo Professional Services Leader, Americas, at GE Digital, discussed how leveraging the Industrial Internet a...
Jul. 26, 2016 08:00 PM EDT Reads: 270
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...
Jul. 26, 2016 07:15 PM EDT Reads: 1,925
"My role is working with customers, helping them go through this digital transformation. I spend a lot of time talking to banks, big industries, manufacturers working through how they are integrating and transforming their IT platforms and moving them forward," explained William Morrish, General Manager Product Sales at Interoute, in this SYS-CON.tv interview at 18th Cloud Expo, held June 7-9, 2016, at the Javits Center in New York City, NY.
Jul. 26, 2016 06:30 PM EDT Reads: 2,109
A critical component of any IoT project is what to do with all the data being generated. This data needs to be captured, processed, structured, and stored in a way to facilitate different kinds of queries. Traditional data warehouse and analytical systems are mature technologies that can be used to handle certain kinds of queries, but they are not always well suited to many problems, particularly when there is a need for real-time insights.
Jul. 26, 2016 05:45 PM EDT Reads: 1,821
The best-practices for building IoT applications with Go Code that attendees can use to build their own IoT applications. In his session at @ThingsExpo, Indraneel Mitra, Senior Solutions Architect & Technology Evangelist at Cognizant, provided valuable information and resources for both novice and experienced developers on how to get started with IoT and Golang in a day. He also provided information on how to use Intel Arduino Kit, Go Robotics API and AWS IoT stack to build an application tha...
Jul. 26, 2016 04:30 PM EDT Reads: 1,079
IoT generates lots of temporal data. But how do you unlock its value? You need to discover patterns that are repeatable in vast quantities of data, understand their meaning, and implement scalable monitoring across multiple data streams in order to monetize the discoveries and insights. Motif discovery and deep learning platforms are emerging to visualize sensor data, to search for patterns and to build application that can monitor real time streams efficiently. In his session at @ThingsExpo, ...
Jul. 26, 2016 04:30 PM EDT Reads: 1,011
You think you know what’s in your data. But do you? Most organizations are now aware of the business intelligence represented by their data. Data science stands to take this to a level you never thought of – literally. The techniques of data science, when used with the capabilities of Big Data technologies, can make connections you had not yet imagined, helping you discover new insights and ask new questions of your data. In his session at @ThingsExpo, Sarbjit Sarkaria, data science team lead ...
Jul. 26, 2016 04:00 PM EDT Reads: 1,027
Extracting business value from Internet of Things (IoT) data doesn’t happen overnight. There are several requirements that must be satisfied, including IoT device enablement, data analysis, real-time detection of complex events and automated orchestration of actions. Unfortunately, too many companies fall short in achieving their business goals by implementing incomplete solutions or not focusing on tangible use cases. In his general session at @ThingsExpo, Dave McCarthy, Director of Products...
Jul. 26, 2016 03:45 PM EDT Reads: 1,716
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...
Jul. 26, 2016 03:15 PM EDT Reads: 923
Amazon has gradually rolled out parts of its IoT offerings in the last year, but these are just the tip of the iceberg. In addition to optimizing their back-end AWS offerings, Amazon is laying the ground work to be a major force in IoT – especially in the connected home and office. Amazon is extending its reach by building on its dominant Cloud IoT platform, its Dash Button strategy, recently announced Replenishment Services, the Echo/Alexa voice recognition control platform, the 6-7 strategic...
Jul. 26, 2016 03:15 PM EDT Reads: 353
Verizon Communications Inc. (NYSE, Nasdaq: VZ) and Yahoo! Inc. (Nasdaq: YHOO) have entered into a definitive agreement under which Verizon will acquire Yahoo's operating business for approximately $4.83 billion in cash, subject to customary closing adjustments. Yahoo informs, connects and entertains a global audience of more than 1 billion monthly active users** -- including 600 million monthly active mobile users*** through its search, communications and digital content products. Yahoo also co...
Jul. 26, 2016 02:30 PM EDT Reads: 522
"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...
Jul. 26, 2016 01:45 PM EDT Reads: 1,996
SYS-CON Events announced today that LeaseWeb USA, a cloud Infrastructure-as-a-Service (IaaS) provider, will exhibit at the 19th International Cloud Expo, which will take place on November 1–3, 2016, at the Santa Clara Convention Center in Santa Clara, CA. LeaseWeb is one of the world's largest hosting brands. The company helps customers define, develop and deploy IT infrastructure tailored to their exact business needs, by combining various kinds cloud solutions.
Jul. 26, 2016 10:15 AM EDT Reads: 1,190
Is your aging software platform suffering from technical debt while the market changes and demands new solutions at a faster clip? It’s a bold move, but you might consider walking away from your core platform and starting fresh. ReadyTalk did exactly that. In his General Session at 19th Cloud Expo, Michael Chambliss, Head of Engineering at ReadyTalk, will discuss why and how ReadyTalk diverted from healthy revenue and over a decade of audio conferencing product development to start an innovati...
Jul. 26, 2016 09:15 AM EDT Reads: 1,020
SYS-CON Events announced today that Venafi, the Immune System for the Internet™ and the leading provider of Next Generation Trust Protection, will exhibit at @DevOpsSummit at 19th International Cloud Expo, which will take place on November 1–3, 2016, at the Santa Clara Convention Center in Santa Clara, CA. Venafi is the Immune System for the Internet™ that protects the foundation of all cybersecurity – cryptographic keys and digital certificates – so they can’t be misused by bad guys in attacks...
Jul. 26, 2016 08:45 AM EDT Reads: 1,325
It’s 2016: buildings are smart, connected and the IoT is fundamentally altering how control and operating systems work and speak to each other. Platforms across the enterprise are networked via inexpensive sensors to collect massive amounts of data for analytics, information management, and insights that can be used to continuously improve operations. In his session at @ThingsExpo, Brian Chemel, Co-Founder and CTO of Digital Lumens, will explore: The benefits sensor-networked systems bring to ...
Jul. 26, 2016 08:45 AM EDT Reads: 1,555
SYS-CON Events announced today that 910Telecom will exhibit at the 19th International Cloud Expo, which will take place on November 1–3, 2016, at the Santa Clara Convention Center in Santa Clara, CA. Housed in the classic Denver Gas & Electric Building, 910 15th St., 910Telecom is a carrier-neutral telecom hotel located in the heart of Denver. Adjacent to CenturyLink, AT&T, and Denver Main, 910Telecom offers connectivity to all major carriers, Internet service providers, Internet backbones and ...
Jul. 26, 2016 08:45 AM EDT Reads: 633
There will be new vendors providing applications, middleware, and connected devices to support the thriving IoT ecosystem. This essentially means that electronic device manufacturers will also be in the software business. Many will be new to building embedded software or robust software. This creates an increased importance on software quality, particularly within the Industrial Internet of Things where business-critical applications are becoming dependent on products controlled by software. Qua...
Jul. 26, 2016 06:15 AM EDT Reads: 1,438
SYS-CON Events has announced today that Roger Strukhoff has been named conference chair of Cloud Expo and @ThingsExpo 2016 Silicon Valley. The 19th Cloud Expo and 6th @ThingsExpo will take place on November 1-3, 2016, at the Santa Clara Convention Center in Santa Clara, CA. "The Internet of Things brings trillions of dollars of opportunity to developers and enterprise IT, no matter how you measure it," stated Roger Strukhoff. "More importantly, it leverages the power of devices and the Interne...
Jul. 26, 2016 05:15 AM EDT Reads: 2,130
Large scale deployments present unique planning challenges, system commissioning hurdles between IT and OT and demand careful system hand-off orchestration. In his session at @ThingsExpo, Jeff Smith, Senior Director and a founding member of Incenergy, will discuss some of the key tactics to ensure delivery success based on his experience of the last two years deploying Industrial IoT systems across four continents.
Jul. 26, 2016 05:00 AM EDT Reads: 1,542