Various embodiments of the present invention are directed to an efficient and flexible method and
system for managing a
pool of computational resources that can be allocated from a
resource pool, used for varying periods of time, and eventually returned to the
resource pool. Certain embodiments of the present invention are directed to a method and
system for efficiently managing ephemeral ports used for short-duration communications connections. In one embodiment of the present invention, an array of port tables is employed to store and manage a large space of ephemeral protocol ports. Each port table is a
circular buffer, each entry of which includes a port number that uniquely identifies a communications port, a sequence number that allows the port to be immediately reallocated, and any other additional protocol-specific information that may be associated with the port. A non-local-port-number portion of a connection address, comprising a remote
IP address, a remote port number, and a local
IP address, may be hashed to generate a numerical reference to a particular port table within the array, or
list, of port tables, and ephemeral ports for the non-local-port-number portion of a connection address are allocated from, and deallocated and returned to, the numerically identified port table.