I understand how I can deploy my dotnet core application to Azure Web Apps and GCP App Engine. How about scaling? Why do I care such thing as a developer? Because one of the reasons why I want to use cloud platform is to utilize its features :)
Deploy an application to single instance is easy, but scaling-out is difficult if you manage infrastructure by yourself.
- Add servers
- Manage IP addresses
- Add load balancing
- Manage name resolution
- Deploy application to multiple servers by having perfect control of versions
- And more.
But we need to scale up and down depending on requests to optimize the resource usages!
While both platform support auto/manual scaling, how to set them seems to be quite different.
Azure provides performance related settings as "plan".
1. First of all, select appropriate plan. Go to App Service plan you created and select "Scale up", then it gives you available plans.
3. To enable auto-scale, click "Enable autoscale" and set the settings. Here again, if you specify "Scale to a specific instance count", it becomes manual scaling. Thus I select "Scale based on a metric". Click "Add a rule".
5. Finally, name the rule and save it.
To test the auto-scaling, the easiest way is to use performance test.
3. Once test created, select the created test, which navigates you to test page. It takes several minutes before the test actually starts. Once test start, check how many instances actually allocated.
However, the default template app didn't work very well as I expected to. So many failed access, yet no auto-scale actually happen as CPU usage didn't exceed the threshold. In this case, manual scale may make sense.
As far as I research, the only way to change it is via app.yaml. If someone knows how to do this via UI, let me know please.
2. For auto scaling, add auto scaling section. See here for more detail. BTW, there are default value for each, so you don't have to set it to enable auto-scaling if default value works.
automatic_scaling: min_num_instances: 1 max_num_instances: 15 cool_down_period_sec: 180 cpu_utilization: target_utilization: 0.6
- min_num_instances: Must be 1 or greater, default is 2
- max_num_instances: Default is 20
- cool_down_period_sec: Must be greater than or equal to 60 seconds. Default is 120.
- target_utilization: Target CPU utilization. Default is 0.5.
If you do manual scaling, use manual_scaling section.
manual_scaling: instances: 5
3. For instance resource settings, specify in resources section. See here for more detail.
resources: cpu: 2 memory_gb: 2.3 disk_size_gb: 10 volumes: - name: ramdisk1 volume_type: tmpfs size_gb: 0.5
4. Once everything set, publish to Google Cloud. In this case, to illustrate this, I set manual scaling to 5 instances with resource specified above. Once deploy completed, go to App Engine | Versions. Click "View" for config.
Both platform offers both manual and auto scaling features, with various resources. This is what I found.
- Azure offers excellent UI experience with easy to understand plans.
- GCP offers version embed configuration with more granular controls.