Hitachi

uCosminexus Application Server Operation, Monitoring, and Linkage Guide


5.3.5 Example of setting timeout value and the range of setting values

This section provides an example to set the timeout value and the range of the settings value when using the functionality for monitoring the J2EE application execution time for Web applications and for EJB.

Organization of this subsection

(1) In the case of Web application

The following sections explain the settings of the timeout value for the Web applications:

(a) Invocation of filter, servlet, or JSP

The following figure shows the timeout settings for filter, servlet, or JSP invocation:

Figure 5‒3: Timeout settings for filter, servlet, or JSP invocation

[Figure]

You need to set the timeout value for each location appropriately after considering the invocation sequence. For example, the timeout value of the doFilter method of the range A in the figure is applied to the monitoring of the process time from start of method until its completion. For this reason, when the process time of B or C reaches the time set in timeout value of A, timeout occurs at that time. As shown in the following example:

Example where timeout occurs during processing

It is assumed that the time shown in the following table is set as the timeout value of each of A, B, C in the figure:

Table 5‒7: Example of settings 1 for timeout value

Location

Timeout value that has been set

A in the figure (doFilter method of filter)

240 seconds

B in the figure (Servlet)

180 seconds

C in the figure (JSP)

120 seconds

In the case of such settings, the following time is taken for the processing from A to B and the processing from B to C:

  • Process from A to B: 120 seconds

  • Process from B to C: 60 seconds

Here, if the process in C takes more than 60 seconds, timeout occurs before process completion as the timeout value of A in the figure is reached in 240 seconds.

■ Precautions when specifying the settings

In the extension of processes within the servlets or JSPs performing uploads and downloads, there are times when communication with the client occurs. In such cases, since uploading and downloading are handled as processing of servlets and JSP, the execution time of the method is monitored.

For this reason, you need to set the timeout for the servlets and JSPs performing uploads and downloads after considering the communication delays with the client. Especially for downloads, a dialog is displayed in the browser to confirm the download with the client. In such cases, note that the download is not complete (Servlet or JSP process does not complete) until the user on the client performs operations in the dialog for download confirmation, depending upon the data quantity to be downloaded.

Note that when using a filter, the same precaution is required for the corresponding filter.

(b) Initial request to servlet

During initial access to a servlet, the timeout value set in the service method of the servlet becomes valid.

However, in the case of a servlet or JSP where the <load-on-startup> tag of DD (web.xml) is not set, init method is executed during initial request. At this time, the timeout value set in the service method of corresponding servlet or JSP becomes valid in the init method.

Moreover, even in the destroy method executed when javax.servlet.UnavailableException is thrown, indicating that the servlet or JSP cannot be used in the service method, the timeout value set in the service method of the corresponding servlet or JSP is applied.

The following figure shows the timeout settings for the initial request to a servlet:

Figure 5‒4: Timeout settings for the initial request to a servlet

[Figure]

(c) Initial request of servlets or JSPs passing through a filter

The following figure shows the timeout settings for the initial request of servlets and JSPs passing through a filter:

Figure 5‒5: Timeout settings for the initial request of servlets passing through a filter

[Figure]

Figure 5‒6: Timeout settings for the initial request of JSPs passing through a filter

[Figure]

In the filter process extensions, the filter timeout value when a servlet or JSP is invoked needs to be set after considering the timeout value of servlet or JSP invoked in filter extension.

For example, in case of Figure 5-6, the timeout value of the filter of range A in the figure is applied to filter process time. For this reason, when the process time of B or C reaches the time set in timeout value of A, timeout occurs at that time. The following example shows the case of Figure 5-6:

Example where timeout occurs during processing

It is assumed that the time shown in the following table is set as the timeout value of each of A, B, C in the figure:

Table 5‒8: Example of settings 2 for timeout value

Location

Timeout value that has been set

A in the figure (filter)

240 seconds

B and C in the figure (servlet)

180 seconds

For such settings, the following time is taken for the processing in the filter and in the servlet:

  • Processing in the filter: 60 seconds

  • Processing in the init method of the servlet: 120 seconds

At this time, if the process in the service method of the servlet takes more than 60 seconds, as the timeout value of A in the figure is reached in 240 seconds, timeout occurs before process completion of the service method of the servlet.

Moreover, in the case of servlet or JSP where the <servlet> tag of DD (web.xml) is defined but the <load-on-startup> tag is not set, the init method of servlet or JSP is executed when executing the initial request in the extension of the doFilter method of the filter. The following table shows the timing when the init method is executed.

Table 5‒9: Timing when the 'init' method is executed

Target

Definition of <servlet> tag

Definition of <load-on-startup> tag

Timing when the 'init' method is executed

Servlet

Defined

None

Before the doFilter method is called

None

None

Extension of the doFilter method

JSP

Defined

None

Extension of the doFilter method

None

None

Extension of the doFilter method

At this time, one of the following values is applied to the timeout value of the init method:

  • When the Timeout-value-of-filterTimeout-value-of-Web-application

    The timeout value set in the service method of the corresponding servlet or JSP becomes valid.

  • When the Timeout-value-of-the-filter < Timeout-value-of-Web-application

    The timeout value set in the filter becomes valid.

(2) In the case of EJB

The following figure shows the timeout settings for business method invocation of Stateless Session Bean. Note that the same settings can also be performed for other Bean types (Stateful Session Bean, Entity Bean, and Message-driven Bean).

Figure 5‒7: Timeout settings for business method invocation of Stateless Session Bean

[Figure]

Timeout occurs if the time set in the timeout value of the business method is exceeded.

Further, since the callback invoked in the EJB method invocation extension is a part of the business process, consider the execution time of the callback method when setting the timeout value. For details on the callback invoked in each method, see 5.3.8(2) Setting the timeout value in the method invocation process of the Enterprise Bean.