Service providers must guarantee high quality of service (QoS) for each web application in a data center and simultaneously achieve optimal utilization of their infrastructure. Meeting the Service Level Objectives (SLOs), such as response time in a dynamic environment with a dense load and varying capacity, and simultaneously minimizing the energy consumption of the data center is an open research problem. This paper presents a control framework that addresses both problems of load balancing and resource allocation of consolidated web services in cloud computing infrastructure. The proposed approach aims at succeeding the customer requirements described in a Service Level Agreement (SLA) while maximizing server utilization. A hierarchical two-layer controller is established. The local (lower) level controllers determine the capacity and admitted workload of Virtual Machines (VMs), which correspond to a set of feasible operating points with performance guarantee. The global (upper) level decides the number and topology of active VMs that serve the total service demand and activates only the minimum number of servers. The cooperation of the two control layers ensures the system stability against the fluctuations of incoming requests and the system constraints.