Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CleanupTelemetryData Taking Too Much CPU/Memory #214

Open
Mike-Becatti opened this issue Apr 2, 2024 · 0 comments
Open

CleanupTelemetryData Taking Too Much CPU/Memory #214

Mike-Becatti opened this issue Apr 2, 2024 · 0 comments

Comments

@Mike-Becatti
Copy link

Mike-Becatti commented Apr 2, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant