Scaling Azure VMs
Vertical Scaling
- Vertical Scaling requires restart of the machine, which means downtime.
- Vertical Scaling can be done by clicking on sizes blade and selecting the new size.
- In Azure you can increase the size as well as decrease the size
Horizontal Scaling
- Horizontal scaling generally speaks about increasing machines so that load can be shared.
- In Azure increasing number of VMs (Scale out) and Decreasing VMS (Scale in) are supported by Virtual Machine Scale Sets
Virtual Machine Scale Sets(VMSS)
- All the VMS in VMSS should have same VM Image
- Ensure Transactional Data is not stored locally in the VM, rather in some external system like database
- When should i Scale out and when should i Scale in
- This numbers (triggers) are defined only after benchmarking/performance testing
- What are the different Metrics which i can use as Triggers
- CPU
- Memory
- Network
- Disk
VMSS Creation Considerations
- Create a VM Image for the application which you want to scale
- Generally it is a good idea to have vm image created automatically, whenever you have a release.
- Always have atleast one VM image which is working and then try new releases.
- Ensure you have data on when to Scale in and Scale out.
VMSS Preparation
Linux
- Create a VM Image of a Linux Server.
- Create a VM with Ubuntu 16/18 (B1S).
- SSH into VM and Execute the following commands. Refer Here
sudo apt-get update
sudo apt-get install apache2 -y
sudo apt-get install php libapache2-mod-php php-mcrypt php-mysql
sudo apt-get install php-cli
create a file in /var/www/html/info.php with content
<?php
phpinfo();
?>
sudo apt-get install stress -y
- Create a VM Image for this VM.