Skip to content

Version History and Performance

Chester Gregg edited this page May 29, 2018 · 10 revisions

The Azure Functions host does not currently populate the application_Version field in Application Insights. This codebase now emits the version in structured logs, but since those logs go to the traces table instead of the requests table, we have to join these tables to determine the version for a given request.

requests
| where timestamp > ago(30d)
| join kind=leftouter
(
    traces
    | where timestamp > ago(30d) and message contains "Executing with version="
    | project operation_Id, version=customDimensions.prop__version
)
on operation_Id
| summarize count(), round(max(duration)), round(min(duration)), round(avg(duration)), round(percentile(duration, 50)), round(percentile(duration, 95)), round(stdev(duration)) by tostring(version), name, success
| order by version
version name success count_ max_duration min_duration avg_duration percentile_duration_50 percentile_duration_95 stdev_duration
2.0.2.0 Monitor TRUE 250 3870 1010 1260 1185 1669 283
2.0.2.0 Monitor FALSE 26 2406 129 882 523 2348 730
2.0.1.1 Monitor TRUE 238 6322 1285 1851 1690 2854 638
2.0.1.0 Monitor TRUE 1280 4995 1388 1726 1635 2145 381
2.0.0.2 Monitor TRUE 2428 11075 990 1294 1167 2040 496
Monitor TRUE 2273 10624 1023 1511 1316 2914 625
Monitor FALSE 1 638 638 638 638 638 0

Performance Graph

v2.0.2.0

This version removed the state table, retrieving new comments on the basis of the last execution time instead, available from the TimerTrigger object, with a configurable slack (defaults to 15 seconds). Wanted to avoid doing it this way, but this is more than adequate. Comments may be missed if the function is paused or errors out (e.g. Reddit API errors), but that hasn't been an issue thus far. If the state table is needed for something else in the future, this may be worth revisiting.

There were a number of errors because the deployment was pushed with a bug regarding the name for the configurable slack variable. After correcting that, the performance has again trended downward.

v2.0.1.1

This version made a minor change, accessing the state table query result directly, instead of through a dictionary. Slight regression in performance.

v2.0.1.0

There was a major performance regression with this version. The cost of extra comments being processed was less than the cost of keeping track of the last update time.

v2.0.0.1

User initialization is defered until necessary, and tables are bound to the function call.

requests | where timestamp > datetime(2018-05-23 2:43:00) | summarize count(), round(max(duration)), round(min(duration)), round(avg(duration)), round(percentile(duration, 50)), round(percentile(duration, 95)), round(stdev(duration)) by name, success

Currently filtering by the timestamp of the last update to analyze the performance impact of this version.

name success count_ max_duration min_duration avg_duration percentile_duration_50 percentile_duration_95 stdev_duration
Monitor TRUE 660 6548 1023 1368 1230 2159 529

The average execution time has gone down by about 14%. The 95th percentile sees a more generous reduction of 29%.

v2.0.0.0

The initial v2.0.0 version on GitHub is ported largely unchanged from v1.1.0, which was a C# .NET Framework Console Application. It was using the RedditSharp listing stream to obtain new Reddit comments to the subreddit in question ad infinitum. That method won't work for an Azure Function, so this initial version simply takes the most recent page of comments (25) each invocation. There are issues with this approach (e.g. if more than 25 comments are posted to the subreddit in that timeframe, it will miss some), and isn't intended as a long-term solution.

There is no logic at the moment to handle exceptions, but it's been very stable. Over 1,300 invocations (4.5 days), there has been 1 failure—the first one. It failed because I set up continuous integration and started the function before updating the application settings.

Using the following Application Insights query, here is the performance of this first version.

requests | where timestamp > ago(30d) | summarize count(), round(max(duration)), round(min(duration)), round(avg(duration)), round(percentile(duration, 50)), round(percentile(duration, 95)), round(stdev(duration)) by name, success

name success count_ max_duration min_duration avg_duration percentile_duration_50 percentile_duration_95 stdev_duration
Monitor TRUE 1304 10624 1110 1583 1338 3032 685
Monitor FALSE 1 638 638 638 638 638 0
Clone this wiki locally