Scaling Azure Web Apps

Microsoft Azure Web Apps allow you to scale the computing power (scale up) and the number of instances your application is replicated on (scale out), enabling you to increase the performance and throughput as necessary. 

For the scale-out functionality to work with Xperience, you need to enable and configure Web farms:

  1. Enable the automatic web farms feature (enabled by default on new installations)
  2. Set up shared storage for physical files
  3. Scale-out the deployed web apps using Azure

Enabling automatic web farms

To run an Xperience environment in Microsoft Azure, your projects need to use the Automatic web farm functionality. It is not possible to manually set up static web farm servers since server names in Azure change every time the application is recycled or a new instance spins up. Newly installed projects have automatic web farm server detection enabled by default.

  1. Open the Xperience administration interface.
  2. Open the Settings application and select the Versioning & Synchronization -> Web farm category.
  3. Set the Web farm modeto Automatic.

The automatic web farm feature is enabled. The system now dynamically generates and removes web farm servers according to the number of detected active instances and generates synchronization tasks automatically.

Setting up shared storage for physical files

Scaled out app service instances share the file system of the original application, which can cause issues with the synchronization of files in Xperience web farm environments.

By default when synchronizing file system changes, the system creates a web farm task for every known web farm instance. For example, this occurs every time an image is uploaded or modified – an instance needs to relay information about the change to every other instance.

In shared file system environments, such as when scaling Azure App Services, this can lead to deadlocks (when multiple instances attempt to concurrently access the same physical file while processing a web farm task).

To avoid any potential synchronization issues, we strongly recommend you:

  1. Map the following folders from both projects to a storage shared by both web applications (to ensure files are accessible from both the administration and live sites):

    • ~/App_Data/CMSModules/SmartSearch – Contains smart search index files.
    • ~/##SiteFolder## – named after the site’s code name. Contains primarily media library files and documents.These folders contain all files Xperience synchronizes via web farms.
  2. Add the CMSSharedFileSystemkey to the web.config of both applications. The key disables the generation of web farm tasks related to synchronization of physical files (media library items, smart search indexes, etc.).

     <add key="CMSSharedFileSystem" value="true"/>

With this configuration, the system does not need to create web farm synchronization tasks for physical files as they are available to both instances from dedicated shared storage. This neutralizes any potential issues with web farm synchronization. 

Scaling out deployed web apps

Xperience uses a dual-application environment where the front-end application serves content and receives the bulk of visitor traffic. The administration application manages and stores content and generally experiences lesser load. Therefore, when deciding how to scale-out your deployment environment, consider prioritizing the front-end application.

The Azure Resource Manager template (recommended to use when preparing a deployment environment for your projects in Azure) creates two separate App Service hosting plans – one for each application – for specifically this reason. This setup allows you to scale each application independently, ensuring no wasted compute allocation.

To scale out a Web App:

  1. Open the Azure portal and navigate to your Web App.
  2. Open the Scale out (App Service plan) tab.
  3. Manually set the required instance count or create a custom autoscale configuration.
  4. Repeat the process for the other application, if required.
  5. Configure how session data is stored.

You have configured instance scaling for your Web Apps. Learn more about Web App scaling in Microsoft Azure on Get started with Autoscale in Azure.