|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.
Cloud computing is being adopted in one form or another by 94% of enterprises today. Tens of billions of new devices are being connected to The Internet of Things. And Big Data is driving this bus. An exponential increase is expected in the amount of information being processed, managed, analyzed, and acted upon by enterprise IT. This amazing is not part of some distant future - it is happening today. One report shows a 650% increase in enterprise data by 2020. Other estimates are even higher....
Sep. 28, 2016 03:15 PM EDT Reads: 4,133
What are the new priorities for the connected business? First: businesses need to think differently about the types of connections they will need to make – these span well beyond the traditional app to app into more modern forms of integration including SaaS integrations, mobile integrations, APIs, device integration and Big Data integration. It’s important these are unified together vs. doing them all piecemeal. Second, these types of connections need to be simple to design, adapt and configure...
Sep. 28, 2016 03:15 PM EDT Reads: 334
Digital innovation is the next big wave of business transformation based on digital technologies of which IoT and Big Data are key components, For example: Business boundary innovation is a challenge to excavate third-party business value using IoT and BigData, like Nest Business structure innovation may propose re-building business structure from scratch, as Uber does in the taxicab industry The social model innovation is also a big challenge to the new social architecture with the design fr...
Sep. 28, 2016 03:15 PM EDT Reads: 1,302
A strange thing is happening along the way to the Internet of Things, namely far too many devices to work with and manage. It has become clear that we'll need much higher efficiency user experiences that can allow us to more easily and scalably work with the thousands of devices that will soon be in each of our lives. Enter the conversational interface revolution, combining bots we can literally talk with, gesture to, and even direct with our thoughts, with embedded artificial intelligence, wh...
Sep. 28, 2016 03:00 PM EDT Reads: 3,862
Data is an unusual currency; it is not restricted by the same transactional limitations as money or people. In fact, the more that you leverage your data across multiple business use cases, the more valuable it becomes to the organization. And the same can be said about the organization’s analytics. In his session at 19th Cloud Expo, Bill Schmarzo, CTO for the Big Data Practice at EMC, will introduce a methodology for capturing, enriching and sharing data (and analytics) across the organizati...
Sep. 28, 2016 02:45 PM EDT Reads: 1,737
SYS-CON Events announced today that Bsquare has been named “Silver Sponsor” of SYS-CON's @ThingsExpo, which will take place on November 1–3, 2016, at the Santa Clara Convention Center in Santa Clara, CA. For more than two decades, Bsquare has helped its customers extract business value from a broad array of physical assets by making them intelligent, connecting them, and using the data they generate to optimize business processes.
Sep. 28, 2016 02:30 PM EDT Reads: 2,922
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...
Sep. 28, 2016 02:30 PM EDT Reads: 3,309
19th Cloud Expo, taking place November 1-3, 2016, at the Santa Clara Convention Center in Santa Clara, CA, 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. Meanwhile, 94% of enterpri...
Sep. 28, 2016 02:00 PM EDT Reads: 4,419
In this strange new world where more and more power is drawn from business technology, companies are effectively straddling two paths on the road to innovation and transformation into digital enterprises. The first path is the heritage trail – with “legacy” technology forming the background. Here, extant technologies are transformed by core IT teams to provide more API-driven approaches. Legacy systems can restrict companies that are transitioning into digital enterprises. To truly become a lea...
Sep. 28, 2016 01:57 PM EDT Reads: 238
According to Forrester Research, every business will become either a digital predator or digital prey by 2020. To avoid demise, organizations must rapidly create new sources of value in their end-to-end customer experiences. True digital predators also must break down information and process silos and extend digital transformation initiatives to empower employees with the digital resources needed to win, serve, and retain customers.
Sep. 28, 2016 01:23 PM EDT Reads: 255
Businesses are struggling to manage the information flow and interactions between all of these new devices and things jumping on their network, and the apps and IT systems they control. The data businesses gather is only helpful if they can do something with it. In his session at @ThingsExpo, Chris Witeck, Principal Technology Strategist at Citrix, will discuss how different the impact of IoT will be for large businesses, expanding how IoT will allow large organizations to make their legacy ap...
Sep. 28, 2016 01:00 PM EDT Reads: 181
Video experiences should be unique and exciting! But that doesn’t mean you need to patch all the pieces yourself. Users demand rich and engaging experiences and new ways to connect with you. But creating robust video applications at scale can be complicated, time-consuming and expensive. In his session at @ThingsExpo, Zohar Babin, Vice President of Platform, Ecosystem and Community at Kaltura, will discuss how VPaaS enables you to move fast, creating scalable video experiences that reach your...
Sep. 28, 2016 01:00 PM EDT Reads: 1,105
In his keynote at 18th Cloud Expo, Andrew Keys, Co-Founder of ConsenSys Enterprise, provided an overview of the evolution of the Internet and the Database and the future of their combination – the Blockchain. Andrew Keys is Co-Founder of ConsenSys Enterprise. He comes to ConsenSys Enterprise with capital markets, technology and entrepreneurial experience. Previously, he worked for UBS investment bank in equities analysis. Later, he was responsible for the creation and distribution of life sett...
Sep. 28, 2016 01:00 PM EDT Reads: 3,548
SYS-CON Events announced today that SoftLayer, an IBM Company, has been named “Gold Sponsor” of SYS-CON's 18th Cloud Expo, which will take place on June 7-9, 2016, at the Javits Center in New York, New York. SoftLayer, an IBM Company, provides cloud infrastructure as a service from a growing number of data centers and network points of presence around the world. SoftLayer’s customers range from Web startups to global enterprises.
Sep. 28, 2016 12:30 PM EDT Reads: 1,051
Internet of @ThingsExpo, taking place November 1-3, 2016, at the Santa Clara Convention Center in Santa Clara, CA, is co-located with 19th Cloud Expo and will feature technical sessions from a rock star conference faculty and the leading industry players in the world. The Internet of Things (IoT) is the most profound change in personal and enterprise IT since the creation of the Worldwide Web more than 20 years ago. All major researchers estimate there will be tens of billions devices - comp...
Sep. 28, 2016 12:30 PM EDT Reads: 5,104
One of biggest questions about Big Data is “How do we harness all that information for business use quickly and effectively?” Geographic Information Systems (GIS) or spatial technology is about more than making maps, but adding critical context and meaning to data of all types, coming from all different channels – even sensors. In his session at @ThingsExpo, William (Bill) Meehan, director of utility solutions for Esri, will take a closer look at the current state of spatial technology and ar...
Sep. 28, 2016 12:20 PM EDT Reads: 211
The vision of a connected smart home is becoming reality with the application of integrated wireless technologies in devices and appliances. The use of standardized and TCP/IP networked wireless technologies in line-powered and battery operated sensors and controls has led to the adoption of radios in the 2.4GHz band, including Wi-Fi, BT/BLE and 802.15.4 applied ZigBee and Thread. This is driving the need for robust wireless coexistence for multiple radios to ensure throughput performance and th...
Sep. 28, 2016 12:00 PM EDT Reads: 1,661
Fifty billion connected devices and still no winning protocols standards. HTTP, WebSockets, MQTT, and CoAP seem to be leading in the IoT protocol race at the moment but many more protocols are getting introduced on a regular basis. Each protocol has its pros and cons depending on the nature of the communications. Does there really need to be only one protocol to rule them all? Of course not. In his session at @ThingsExpo, Chris Matthieu, co-founder and CTO of Octoblu, walk you through how Oct...
Sep. 28, 2016 12:00 PM EDT Reads: 2,280
“We're a global managed hosting provider. Our core customer set is a U.S.-based customer that is looking to go global,” explained Adam Rogers, Managing Director at ANEXIA, in this SYS-CON.tv interview at 18th Cloud Expo, held June 7-9, 2016, at the Javits Center in New York City, NY.
Sep. 28, 2016 11:45 AM EDT Reads: 3,096
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...
Sep. 28, 2016 11:45 AM EDT Reads: 2,129