Smart Reloading of Java Web Applications in Web Server 7.0

One of the cool new features in Sun Java System Web Server 7 is its ability to detect and dynamically reload (without having to restart the server) web applications that have changed. During web application development, it becomes very tedious and time consuming if one has to restart the server to test every change made. Requiring a server restart also prevents the ability to do web application development on a shared server without disruption to the other users of the server.

The ability to dynamically reconfigure many of the our web server's settings (including web applications) without having to restart the server was first introduced in iPlanet Web Server 6.0 and this feature was improved upon in the Sun ONE Web Server 6.1 release. Although both Web Server 6.0 and 6.1 didn't require that you restart the server to reload a web application, they did implicitly reload all web applications when the server was dynamically reconfigured. While this brute force approach to dynamically reloading web applications wasn't quite as expensive as restarting the server, it - i.e. dynamically reconfiguring the server - did have a few undesirable and unexpected side-effects namely,

  • each web application was reloaded even if it hadn't changed
  • all in-memory web application session data was lost
  • one had to wait until all web applications had been reloaded in order to test any change made to a single web application

Web Server 7 has addressed all of the above limitations of the previous releases. Web Server 7 can intelligently detect which of the web applications have changed and only reload those that have. You can also deploy and undeploy web applications without restarting the server.

For example, if you have a Web Server 7 instance with 2 web applications deployed at /foo and /bar respectively, when you start the server you will see something similar to the following:

% bin/startserv
Sun Java System Web Server 7.0U1 B05/07/2007 00:21
info: CORE5076: Using [Java HotSpot(TM) Server VM, Version 1.5.0_09] from [Sun Microsystems Inc.]
info: WEB0100: Loading web module in virtual server [server] at [/foo]
info: WEB0100: Loading web module in virtual server [server] at [/bar]
info: HTTP3072: http-listener-1: http://server:7080 ready to accept requests
info: CORE3274: successful server startup

If you reconfigure the instance without modifying either of the web applications, you will notice that the server does not reload either web application.

% bin/reconfig
info ( 1170): CORE3276: Installing a new configuration
info ( 1170): CORE3280: A new configuration was successfully installed

If you modify one of the web applications and reconfigure the instance, the server correctly reloads only the web application that was modified.

% touch web-app/foo/WEB-INF/web.xml 
% bin/reconfig
info ( 1170): CORE3276: Installing a new configuration
info ( 1170): WEB0100: Loading web module in virtual server [server] at [/foo]
info ( 1170): CORE3280: A new configuration was successfully installed

By only reloading those web applications that have changed, in-memory session data for the other web applications is preserved across dynamic reconfigurations and the time taken to complete a dynamic reconfiguration is also less than was the case in previous releases of the web server.

You can dynamically reload a web application (that is deployed on a running Web Server 7 instance) without restarting the server when

  • you make changes to any servlets in the application (changes to JSPs do not require that the web application be reloaded)
  • you make changes to the web application deployment descriptors i.e. WEB-INF/web.xml, WEB-INF/sun-web.xml
  • you make changes to the <servlet-container> settings in instance_dir/config/server.xml
  • you make changes to the global web deployment descriptor instance_dir/config/default-web.xml

When you make a change that affects all web applications, the server detects this and reloads all the applications when the instance is reconfigured. For example, if you change the global web deployment descriptor that is common to all web applications and reconfigure the server you will see that the server reloads all the web applications.

% touch config/default-web.xml
% bin/reconfig
info ( 1170): CORE3276: Installing a new configuration
info ( 1170): WEB0100: Loading web module in virtual server [server] at [/foo]
info ( 1170): WEB0100: Loading web module in virtual server [server] at [/bar]
info ( 1170): CORE3280: A new configuration was successfully installed

Changes to the following settings require that you restart the server

A web application deployed on Web Server 7 can be dynamically reloaded either by executing a command or at specific intervals or as per a specific schedule. You do not have to specify which web applications have been modified, the server automatically detects this.

Reload-on-demand: After making changes to the web application(s), you reconfigure the instance. Reconfiguring the instance instantly loads all the changes made to any/all web application(s). You can reconfigure the instance either from the Administration Graphical User Interface or by running instance_dir/bin/reconfig or by using the wadm reconfig-instance command.

Reload-at-intervals:Enable dynamic reloading of web applications. The dynamic reload interval that you specify determines that interval (in seconds) at which the web applications are checked for modifications and reloaded if necessary.

Reload-by-schedule: Schedule an event to reconfigure the instance. When the event is executed at the scheduled time/interval, the deployed web applications are checked for modifications and reloaded if necessary.

Thus, you can see that you have flexibility in configuring when your web applications should be checked for modifications and reloaded if necessary. I hope you find that the new and improved dynamic reloading feature of Sun Java System Web Server 7 improves your productivity as a developer and deployer of Java content. Please let me know if you have any feedback about this feature.

Comments:

the smart is very good bussiness,i like smart.

Posted by arlene cahanap on October 31, 2008 at 02:25 PM PDT #

Thank you.

Posted by Arvind Srinivasan on October 31, 2008 at 02:54 PM PDT #

Post a Comment:
  • HTML Syntax: NOT allowed
About

arvindsrinivasan

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today