1. A method performed by a network element, the method comprising: receiving at a network element a packet of a network transaction from a client over a first network for accessing an application server of a datacenter over a second network, the network element operating as an application services gateway of the datacenter; identifying a context associated with the application server based on based on the packet, including information that identifies one or more application services to be performed on the packet and resources to be allocated for performing the application services, wherein each context includes information representing a logical instance of one or more physical resources of the network element shared by multiple contexts; and performing the one or more application services on the packet using the resources identified by the context.