An Optimal Resource Allocation Scheme in Cloud Computing