Sunday, June 11, 2006

Resource Management Patterns

Resource Acquisition catagory:
***********************************
Lookup: Naming service, Trading service, Directory service

Lazy Acquisition: Resource proxy, web browser image proxy
and deferred image download, Java JIT compiler. Good
for scalability and low latency.

Eager Acquisition: Good for predictability, bandwidth
pre-allocation, pre-connect.

Partial Acquisition: Acquire resoruce in steps.

Resource Lifecycle catagory:
********************************
Caching: for performance, identity of resources is important.

Pooling: for boundedness, identity of resources is not important.

Coordinator: To provide commit-or-rollback semantics. Similar to strong
exception safety guarantee. Best example: two-phase commit protocol (prepare() and commit())

Resource Release catagory:
*******************************
Leasing: Free up unused/invalid resources/service location references after some pre-determined lease time if not accessed. Renew lease if accessed in between.

Evictor: Used with caching or pooling. Implements a strategy
for discarding resources from cache or pool (LRU, FIFO etc)

Source:
Pattern-Oriented Software Architecture, Volume 3: Patterns for Resource Management