Search code examples
azureazure-web-app-serviceazure-app-configuration

How to limit the number of requests being made to Azure App Configuration from a Spring Boot application?


I have a Spring Boot app running on an Azure Web App instance and it's set up to fetch external configurations from an App Configuration.

I am using the free tier of App Configuration which should be plenty for my needs as my application does not need frequent updates to its configuration properties.

The app is making thousands of calls to the app configuration service and causing me to hit my service quota, so I'm seeing frequent http 429 errors.

I found this article which addresses how to configure a longer timeout for my application properties, but it is .NET specific and doesn't help someone working with the App Configuration SDK for Spring Boot.


Solution

  • It depends on what version of the Azure App Configuration library you are using. If it is 2.0.0 or later you can find the configurations here https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/appconfiguration/azure-spring-cloud-starter-appconfiguration-config#supported-properties. Or if it is an older version https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/appconfiguration/spring-cloud-starter-azure-appconfiguration-config#supported-properties.

    So, the configurations should be spring.cloud.azure.appconfiguration.stores[0].monitoring.watch-interval for 2.0.0 and spring.cloud.azure.appconfiguration.cache-expiration for 1.X.X versions.

    Also, depending on your situation you may want to look into using push based refresh if you are using the 2.0.0 library.