microsoftgraph / microsoftgraph/microsoft-graph-comms-samples

CommsSerializer high CPU usage

Open
#739 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
No language data
Stars
253
Forks
275
Avg merge
1d 5h
Merged PRs (30d)
1

Description

Hello, we are using CommsSerializer to deserialize notifications for compliance recording bot. This method however can take up to a few seconds. Can we do something to reduce this time or optimize? When there is a lot of calls it results in quite high cpu usage.

private CommsNotifications GetGraphNotifications(string rawData)
{
    CommsNotifications result = null;
    try
    {
        #region "Initialization"
        if (string.IsNullOrEmpty(rawData))
        {
            return result;
        }
        #endregion

        Stopwatch stopwatch = new Stopwatch();
        stopwatch.Start();

        result = NotificationProcessor.ExtractNotifications(rawData, new CommsSerializer());

        stopwatch.Stop();
        _logger.LogDebug("GetGraphNotifications execution time: {0} ms", stopwatch.ElapsedMilliseconds);
    }
    catch (Exception ex)
    {
        ErrorAction(GetCurrentMethod(), ex);
    }
    return result;
}

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at GetGraphNotifications and the NotificationProcessor.ExtractNotifications call shown in the issue, then profile CommsSerializer with representative rawData to identify the CPU and timing bottleneck. Compare any optimization against the existing stopwatch measurement and verify that notification results remain unchanged; done means the reported performance concern is measurably improved.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
backend
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.