Managing large number of application settings in Azure Functions











up vote
0
down vote

favorite












I currently have an application that processes telemetry events from Azure IOT Hub. The processing of the events are done by triggering Azure Functions from the IOT Hub.



Several processing rules /settings (currently about 6) are set up per device. Settings are essentially just a set of simple (string/bool) properties. Seeing that there are several hundred devices, the qty of these settings explode over time. On-boarding new devices also creates a requirement for provisioning the settings and defaults.



When the Azure Function starts up to process events from a device, it needs to load the settings for that device and then process accordingly.



What is the best way to manage these settings? The primary focus is on efficient loading of the settings when the function starts up. Secondarily, the easy update of settings.



As far as I can think there are the following options:





  • Store individual settings in Azure Tables. I have implemented this but I am concerned that it will not scale well when hundreds of devices access the Azure Table. I have used PartitionKey|RowKey as DeviceId|SettingName. This will create a partition per device




    • Store all settings for a device as JSON in Azure tables. This will require parsing JSON to obtain the individual settings


    • Storing individual settings in ApplicationSettings is not really doable I think due to number of settings


    • Storing all settings for a device I think is also not doable due to the same reason as above.













share|improve this question






















  • How often do these settings change? Is it a problem if settings got stale for a while? You need some sort of caching there. Depending on the frequency of change and other parameters you can try to find the best fitting cache option for you.
    – Sebastian Achatz
    2 days ago










  • Settings do not change often. Mainly for diagnostics when needed
    – user437239
    yesterday















up vote
0
down vote

favorite












I currently have an application that processes telemetry events from Azure IOT Hub. The processing of the events are done by triggering Azure Functions from the IOT Hub.



Several processing rules /settings (currently about 6) are set up per device. Settings are essentially just a set of simple (string/bool) properties. Seeing that there are several hundred devices, the qty of these settings explode over time. On-boarding new devices also creates a requirement for provisioning the settings and defaults.



When the Azure Function starts up to process events from a device, it needs to load the settings for that device and then process accordingly.



What is the best way to manage these settings? The primary focus is on efficient loading of the settings when the function starts up. Secondarily, the easy update of settings.



As far as I can think there are the following options:





  • Store individual settings in Azure Tables. I have implemented this but I am concerned that it will not scale well when hundreds of devices access the Azure Table. I have used PartitionKey|RowKey as DeviceId|SettingName. This will create a partition per device




    • Store all settings for a device as JSON in Azure tables. This will require parsing JSON to obtain the individual settings


    • Storing individual settings in ApplicationSettings is not really doable I think due to number of settings


    • Storing all settings for a device I think is also not doable due to the same reason as above.













share|improve this question






















  • How often do these settings change? Is it a problem if settings got stale for a while? You need some sort of caching there. Depending on the frequency of change and other parameters you can try to find the best fitting cache option for you.
    – Sebastian Achatz
    2 days ago










  • Settings do not change often. Mainly for diagnostics when needed
    – user437239
    yesterday













up vote
0
down vote

favorite









up vote
0
down vote

favorite











I currently have an application that processes telemetry events from Azure IOT Hub. The processing of the events are done by triggering Azure Functions from the IOT Hub.



Several processing rules /settings (currently about 6) are set up per device. Settings are essentially just a set of simple (string/bool) properties. Seeing that there are several hundred devices, the qty of these settings explode over time. On-boarding new devices also creates a requirement for provisioning the settings and defaults.



When the Azure Function starts up to process events from a device, it needs to load the settings for that device and then process accordingly.



What is the best way to manage these settings? The primary focus is on efficient loading of the settings when the function starts up. Secondarily, the easy update of settings.



As far as I can think there are the following options:





  • Store individual settings in Azure Tables. I have implemented this but I am concerned that it will not scale well when hundreds of devices access the Azure Table. I have used PartitionKey|RowKey as DeviceId|SettingName. This will create a partition per device




    • Store all settings for a device as JSON in Azure tables. This will require parsing JSON to obtain the individual settings


    • Storing individual settings in ApplicationSettings is not really doable I think due to number of settings


    • Storing all settings for a device I think is also not doable due to the same reason as above.













share|improve this question













I currently have an application that processes telemetry events from Azure IOT Hub. The processing of the events are done by triggering Azure Functions from the IOT Hub.



Several processing rules /settings (currently about 6) are set up per device. Settings are essentially just a set of simple (string/bool) properties. Seeing that there are several hundred devices, the qty of these settings explode over time. On-boarding new devices also creates a requirement for provisioning the settings and defaults.



When the Azure Function starts up to process events from a device, it needs to load the settings for that device and then process accordingly.



What is the best way to manage these settings? The primary focus is on efficient loading of the settings when the function starts up. Secondarily, the easy update of settings.



As far as I can think there are the following options:





  • Store individual settings in Azure Tables. I have implemented this but I am concerned that it will not scale well when hundreds of devices access the Azure Table. I have used PartitionKey|RowKey as DeviceId|SettingName. This will create a partition per device




    • Store all settings for a device as JSON in Azure tables. This will require parsing JSON to obtain the individual settings


    • Storing individual settings in ApplicationSettings is not really doable I think due to number of settings


    • Storing all settings for a device I think is also not doable due to the same reason as above.










azure-storage azure-functions






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked 2 days ago









user437239

599




599












  • How often do these settings change? Is it a problem if settings got stale for a while? You need some sort of caching there. Depending on the frequency of change and other parameters you can try to find the best fitting cache option for you.
    – Sebastian Achatz
    2 days ago










  • Settings do not change often. Mainly for diagnostics when needed
    – user437239
    yesterday


















  • How often do these settings change? Is it a problem if settings got stale for a while? You need some sort of caching there. Depending on the frequency of change and other parameters you can try to find the best fitting cache option for you.
    – Sebastian Achatz
    2 days ago










  • Settings do not change often. Mainly for diagnostics when needed
    – user437239
    yesterday
















How often do these settings change? Is it a problem if settings got stale for a while? You need some sort of caching there. Depending on the frequency of change and other parameters you can try to find the best fitting cache option for you.
– Sebastian Achatz
2 days ago




How often do these settings change? Is it a problem if settings got stale for a while? You need some sort of caching there. Depending on the frequency of change and other parameters you can try to find the best fitting cache option for you.
– Sebastian Achatz
2 days ago












Settings do not change often. Mainly for diagnostics when needed
– user437239
yesterday




Settings do not change often. Mainly for diagnostics when needed
– user437239
yesterday












1 Answer
1






active

oldest

votes

















up vote
1
down vote



accepted










It sounds like these settings may change, which means you either need to:




  1. Read them every time a function starts.

  2. Read them once, and store them in memory. Then you'd need an expiration policy to refresh them if they've changed (unless you have some way to be notified of changes). Perhaps something like MemoryCache.

  3. Send the device settings with your messages -- is this a possibiliy, or are those managed separately?


As for where they're stored -- using Azure Tables or even Azure Blobs would work. You could store JSON settings in a blob named by the device id and retrieve those settings very quickly. Storing them in something like CosmosDB (which is a JSON document store already) would also work. All of these should scale for you, especially if you're doing some kind of in-memory caching so you don't need to read settings every invocation.






share|improve this answer





















  • The Azure Functions are stateless so currently I read them with every invocation. I could make the settings static but then I would need to bounce the Function App when I change a setting. Settings are changed manually when the processing needs to deviate from the normal for diagnostics purposes. So I suppose that is not too bad. The settings pertain to backend processing so no real need for the settings on the devices. As long as Azure Table will scale properly it is my preference. The JSON is fairly small so parsing is likely not a big overhead at scale.
    – user437239
    yesterday











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














 

draft saved


draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53203835%2fmanaging-large-number-of-application-settings-in-azure-functions%23new-answer', 'question_page');
}
);

Post as a guest
































1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
1
down vote



accepted










It sounds like these settings may change, which means you either need to:




  1. Read them every time a function starts.

  2. Read them once, and store them in memory. Then you'd need an expiration policy to refresh them if they've changed (unless you have some way to be notified of changes). Perhaps something like MemoryCache.

  3. Send the device settings with your messages -- is this a possibiliy, or are those managed separately?


As for where they're stored -- using Azure Tables or even Azure Blobs would work. You could store JSON settings in a blob named by the device id and retrieve those settings very quickly. Storing them in something like CosmosDB (which is a JSON document store already) would also work. All of these should scale for you, especially if you're doing some kind of in-memory caching so you don't need to read settings every invocation.






share|improve this answer





















  • The Azure Functions are stateless so currently I read them with every invocation. I could make the settings static but then I would need to bounce the Function App when I change a setting. Settings are changed manually when the processing needs to deviate from the normal for diagnostics purposes. So I suppose that is not too bad. The settings pertain to backend processing so no real need for the settings on the devices. As long as Azure Table will scale properly it is my preference. The JSON is fairly small so parsing is likely not a big overhead at scale.
    – user437239
    yesterday















up vote
1
down vote



accepted










It sounds like these settings may change, which means you either need to:




  1. Read them every time a function starts.

  2. Read them once, and store them in memory. Then you'd need an expiration policy to refresh them if they've changed (unless you have some way to be notified of changes). Perhaps something like MemoryCache.

  3. Send the device settings with your messages -- is this a possibiliy, or are those managed separately?


As for where they're stored -- using Azure Tables or even Azure Blobs would work. You could store JSON settings in a blob named by the device id and retrieve those settings very quickly. Storing them in something like CosmosDB (which is a JSON document store already) would also work. All of these should scale for you, especially if you're doing some kind of in-memory caching so you don't need to read settings every invocation.






share|improve this answer





















  • The Azure Functions are stateless so currently I read them with every invocation. I could make the settings static but then I would need to bounce the Function App when I change a setting. Settings are changed manually when the processing needs to deviate from the normal for diagnostics purposes. So I suppose that is not too bad. The settings pertain to backend processing so no real need for the settings on the devices. As long as Azure Table will scale properly it is my preference. The JSON is fairly small so parsing is likely not a big overhead at scale.
    – user437239
    yesterday













up vote
1
down vote



accepted







up vote
1
down vote



accepted






It sounds like these settings may change, which means you either need to:




  1. Read them every time a function starts.

  2. Read them once, and store them in memory. Then you'd need an expiration policy to refresh them if they've changed (unless you have some way to be notified of changes). Perhaps something like MemoryCache.

  3. Send the device settings with your messages -- is this a possibiliy, or are those managed separately?


As for where they're stored -- using Azure Tables or even Azure Blobs would work. You could store JSON settings in a blob named by the device id and retrieve those settings very quickly. Storing them in something like CosmosDB (which is a JSON document store already) would also work. All of these should scale for you, especially if you're doing some kind of in-memory caching so you don't need to read settings every invocation.






share|improve this answer












It sounds like these settings may change, which means you either need to:




  1. Read them every time a function starts.

  2. Read them once, and store them in memory. Then you'd need an expiration policy to refresh them if they've changed (unless you have some way to be notified of changes). Perhaps something like MemoryCache.

  3. Send the device settings with your messages -- is this a possibiliy, or are those managed separately?


As for where they're stored -- using Azure Tables or even Azure Blobs would work. You could store JSON settings in a blob named by the device id and retrieve those settings very quickly. Storing them in something like CosmosDB (which is a JSON document store already) would also work. All of these should scale for you, especially if you're doing some kind of in-memory caching so you don't need to read settings every invocation.







share|improve this answer












share|improve this answer



share|improve this answer










answered 2 days ago









brettsam

1,875415




1,875415












  • The Azure Functions are stateless so currently I read them with every invocation. I could make the settings static but then I would need to bounce the Function App when I change a setting. Settings are changed manually when the processing needs to deviate from the normal for diagnostics purposes. So I suppose that is not too bad. The settings pertain to backend processing so no real need for the settings on the devices. As long as Azure Table will scale properly it is my preference. The JSON is fairly small so parsing is likely not a big overhead at scale.
    – user437239
    yesterday


















  • The Azure Functions are stateless so currently I read them with every invocation. I could make the settings static but then I would need to bounce the Function App when I change a setting. Settings are changed manually when the processing needs to deviate from the normal for diagnostics purposes. So I suppose that is not too bad. The settings pertain to backend processing so no real need for the settings on the devices. As long as Azure Table will scale properly it is my preference. The JSON is fairly small so parsing is likely not a big overhead at scale.
    – user437239
    yesterday
















The Azure Functions are stateless so currently I read them with every invocation. I could make the settings static but then I would need to bounce the Function App when I change a setting. Settings are changed manually when the processing needs to deviate from the normal for diagnostics purposes. So I suppose that is not too bad. The settings pertain to backend processing so no real need for the settings on the devices. As long as Azure Table will scale properly it is my preference. The JSON is fairly small so parsing is likely not a big overhead at scale.
– user437239
yesterday




The Azure Functions are stateless so currently I read them with every invocation. I could make the settings static but then I would need to bounce the Function App when I change a setting. Settings are changed manually when the processing needs to deviate from the normal for diagnostics purposes. So I suppose that is not too bad. The settings pertain to backend processing so no real need for the settings on the devices. As long as Azure Table will scale properly it is my preference. The JSON is fairly small so parsing is likely not a big overhead at scale.
– user437239
yesterday


















 

draft saved


draft discarded



















































 


draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53203835%2fmanaging-large-number-of-application-settings-in-azure-functions%23new-answer', 'question_page');
}
);

Post as a guest




















































































Popular posts from this blog

Schultheiß

Liste der Kulturdenkmale in Wilsdruff

Android Play Services Check