|By Steve Mueller, Scot Weber||
|June 20, 2002 12:00 AM EDT||
Welcome to this edition of "In the Admin Corner," a new monthly column devoted to the administration, configuration, management, and deployment aspects of WebLogic Server.
The goal of this column is to provide you with a closer look at the nondevelopment issues of J2EE that are commonly encountered when working with WLS. Developers and administrators alike will find this column to be of value, as the material applies to both the development and production ends of the application spectrum. Furthermore, this feature draws heavily upon experiences from both the field and the engineering lab, providing detailed answers to real-world problems that go beyond the hand-waving solutions of corridor conversations and whiteboard sessions.
The Need for JSP Precompilation
This month's article looks at removing a potential system performance bottleneck by addressing one of the most common problems that plague nearly all J2EE development projects - the overhead of JavaServer Page (JSP) compilation at server runtime. Although JSPs are the ideal choice for presenting dynamic HTML views within J2EE applications, they do impact performance in a way that, while more annoying than detrimental, initially creates the perception that the application is slow.
According to the J2EE specification, JSPs are primarily HTML files in which embedded Java code is utilized to interact with other system components and present information dynamically. The specification states that all J2EE-compliant application servers supporting JSP, upon a client request for a given JSP, will
While this is an excellent approach - from a development perspective - for managing dynamic HTML generation within the presentation layer, its impact on the server runtime environment requires a JSP to be parsed, converted to Java code, and compiled before it is executed to handle a given client request. The obvious impact on the end user is that a response will, at minimum, be delayed by the time it takes for the JSP compilation phase to occur for one given JSP file. Take into account the possibility that a given user request may hit two or more JSP files within the same request, and suddenly the time required for the compilation phase is multiplied that many more times.
For the end user who first hits a given JSP and thus forces the initial compilation of the requested file, the perception is that the application is slow and unresponsive. Although such a perception may exist, the compilation process for a given JSP file is generally done once in the lifespan of a given app server VM instance. Therefore, its overall impact on performance is considered to be a nuisance, rather than a critical roadblock to the overall response time of the application. Nonetheless, production systems that aim to deliver a JSP-based J2EE application in a production environment must overcome the pitfalls of JSP and make compilation transparent to the end user.
So how can a production environment benefit from the use of JSP files, yet escape the performance hit of runtime compilation? The answer is simple - implement a process commonly referred to as JSP precompilation. With JSP precompilation, JSP files and their compiled equivalents are deployed into a production environment, having already been precompiled in an offline environment. If precompilation and deployment of the resultant class files are done correctly, the application server will execute the previously compiled classes for the JSP files, and will not force a given request to recompile the JSP at runtime. This creates a situation in which the application operates without the unnecessary overhead of compilation, allowing the administrator to remove a perceived bottleneck to the overall performance of the system.
Different Methodologies and Approaches
There's no doubt that the promises of JSP precompilation sound exciting. However, in order to fulfill such promises, you must first understand the different approaches that can be taken to implement the technique, and the advantages and disadvantages of each.
Exercising the Application to Force Precompilation
The most obvious approach used to implement JSP precompilation is to exercise a given site application by requesting all possible JSP pages in the application before the production release, so compilation is done before end users access the site. This can be done either by manually browsing the entire site for the first time or by launching automated requests from test suite applications or other scripted clients (such as LoadRunner or SilkPerformer). While this approach appears to have the downside of being the simplest of all possible JSP precompilation methods, its disadvantages quickly become apparent. Perhaps the biggest disadvantage here is that it's difficult to implement across clustered environments, where the number of requests once required by this approach for a single node instance are now multiplied by the number of nodes within the cluster. Furthermore, it's even harder to ensure that each server instance within a clustered environment undergoes JSP precompilation when the cluster is proxied by one or more Web servers or hardware load balancers, since there is generally no way of knowing to which app server the proxy will initially forward the request. Additionally, this method must be implemented every time the application server is recycled, making it a painful task that cannot be accomplished for all but the smallest of sites. Therefore, we don't recommend this approach to JSP precompilation.
Using Compilation Tools to Implement Precompilation
Since manually exercising a site application to force JSP precompilation has significant disadvantages in real-world production environments, the alternative of compiling the JSPs into servlets during preproduction runtime becomes much more enticing. Fortunately, WLS offers two methods to do this. The first way performs precompilation at server startup during deployment of a given Web application (declarative precompilation), while the second offers a command-line Java tool (weblogic.jspc) to allow the process to be handled completely offline (programmatic precompilation). While both have their advantages, programmatic precompilation is the more flexible option of the two, and offers more compelling reasons to be used.
For declarative precompilation under WLS, a given Web application (standalone or as part of an EAR) can be configured so all of its JSPs are precompiled during application deployment (at server startup) and redeployment (at runtime). The necessary configuration changes are made to the WEB-INF/weblogic.xml deployment descriptor, which uses the precompile <jsp-param/> directive as follows:
Upon deployment (or redeployment) of a given Web application, WLS will attempt to precompile all JSP files within the WAR if the above parameter is set to true, recursively working its way down from the root directory of the Web application in the process (and skipping over WEB-INF). Files with either a .jsp or .JSP extension become targets for compilation. Compiled class files are then placed underneath the temporary working directory of the Web application (by default a subdirectory of WEB-INF, unless explicitly specified within weblogic.xml) in the appropriate package directory structure.
While this method is by far the most convenient approach to JSP precompilation (the "flick-a-switch" approach), it has a number of disadvantages that render it almost useless. If an error occurs during compilation of a JSP at the time of deployment (or redeployment), precompilation of the Web application will halt at the point of the exception. Additionally, in situations where there are a large number of JSP files within a given Web application, declarative precompilation significantly impacts deployment time, blocking the deployment until all of the files have been compiled. For large applications, such deployment times tend to be on the order of minutes (10 to 15 minutes in some cases, potentially even longer in others) when hundreds of JSP files are present and declarative precompilation is implemented. Imagine starting a server instance in which a given Web application cycles into the deployment phase with declarative precompilation enabled. If there are a large number of JSP files within the app, and the deployment, nearing completion and having already taken a significant amount of time, suddenly fails because an exception is thrown during compilation, frustration will surely ensue. While convenient at first look, declarative compilation poses a significant risk to production system management and should be utilized only with great consideration.
The most reliable way to precompile JSP files under WLS is to use the Java command-line utility, weblogic.jspc, located in the weblogic.jar file under the lib directory of the WLS installation. This tool allows a developer to compile the desired JSP files during the development phase and iron out compile-time issues before deployment. It also provides an administrator with the ability to implement JSP precompilation for production systems. The major benefits of this utility are:
The drawbacks are that using weblogic.jspc requires manual intervention and that it must be rerun when JSP files become out-of-date in development. However, given the issues with the other two methods discussed above, we hardly find this inconvenience to be a disadvantage, and recommend it as the most reliable and flexible mechanism to implement JSP precompilation.
In order to use weblogic.jspc effectively, you must first understand its usage and syntax. For this article, we will utilize the features of the tool from WLS 6.1 SP2. Note: The syntax and best practices given below should apply to all versions of WLS 6.1 and in part to the new WLS 7.0.
To invoke the command-line JSP compiler (weblogic.jspc), you must ensure the following:
Before executing weblogic.jspc for the first time, it's a good idea to quickly test your command-line configuration as set above. This can be achieved by simply running a version check of WLS with the command, "java weblogic.version", which should return the following:
WebLogic Server 6.1 SP2 12/18/2001 11:13:46 #154529
WebLogic XML Module 6.1 SP2 12/18/2001 11:28:02 #154529
If your output isn't similar to the above (appropriate to the version you are running), be sure to revisit the PATH and classpath variables set within your current command-line environment before proceeding with JSP precompilation.
The general syntax of weblogic.jspc is given below:
java weblogic.jspc [options] <jsp files>...
The JSP compiler can by default compile a single JSP file or a set of JSPs in a single invocation of the compiler, and can be configured in a number of different ways via command-line options. A working example is provided:
This article shows a single example, but so you may better understand how weblogic.jspc can be used and managed in your environment, we provide the complete set of working options, implications of use, and associated issues at www.slackwerks.com/wldj.
While the argument for JSP precompilation can easily be made, there are a number of approaches that can be taken to implement it. However, given the advantages and disadvantages of those shown above, it should be readily apparent that programmatic precompilation via weblogic.jspc provides the most flexible option for overcoming the pitfalls inherent to JSP. Becoming familiar with the tool early in the development cycle will improve the administration and performance aspects of the application during production.
Today we can collect lots and lots of performance data. We build beautiful dashboards and even have fancy query languages to access and transform the data. Still performance data is a secret language only a couple of people understand. The more business becomes digital the more stakeholders are interested in this data including how it relates to business. Some of these people have never used a monitoring tool before. They have a question on their mind like “How is my application doing” but no id...
Aug. 25, 2016 10:15 PM EDT Reads: 1,706
Identity is in everything and customers are looking to their providers to ensure the security of their identities, transactions and data. With the increased reliance on cloud-based services, service providers must build security and trust into their offerings, adding value to customers and improving the user experience. Making identity, security and privacy easy for customers provides a unique advantage over the competition.
Aug. 25, 2016 09:15 PM EDT Reads: 2,186
Is the ongoing quest for agility in the data center forcing you to evaluate how to be a part of infrastructure automation efforts? As organizations evolve toward bimodal IT operations, they are embracing new service delivery models and leveraging virtualization to increase infrastructure agility. Therefore, the network must evolve in parallel to become equally agile. Read this essential piece of Gartner research for recommendations on achieving greater agility.
Aug. 25, 2016 05:15 PM EDT Reads: 641
Smart Cities are here to stay, but for their promise to be delivered, the data they produce must not be put in new siloes. In his session at @ThingsExpo, Mathias Herberts, Co-founder and CTO of Cityzen Data, will deep dive into best practices that will ensure a successful smart city journey.
Aug. 25, 2016 03:30 PM EDT Reads: 1,490
DevOps at Cloud Expo, taking place Nov 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 widespread success of cloud computing is driving the DevOps revolution in enterprise IT. Now as never before, development teams must communicate and collaborate in a dynamic, 24/7/365 environment. There is no time to wait for long dev...
Aug. 25, 2016 03:15 PM EDT Reads: 2,215
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...
Aug. 25, 2016 02:00 PM EDT Reads: 3,546
The 19th International Cloud Expo has announced that its Call for Papers is open. Cloud Expo, to be held November 1-3, 2016, at the Santa Clara Convention Center in Santa Clara, CA, brings together Cloud Computing, Big Data, Internet of Things, DevOps, Digital Transformation, 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 opportuni...
Aug. 25, 2016 01:00 PM EDT Reads: 3,892
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...
Aug. 25, 2016 01:00 PM EDT Reads: 2,596
SYS-CON Events announced today Telecom Reseller has been named “Media Sponsor” of SYS-CON's 19th International Cloud Expo, which will take place on November 1–3, 2016, at the Santa Clara Convention Center in Santa Clara, CA. Telecom Reseller reports on Unified Communications, UCaaS, BPaaS for enterprise and SMBs. They report extensively on both customer premises based solutions such as IP-PBX as well as cloud based and hosted platforms.
Aug. 25, 2016 09:00 AM EDT Reads: 583
For basic one-to-one voice or video calling solutions, WebRTC has proven to be a very powerful technology. Although WebRTC’s core functionality is to provide secure, real-time p2p media streaming, leveraging native platform features and server-side components brings up new communication capabilities for web and native mobile applications, allowing for advanced multi-user use cases such as video broadcasting, conferencing, and media recording.
Aug. 25, 2016 08:45 AM EDT Reads: 2,116
Data is the fuel that drives the machine learning algorithmic engines and ultimately provides the business value. In his session at Cloud Expo, Ed Featherston, a director and senior enterprise architect at Collaborative Consulting, will discuss the key considerations around quality, volume, timeliness, and pedigree that must be dealt with in order to properly fuel that engine.
Aug. 25, 2016 08:30 AM EDT Reads: 1,758
Pulzze Systems was happy to participate in such a premier event and thankful to be receiving the winning investment and global network support from G-Startup Worldwide. It is an exciting time for Pulzze to showcase the effectiveness of innovative technologies and enable them to make the world smarter and better. The reputable contest is held to identify promising startups around the globe that are assured to change the world through their innovative products and disruptive technologies. There w...
Aug. 25, 2016 08:30 AM EDT Reads: 489
Akana has announced the availability of version 8 of its API Management solution. The Akana Platform provides an end-to-end API Management solution for designing, implementing, securing, managing, monitoring, and publishing APIs. It is available as a SaaS platform, on-premises, and as a hybrid deployment. Version 8 introduces a lot of new functionality, all aimed at offering customers the richest API Management capabilities in a way that is easier than ever for API and app developers to use.
Aug. 25, 2016 06:00 AM EDT Reads: 1,443
Personalization has long been the holy grail of marketing. Simply stated, communicate the most relevant offer to the right person and you will increase sales. To achieve this, you must understand the individual. Consequently, digital marketers developed many ways to gather and leverage customer information to deliver targeted experiences. In his session at @ThingsExpo, Lou Casal, Founder and Principal Consultant at Practicala, discussed how the Internet of Things (IoT) has accelerated our abil...
Aug. 25, 2016 02:00 AM EDT Reads: 1,920
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 ...
Aug. 25, 2016 02:00 AM EDT Reads: 1,813
With so much going on in this space you could be forgiven for thinking you were always working with yesterday’s technologies. So much change, so quickly. What do you do if you have to build a solution from the ground up that is expected to live in the field for at least 5-10 years? This is the challenge we faced when we looked to refresh our existing 10-year-old custom hardware stack to measure the fullness of trash cans and compactors.
Aug. 25, 2016 01:15 AM EDT Reads: 1,647
The emerging Internet of Everything creates tremendous new opportunities for customer engagement and business model innovation. However, enterprises must overcome a number of critical challenges to bring these new solutions to market. In his session at @ThingsExpo, Michael Martin, CTO/CIO at nfrastructure, outlined these key challenges and recommended approaches for overcoming them to achieve speed and agility in the design, development and implementation of Internet of Everything solutions wi...
Aug. 25, 2016 12:45 AM EDT Reads: 1,930
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...
Aug. 25, 2016 12:00 AM EDT Reads: 3,000
In today's uber-connected, consumer-centric, cloud-enabled, insights-driven, multi-device, global world, the focus of solutions has shifted from the product that is sold to the person who is buying the product or service. Enterprises have rebranded their business around the consumers of their products. The buyer is the person and the focus is not on the offering. The person is connected through multiple devices, wearables, at home, on the road, and in multiple locations, sometimes simultaneously...
Aug. 24, 2016 09:45 AM EDT Reads: 2,280
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...
Aug. 24, 2016 04:30 AM EDT Reads: 2,240