@fluidframework/container-runtime 2.0.0-internal.7.0.1 → 2.0.0-internal.7.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/dist/containerRuntime.d.ts.map +1 -1
  2. package/dist/containerRuntime.js +6 -2
  3. package/dist/containerRuntime.js.map +1 -1
  4. package/dist/gc/gcConfigs.d.ts.map +1 -1
  5. package/dist/gc/gcConfigs.js +4 -1
  6. package/dist/gc/gcConfigs.js.map +1 -1
  7. package/dist/gc/gcDefinitions.d.ts +7 -2
  8. package/dist/gc/gcDefinitions.d.ts.map +1 -1
  9. package/dist/gc/gcDefinitions.js +8 -3
  10. package/dist/gc/gcDefinitions.js.map +1 -1
  11. package/dist/gc/gcTelemetry.d.ts +1 -1
  12. package/dist/gc/gcTelemetry.d.ts.map +1 -1
  13. package/dist/gc/gcTelemetry.js +20 -8
  14. package/dist/gc/gcTelemetry.js.map +1 -1
  15. package/dist/gc/index.d.ts +1 -1
  16. package/dist/gc/index.d.ts.map +1 -1
  17. package/dist/gc/index.js +3 -1
  18. package/dist/gc/index.js.map +1 -1
  19. package/dist/opLifecycle/opGroupingManager.d.ts +10 -2
  20. package/dist/opLifecycle/opGroupingManager.d.ts.map +1 -1
  21. package/dist/opLifecycle/opGroupingManager.js +23 -3
  22. package/dist/opLifecycle/opGroupingManager.js.map +1 -1
  23. package/dist/opLifecycle/outbox.d.ts +0 -1
  24. package/dist/opLifecycle/outbox.d.ts.map +1 -1
  25. package/dist/opLifecycle/outbox.js +2 -1
  26. package/dist/opLifecycle/outbox.js.map +1 -1
  27. package/dist/packageVersion.d.ts +1 -1
  28. package/dist/packageVersion.js +1 -1
  29. package/dist/packageVersion.js.map +1 -1
  30. package/lib/containerRuntime.d.ts.map +1 -1
  31. package/lib/containerRuntime.js +6 -2
  32. package/lib/containerRuntime.js.map +1 -1
  33. package/lib/gc/gcConfigs.d.ts.map +1 -1
  34. package/lib/gc/gcConfigs.js +5 -2
  35. package/lib/gc/gcConfigs.js.map +1 -1
  36. package/lib/gc/gcDefinitions.d.ts +7 -2
  37. package/lib/gc/gcDefinitions.d.ts.map +1 -1
  38. package/lib/gc/gcDefinitions.js +7 -2
  39. package/lib/gc/gcDefinitions.js.map +1 -1
  40. package/lib/gc/gcTelemetry.d.ts +1 -1
  41. package/lib/gc/gcTelemetry.d.ts.map +1 -1
  42. package/lib/gc/gcTelemetry.js +21 -9
  43. package/lib/gc/gcTelemetry.js.map +1 -1
  44. package/lib/gc/index.d.ts +1 -1
  45. package/lib/gc/index.d.ts.map +1 -1
  46. package/lib/gc/index.js +1 -1
  47. package/lib/gc/index.js.map +1 -1
  48. package/lib/opLifecycle/opGroupingManager.d.ts +10 -2
  49. package/lib/opLifecycle/opGroupingManager.d.ts.map +1 -1
  50. package/lib/opLifecycle/opGroupingManager.js +23 -3
  51. package/lib/opLifecycle/opGroupingManager.js.map +1 -1
  52. package/lib/opLifecycle/outbox.d.ts +0 -1
  53. package/lib/opLifecycle/outbox.d.ts.map +1 -1
  54. package/lib/opLifecycle/outbox.js +2 -1
  55. package/lib/opLifecycle/outbox.js.map +1 -1
  56. package/lib/packageVersion.d.ts +1 -1
  57. package/lib/packageVersion.js +1 -1
  58. package/lib/packageVersion.js.map +1 -1
  59. package/package.json +15 -15
  60. package/src/containerRuntime.ts +11 -2
  61. package/src/gc/gcConfigs.ts +8 -2
  62. package/src/gc/gcDefinitions.ts +10 -2
  63. package/src/gc/gcTelemetry.ts +28 -17
  64. package/src/gc/index.ts +2 -0
  65. package/src/opLifecycle/opGroupingManager.ts +34 -2
  66. package/src/opLifecycle/outbox.ts +4 -2
  67. package/src/packageVersion.ts +1 -1
@@ -5,6 +5,8 @@
5
5
 
6
6
  import { assert } from "@fluidframework/core-utils";
7
7
  import { ISequencedDocumentMessage } from "@fluidframework/protocol-definitions";
8
+ import { createChildLogger } from "@fluidframework/telemetry-utils";
9
+ import { ITelemetryBaseLogger } from "@fluidframework/core-interfaces";
8
10
  import { ContainerMessageType } from "../messageTypes";
9
11
  import { IBatch } from "./definitions";
10
12
 
@@ -26,16 +28,35 @@ function isGroupContents(opContents: any): opContents is IGroupedBatchMessageCon
26
28
  return opContents?.type === OpGroupingManager.groupedBatchOp;
27
29
  }
28
30
 
31
+ export interface OpGroupingManagerConfig {
32
+ readonly groupedBatchingEnabled: boolean;
33
+ readonly opCountThreshold: number;
34
+ readonly reentrantBatchGroupingEnabled: boolean;
35
+ }
36
+
29
37
  export class OpGroupingManager {
30
38
  static readonly groupedBatchOp = "groupedBatch";
39
+ private readonly logger;
31
40
 
32
- constructor(private readonly groupedBatchingEnabled: boolean) {}
41
+ constructor(private readonly config: OpGroupingManagerConfig, logger: ITelemetryBaseLogger) {
42
+ this.logger = createChildLogger({ logger, namespace: "OpGroupingManager" });
43
+ }
33
44
 
34
45
  public groupBatch(batch: IBatch): IBatch {
35
- if (batch.content.length < 2 || !this.groupedBatchingEnabled) {
46
+ if (!this.shouldGroup(batch)) {
36
47
  return batch;
37
48
  }
38
49
 
50
+ if (batch.content.length >= 1000) {
51
+ this.logger.sendTelemetryEvent({
52
+ eventName: "GroupLargeBatch",
53
+ length: batch.content.length,
54
+ threshold: this.config.opCountThreshold,
55
+ reentrant: batch.hasReentrantOps,
56
+ referenceSequenceNumber: batch.content[0].referenceSequenceNumber,
57
+ });
58
+ }
59
+
39
60
  for (const message of batch.content) {
40
61
  if (message.metadata) {
41
62
  const keys = Object.keys(message.metadata);
@@ -86,4 +107,15 @@ export class OpGroupingManager {
86
107
  compression: subMessage.compression,
87
108
  }));
88
109
  }
110
+
111
+ public shouldGroup(batch: IBatch): boolean {
112
+ return (
113
+ // Grouped batching must be enabled
114
+ this.config.groupedBatchingEnabled &&
115
+ // The number of ops in the batch must surpass the configured threshold
116
+ batch.content.length >= this.config.opCountThreshold &&
117
+ // Support for reentrant batches must be explicitly enabled
118
+ (this.config.reentrantBatchGroupingEnabled || batch.hasReentrantOps !== true)
119
+ );
120
+ }
89
121
  }
@@ -30,7 +30,6 @@ export interface IOutboxConfig {
30
30
  // The maximum size of a batch that we can send over the wire.
31
31
  readonly maxBatchSizeInBytes: number;
32
32
  readonly disablePartialFlush: boolean;
33
- readonly enableGroupedBatching: boolean;
34
33
  }
35
34
 
36
35
  export interface IOutboxParameters {
@@ -267,7 +266,10 @@ export class Outbox {
267
266
  }
268
267
 
269
268
  const rawBatch = batchManager.popBatch();
270
- if (rawBatch.hasReentrantOps === true && this.params.config.enableGroupedBatching) {
269
+ if (
270
+ rawBatch.hasReentrantOps === true &&
271
+ this.params.groupingManager.shouldGroup(rawBatch)
272
+ ) {
271
273
  assert(!this.rebasing, 0x6fa /* A rebased batch should never have reentrant ops */);
272
274
  // If a batch contains reentrant ops (ops created as a result from processing another op)
273
275
  // it needs to be rebased so that we can ensure consistent reference sequence numbers
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluidframework/container-runtime";
9
- export const pkgVersion = "2.0.0-internal.7.0.1";
9
+ export const pkgVersion = "2.0.0-internal.7.0.2";