3 Resource Lifecycle
“Seek not, my soul, the life of the immortals; but enjoy to the full the resources that are within thy reach”
Pindar
Once a resource has been acquired, its lifecycle must be managed effectively and efficiently. Managing a resource involves making it available to users, handling inter-resource dependencies, acquiring any dependent resources if necessary, and finally releasing resources that are no longer needed.
The Caching (83) pattern describes how the lifecycle of frequently-accessed resources can be managed to reduce the cost of re-acquisition and release of these resources, while maintaining the identity of the resources. It is a very common pattern that is used in a large number of highly-scalable enterprise solutions. In contrast to the Caching pattern, the Pooling (97) pattern optimizes acquisition and release of resources, while not maintaining the identity of the resources. Pooling is therefore preferable for stateless resources, as they require little or no initialization. Similar to Caching, Pooling is also used widely and includes examples such as pooling of components in component platforms and pooling of threads in distributed applications. Both Caching and Pooling are only applicable to reusable resources. Both patterns typically apply to exclusive reusable resources that are used serially by users. However, in some cases it may make sense to use Caching or Pooling for concurrently-accessible reusable resources. In such cases, both Caching and ...
Get Pattern-Oriented Software Architecture Volume 3: Patterns for Resource Management now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.