Announcing Distributed Functions for Azure Static Web Apps
Azure Static Web Apps is a platform that enables you to build modern web applications with static frontends and serverless functions backends. With Azure Static Web Apps, you can easily deploy your static site to our globally distributed host, and easily add backend functionality with Static Web Apps’ integrated managed functions. However, until now, these managed functions were deployed to a single region, which can result in unnecessary network latencies for audiences far from the functions region.
Today, we are excited to announce Distributed Functions for Azure Static Web Apps, a feature that automatically distributes your Static Web Apps’ managed functions to regions of high demand. With distributed functions enabled on your Static Web Apps resource, you can reduce the network latency for requests to your backend managed functions, improving the performance and responsiveness of your full-stack web app.
How Distributed Functions work
Distributed Functions is a feature that dynamically and automatically scales your managed functions across regions, depending on the traffic load from your users. When you create an Azure Static Web App, you choose a home region for your functions, which is where they are initially deployed. However, if an Azure Static Web App host in a different region receives a significant amount of traffic to the managed functions, it will deploy a copy of your managed functions to that region and route the traffic to this new managed function backend.
Distributed Functions can reduce the network latency for your API calls by up to 70%, depending on the distance between the user and the function region. This can be especially useful in the context of request pre-processing, where network latency is critical to providing a good user experience. For instance, when using managed functions for authorization, personalization or routing, network latency occupies a large fraction of the response time, and by minimizing the network latency, you can provide a substantially better user experience. Distributed functions can also be used in the context of building fully globally distributed web applications, where a global database such as Azure CosmosDB is used to provide the most performant web application.
How to enable Distributed Functions
Distributed Functions is a feature that is available to the Standard SKU of Azure Static Web Apps. You can enable it from the Azure Portal, without any changes to your code. From the APIs blade of your Azure Static Web App resource, and toggle on the Distributed Functions option. You can also disable it from the same blade, if you prefer to have your functions in a single region.
During the preview of distributed functions, we’ll continue to tweak the distributed functions’ trigger conditions to ensure its’ effectiveness and based on your feedback.
Get started with Azure Static Web Apps Distributed Functions today
We hope you are as excited as we are about Distributed Functions for Azure Static Web Apps, and we can’t wait to see what you build with it. To learn more about distributed functions, check out the following resources:
Learn more about Azure Static Web Apps Distributed Functions
Share feedback in the Azure Static Web Apps GitHub repository
Follow and tag our Twitter account for Azure Static Web Apps
Microsoft Tech Community – Latest Blogs –Read More