Adapting Cloud-based Applications through a Coordinated and Optimized Resource Allocation Approach