12.11.2014 Views

web server - Borland Technical Publications

web server - Borland Technical Publications

web server - Borland Technical Publications

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Sessions in secondary storage<br />

If you set this property to a non-zero value, you can also set the integer property<br />

ejb.sfsb.instance_max for each deployed session bean in their deployment descriptors.<br />

This property defines the maximum number of instances of a particular stateful session<br />

bean that are allowed to exist in the EJB container's memory at the same time. If this<br />

number is reached and a new instance of a stateful session needs to be allocated, the<br />

EJB container throws an exception indicating lack of resources. 0 is a special value. It<br />

means no maximum set.<br />

If the maximum number of stateful sessions defined by the ejb.sfsb.instance_max<br />

property is reached, the EJB container blocks a request for an allocation of a new bean<br />

for the time defined by the integer property ejb.sfsb.instance_max_timeout. The<br />

container will then wait for the number to drop below this value before throwing an<br />

exception indicating a lack of resources. This property is defined in ms (1/1000th of<br />

second). 0 is a special value. It means not to wait and throw an exception indicating<br />

lack of resources immediately.<br />

Aggressive Passivation<br />

One of the key advantages in the use of JSS is its ability to fail over. Several containers<br />

implementing JSS can be configured to use the same persistent store, allowing them to<br />

fail over to each other. Setting up the JSS for failover is discussed in Chapter 6, “Java<br />

Session Service (JSS) configuration.” To facilitate taking advantage of the JSS failover<br />

capability, <strong>Borland</strong> provides the option of using aggressive passivation.<br />

Aggressive passivation is the storage of session state regardless of its timeout. A bean<br />

that is set to use aggressive passivation will have its session state persisted every time<br />

it is polled, although its instance will not be removed from memory unless it times out.<br />

In this way, if a container instance fails in a cluster, a recently-stored version of the<br />

bean is available to other containers using identical JSS instances communicating with<br />

the same backend. As in simple passivation, if the bean times out, it will still be<br />

removed from memory.<br />

Again, aggressive passivation is set Partition-wide using the boolean property<br />

ejb.sfsb.aggressive_passivation. Setting the property to true (the default) stores the<br />

session's state regardless of whether it was accessed before the last passivation<br />

attempt. Setting the property to false allows the container to use only simple<br />

passivation. Again, this property is set in the container's properties file partition.xml<br />

located in:<br />

/var/domains/base/configurations/<br />

/ mos//adm/properties<br />

Bear in mind that although using aggressive passivation aids in failover, it also results<br />

in a performance hit since the container accesses the database more often. If you<br />

configure the JSS to use a non-native database (that is, you choose not to use<br />

JDataStore), the loss of performance can be even greater. Be aware of the trade-off<br />

between availability and performance before you elect to use aggressive passivation.<br />

Sessions in secondary storage<br />

Most sessions are not kept in persistent storage forever after they timeout. <strong>Borland</strong><br />

provides a mechanism for removing stored sessions from the database after a discrete<br />

period of time known as the keep alive timeout. The keep alive timeout specifies the<br />

minimum amount of time in seconds to persist a passivated session in stateful storage.<br />

The actual amount of time it is kept in the database can vary, since it is not wise from a<br />

performance standpoint to constantly poll the database for unused sessions. The<br />

actual amount of time a session is persisted is at least the value of the keep alive<br />

timeout and not more than twice the value of the keep alive timeout.<br />

108 BES Developer’s Guide

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!