Skip to content

CleanupTelemetryData Taking Too Much CPU/Memory #214

@Mike-Becatti

Description

@Mike-Becatti

Code Optimizations in Azure has identified a excessive Memory usage by the "PubnubApi.EndPoint.TelemetryManager.CleanupTelemetryData" method. It has 3 recommendations.

Recommendation 1:

Description: A lot of CPU or Memory is being spent in Enumerable.ToDictionary().

Current Condition: 19% of your Memory was spent in Enumerable.ToDictionary called from PubnubApi.EndPoint.TelemetryManager.CleanupTelemetryData. We expected this value to be <2%.

Recommendations: Verify that Enumerable.ToDictionary() isn't being called for a few look-ups in the resulting Dictionary<K, V>. This can instead be accomplished simply by enumerating over the Enumerable.

Recommendation 2:

**Description: ** Task.ScheduleAndStart is causing unusually high memory allocations.

Current Condition: 6% of your Memory was spent in Task.ScheduleAndStart called from PubnubApi.EndPoint.TelemetryManager.CleanupTelemetryData. We expected this value to be <1%.

Recommendations: Consider investigating why Task.ScheduleAndStart is causing higher than expected memory allocations.

Recommendation 3:

**Description: ** Excessive string concatenation is causing lots of allocations and CPU consumption.

Current Condition: 3% of your Memory was spent in String.Concat called from PubnubApi.EndPoint.TelemetryManager.CleanupTelemetryData. We expected this value to be <1%.

Recommendations: Consider using cheaper alternatives such as String.Join or a StringBuilder instead.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions