1. A method for last-agent optimization, comprising: establishing a connection to each resource in a plurality of resources for an application; determining a current transactional context from metadata for a component of the application; gathering usage statistics associated with each resource; heuristically determining an order of each resource in the current transactional context to achieve last-agent optimization based at least in part on the usage statistics, wherein the usage statistics associated with each resource include a read-only ranking and a fail ranking representative of the number of failures in executing the application; driving a prepare on each resource based on the read-only ranking associated with that resource; enlisting each resource in a list of enlisted resources; removing a read-only resource from the list of enlisted resources for the current transactional context; and performing last-agent optimization for a single enlisted resource.