Skip to content

Remote configuration tests and performance improvements#8237

Merged
andrewlock merged 2 commits into
masterfrom
andrew/remote-config/remove-regex
Mar 10, 2026
Merged

Remote configuration tests and performance improvements#8237
andrewlock merged 2 commits into
masterfrom
andrew/remote-config/remove-regex

Conversation

@andrewlock

Copy link
Copy Markdown
Member

Summary of changes

  • Add tests for RcmSubscriptionManager and RemoteConfigurationPath
  • Replace regex with string comparison in RemoteConfigurationPath

Reason for change

  • We were missing unit tests for remote config stuff, and I want to improve it without breaking things
  • The RemoteConfigurationPath is running a Regex on every file listed in the remote config response (which happens every 5s), but it's a simple pattern that can be easily directly implemented

Implementation details

  • Used 🤖 to generate bunch of tests, and verified they are really how we want things to work
    • High level tests for RcmSubscriptionManager
    • Tests for RemoteConfigurationPath covering changes in this PR
  • More 🤖 in the conversion, but it's relatively simple, once you decode the allowed patterns from the Regex 😄

Test coverage

Unit tests in this PR cover compatibility with the existing implementation.

Simple benchmarking for the regex improvements:

Method Runtime Mean Error Allocated
RemoteConfigurationPathFromPath_Original .NET 10.0 181.5 ns 2.51 ns 768 B
RemoteConfigurationPathFromPath_Updated .NET 10.0 54.8 ns 3.90 ns 152 B
RemoteConfigurationPathFromPath_Original .NET 6.0 204.0 ns 2.64 ns 768 B
RemoteConfigurationPathFromPath_Updated .NET 6.0 66.4 ns 1.13 ns 152 B
RemoteConfigurationPathFromPath_Original .NET Core 2.1 296.9 ns 4.09 ns 872 B
RemoteConfigurationPathFromPath_Updated .NET Core 2.1 82.2 ns 2.21 ns 160 B
RemoteConfigurationPathFromPath_Original .NET Core 3.1 281.0 ns 3.79 ns 768 B
RemoteConfigurationPathFromPath_Updated .NET Core 3.1 72.8 ns 1.90 ns 152 B
RemoteConfigurationPathFromPath_Original .NET Framework 4.8 326.7 ns 2.11 ns 875 B
RemoteConfigurationPathFromPath_Updated .NET Framework 4.8 110.0 ns 1.76 ns 160 B
Benchmarking code

[MemoryDiagnoser, GroupBenchmarksBy(BenchmarkLogicalGroupRule.ByCategory), CategoriesColumn]
public class RemoteConfigBenchmark
{
    private string _pathToTest;
    private string _result;

    [GlobalSetup]
    public void GlobalSetup()
    {
        _pathToTest = "datadog/2/ASM_FEATURES/ASM_FEATURES-third/testname";
    }

    [Benchmark]
    public string RemoteConfigurationPathFromPath_Original()
    {
        var result = OriginalRemoteConfigurationPath.FromPath(_pathToTest);
        _result = result.Id;
        return result.Path;
    }

    [Benchmark]
    public string RemoteConfigurationPathFromPath_Updated()
    {
        var result = RemoteConfigurationPath.FromPath(_pathToTest);
        _result = result.Id;
        return result.Path;
    }
}

Other details

https://datadoghq.atlassian.net/browse/LANGPLAT-940

All part of the Remote Config perf stack

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:remote-config type:performance Performance, speed, latency, resource usage (CPU, memory)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants