Administration and Configuration Guide

     Previous  Next    Open TOC in new window    View as PDF - New Window  Get Adobe Reader - New Window
Content starts here

Configuring Jetty for Oracle Complex Event Processing

This section contains information on the following subjects:

 


Overview of Jetty Support in Oracle Complex Event Processing

Oracle Complex Event Processing (or Oracle CEP for short) supports Jetty as Java Web server to deploy HTTP servlets and static resources.

Oracle CEP support for Jetty is based on Version 1.2 the OSGi HTTP Service. This API provides ability to dynamically register and unregister javax.servlet.Servlet objects with the run time and static resources. This specification requires at minimum version 2.1 of the Java Servlet API.

Oracle CEP supports the following features for Jetty:

For details about configuring Jetty, see Configuring a Jetty Server Instance.

Servlets

In addition to supporting typical (synchronous) Java servlets, Oracle CEP supports asynchronous servlets. An asynchronous servlet receives a request, gets a thread and performs some work, and finally releases the thread while waiting for those actions to complete before re-acquiring another thread and sending a response.

Network I/O Integration

Oracle CEP uses network I/O (NetIO) to configure the port and listen address of Jetty services.

Note: Jetty has a built-in capability for multiplexed network I/O. However, it does not support multiple protocols on the same port.

Thread Pool Integration

Oracle CEP Jetty services use the Oracle CEP Work Manager to provide for scalable thread pooling. See </config>.

Note: Jetty provides its own thread pooling capability. However, Oracle recommends using the Oracle CEP self-tuning thread pool to minimize footprint and configuration complexity.

Work Managers

Oracle CEP allows you to configure how your application prioritizes the execution of its work. Based on rules you define and by monitoring actual run time performance, you can optimize the performance of your application and maintain service level agreements. You define the rules and constraints for your application by defining a work manager.

Understanding How Oracle CEP Uses Thread Pools

Oracle CEP uses is a single thread pool, in which all types of work are executed. Oracle CEP prioritizes work based on rules you define, and run-time metrics, including the actual time it takes to execute a request and the rate at which requests are entering and leaving the pool.

The common thread pool changes its size automatically to maximize throughput. The queue monitors throughput over time and based on history, determines whether to adjust the thread count. For example, if historical throughput statistics indicate that a higher thread count increased throughput, Oracle CEP increases the thread count. Similarly, if statistics indicate that fewer threads did not reduce throughput, Oracle CEP decreases the thread count.

Understanding Work Manager

Oracle CEP prioritizes work and allocates threads based on an execution model that takes into account defined parameters and run-time performance and throughput.

You can configure a set of scheduling guidelines and associate them with one or more applications, or with particular application components. For example, you can associate one set of scheduling guidelines for one application, and another set of guidelines for other applications. At run time, Oracle CEP uses these guidelines to assign pending work and enqueued requests to execution threads.

To manage work in your applications, you define one or more of the following work manager components:

Note: The value of a fair share request class is specified as a relative value, not a percentage. Therefore, in the above example, if the request classes were defined as 400 and 100, they would still have the same relative values.

 


Configuring a Jetty Server Instance

You use the following configuration objects to configure an instance of the Jetty HTTP server in the config.xml file that describes your Oracle CEP domain:

Use the <jetty-web-app> configuration object to define a Web application in the Jetty instance; see jetty-web-app Configuration Object for details.

See Example Jetty Configuration for a sample of using each of the preceding configuration objects.

jetty Configuration Object

Use the parameters described in the following table to define a <jetty> configuration object in your config.xml file.

Table 8-1 Configuration Parameters for <jetty>
Parameter
Type
Description
network-io-name
String
The name of the NetIO service used. The NetIO service defines the port the server listens on.
See netio Configuration Object for details.
work-manager-name
String
The name of the Work Manager that should be used for thread pooling. If not specified, the default work manager is used.
scratch-directory
String
The name of a directory where temporary files required for web apps, JSPs, and other types of web artifacts are kept.

debug-enabled

boolean
Enable debugging in the Jetty code using the OSGi Log Service.
name
String
The name of the jetty server instance.

netio Configuration Object

Use the parameters described in the following table to define a <netio> configuration object in your config.xml file.

Table 8-2 Configuration Parameters for <netio>
Parameter
Type
Description
name
String
The name of this configuration object.
port
int
The listening port number.
listen-address
String
The address on which an instance of netio service listens for incoming connections.
  • It may be set to a numeric IP address in the a.b.c.d format, or to a host name.
  • If not set, the service listens on all network interfaces.

Note: The value of this parameter cannot be validated until the service has started.

work-manager Configuration Object

Use the parameters described in the following table to define a <work-manager> configuration object in your config.xml file.

Table 8-3 Configuration Parameters for <work-manager>
Parameter
Type
Description
min-threads-constraint
Integer
The minimum threads this work manager uses.
fairshare
Integer
The fairshare value this work manager uses.
max-threads-constraint
Integer
The maximum threads constraint this work manager uses.
name
String
The name of this work manager.

jetty-web-app Configuration Object

Use the following configuration object to define a Web application for use by Jetty:

Table 8-4 Configuration Parameters for <jetty-web-app>
Parameter
Type
Description
context-path
String
The context path where this web app is deployed in the web server's name space.
If not set, it defaults to “/”.
scratch-directory
String
The location where Jetty stores temporary files for this web app.
Overrides the scratch-directory parameter in the Configuring a Jetty Server Instance. If not specified, a directory is created at????.
path
String
A file name that points to the location of the web app on the server. It may be a directory or a WAR file.
jetty-name
String
The name of the Jetty service where this web application is deployed. It must match the name of an existing Configuring a Jetty Server Instance.
name
String
The name of this configuration object.

Developing Servlets for Jetty

Oracle CEP supports development of servlets for deployment to Jetty by creating a standard J2EE Web Application and configuring it using the jetty-web-app Configuration Object.

Web App Deployment

Oracle CEP supports deployments packaged either as WAR files or as exploded WAR files, as described in version 2.4 of the Java Servlet Specification.

You can deploy pre-configured web apps from an exploded directory or WAR file by including them in the server configuration.

Security constraints specified in the standard web.xml file are mapped to the Common Security Services security provider. The Servlet API specifies declarative role-based security, which means that particular URL patterns can be mapped to security roles.

 


Example Jetty Configuration

The following snippet of a config.xml file provides an example Jetty configuration; only Jetty-related configuration information is shown:

Listing 8-1 Example Jetty Configuration
<config>
  <netio>
<name>JettyNetIO</name>
<port>9002</port>
</netio>
  <work-manager>
<name>WM</name>
<max-threads-constraint>64</max-threads-constraint>
<min-threads-constraint>3</min-threads-constraint>
</work-manager>
  <jetty>
<name>TestJetty</name>
<work-manager-name>WM</work-manager-name>
<network-io-name>JettyNetIO</network-io-name>
<debug-enabled>false</debug-enabled>
<scratch-directory>JettyWork</scratch-directory>
</jetty>
  <jetty-web-app>
<name>test</name>
<context-path>/test</context-path>
<path>testWebApp.war</path>
<jetty-name>TestJetty</jetty-name>
</jetty-web-app>
</config>

  Back to Top       Previous  Next