Performance and Cost Optimization for Distributed Cloud-native Systems