Abstract-Workload consolidation is an efficient approach to reduce the power consumption of datacenters, meanwhile load balancing can reduce the datacenter's user delay. Despite complexities of 1) the coupling between consolidation and load balancing methods for server allocation, and 2) the heterogeneity of server configurations, we address the joint consolidation and service-aware load balancing problem to minimize the operation cost of datacenters. We first formulate the joint optimization problem, which is NP-hard. We then solve this problem using the Gibbs sampling method. Furthermore, to improve the computation of our approach, we propose the JCL algorithm that combines Gibbs sampling and the ADMM method for parallel and distributed calculations. Simulation results also validate that our method not only reduces the power consumption and delay cost, but also balances the workload in heterogeneous servers