-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Personal/duburson/large msg perf improvements v2 (#209)
Updated approach to the large perf message improvements. Instead of streaming, keep existing batch service but update settings to lower thresholds (buffer size of 10 instead of 100 and wait time of 10 seconds instead of 30). This will reduce overhead while still allowing for batches on egress for the perf benefits. - Add new Normalization service, NormalizationEventConsumerService. This replaces the MeasurementEventNormalizationService + Normalize.Processor - Fixed bug where checkpoint client will find delete blobs - Added new Converter, EventMessageJObjectCoverter to add properties directly to the JObject rather then new object declarations. - Add additional metrics to NormalizationEventConsumerService
- Loading branch information
1 parent
1087bf8
commit 022b7c3
Showing
15 changed files
with
375 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
src/lib/Microsoft.Health.Fhir.Ingest/Data/EventMessageJObjectConverter.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// ------------------------------------------------------------------------------------------------- | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License (MIT). See LICENSE in the repo root for license information. | ||
// ------------------------------------------------------------------------------------------------- | ||
|
||
using System.IO; | ||
using System.Text; | ||
using EnsureThat; | ||
using Microsoft.Health.Events.Model; | ||
using Microsoft.Toolkit.HighPerformance; | ||
using Newtonsoft.Json; | ||
using Newtonsoft.Json.Linq; | ||
|
||
namespace Microsoft.Health.Fhir.Ingest.Data | ||
{ | ||
public class EventMessageJObjectConverter : IConverter<IEventMessage, JObject> | ||
{ | ||
private const string BodyAttr = "Body"; | ||
private const string PropertiesAttr = "Properties"; | ||
private const string SystemPropertiesAttr = "SystemProperties"; | ||
|
||
private readonly JsonLoadSettings loadSettings = new () { LineInfoHandling = LineInfoHandling.Ignore }; | ||
|
||
private readonly JsonSerializer jsonSerializer = JsonSerializer.CreateDefault(); | ||
|
||
public JObject Convert(IEventMessage input) | ||
{ | ||
EnsureArg.IsNotNull(input, nameof(input)); | ||
|
||
JObject token = new (); | ||
JToken body = null; | ||
|
||
if (input.Body.Length > 0) | ||
{ | ||
using StreamReader streamReader = new StreamReader(input.Body.AsStream(), Encoding.UTF8); | ||
using JsonReader jsonReader = new JsonTextReader(streamReader); | ||
body = JToken.ReadFrom(jsonReader, loadSettings); | ||
} | ||
|
||
token[BodyAttr] = body; | ||
token[PropertiesAttr] = JToken.FromObject(input.Properties, jsonSerializer); | ||
token[SystemPropertiesAttr] = JToken.FromObject(input.SystemProperties, jsonSerializer); | ||
|
||
return token; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.