DEV Community 👩‍💻👨‍💻

Cover image for Azure vs GCP part 4: Web Apps and App Engine Scaling features
Kenichiro Nakamura
Kenichiro Nakamura

Posted on

Azure vs GCP part 4: Web Apps and App Engine Scaling features

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 :)

Why Scaling matters

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 Web Apps

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.

In this case, I selected "S1" which gives me up to 10 instances for auto scale, with 1 Core CPU and 1.75 GB RAM.
plan

2. Then go to "Scale out" menu. If you select instance count by using slide bar, it is manual scale settings. I set 6 instances manually.
scale

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".
scale

4. Then I specify CPU threshold rule and add. You can add multiple rules if you need. I also set max instance count to 10.
scale

5. Finally, name the rule and save it.

Test it!

To test the auto-scaling, the easiest way is to use performance test.

1. Go to Web Apps you want to test, and click "Performance test".
test

2. Click add to add test. It's straight forward so I won't explain detail here, but run the test long enough to exceed the threshold. *This creates VSTS account background.
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.

GCP App Engine

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.

1. In your dotnet core project, right click solution and click "Generate app.yaml and Dockerfile".
publish

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
Enter fullscreen mode Exit fullscreen mode
  • 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
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

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.

publish

5. You can see the configuration information.
publish

6. Go to instances to see each instance information. I don't know the reason but there are only four instances, not five though. Maybe it comes up later?
publish

Summary

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.

References

Developing apps that scale automatically with Google App Engine
Cloud Loading Testing in Visual Studio Team Services

Ken

Top comments (0)

DEV has this feature:

Settings

Go to your customization settings to nudge your home feed to show content more relevant to your developer experience level. 🛠