Most Dynamo applications must be able to handle large numbers of simultaneous requests. In these applications, one of the keys to improving throughput is to share and reuse expensive resources.

For example, a single JDBC database connection may require several seconds to establish a connection to a database, verify the password, etc. Once connected, however, a JDBC connection can be used over and over again to execute database operations quickly. So one of the tricks to achieving high throughput is to create a pool of JDBC connections ahead of time. When requests come in, they grab connections from the pool and use them, then return them to the pool when they are done. This approach is far more efficient than requiring each request to create its own connection.

This pooling approach is applicable for any resource that is expensive to create, but cheap to share and reuse. Dynamo includes a class called atg.service.resourcepool.ResourcePool that encapsulates the notion of pooling shared resources. Subclasses may be defined which create their own types of resources. For example, the atg.service.jdbc.MonitoredDataSource class is a subclass of ResourcePool that pools JDBC Connection objects.

 
loading table of contents...