@fluidframework/container-runtime 2.0.0-internal.7.1.1 → 2.0.0-internal.7.1.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 +37 -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,38 @@ 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(
42
+ private readonly config: OpGroupingManagerConfig,
43
+ logger: ITelemetryBaseLogger,
44
+ ) {
45
+ this.logger = createChildLogger({ logger, namespace: "OpGroupingManager" });
46
+ }
33
47
 
34
48
  public groupBatch(batch: IBatch): IBatch {
35
- if (batch.content.length < 2 || !this.groupedBatchingEnabled) {
49
+ if (!this.shouldGroup(batch)) {
36
50
  return batch;
37
51
  }
38
52
 
53
+ if (batch.content.length >= 1000) {
54
+ this.logger.sendTelemetryEvent({
55
+ eventName: "GroupLargeBatch",
56
+ length: batch.content.length,
57
+ threshold: this.config.opCountThreshold,
58
+ reentrant: batch.hasReentrantOps,
59
+ referenceSequenceNumber: batch.content[0].referenceSequenceNumber,
60
+ });
61
+ }
62
+
39
63
  for (const message of batch.content) {
40
64
  if (message.metadata) {
41
65
  const keys = Object.keys(message.metadata);
@@ -86,4 +110,15 @@ export class OpGroupingManager {
86
110
  compression: subMessage.compression,
87
111
  }));
88
112
  }
113
+
114
+ public shouldGroup(batch: IBatch): boolean {
115
+ return (
116
+ // Grouped batching must be enabled
117
+ this.config.groupedBatchingEnabled &&
118
+ // The number of ops in the batch must surpass the configured threshold
119
+ batch.content.length >= this.config.opCountThreshold &&
120
+ // Support for reentrant batches must be explicitly enabled
121
+ (this.config.reentrantBatchGroupingEnabled || batch.hasReentrantOps !== true)
122
+ );
123
+ }
89
124
  }
@@ -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 {
@@ -270,7 +269,10 @@ export class Outbox {
270
269
  }
271
270
 
272
271
  const rawBatch = batchManager.popBatch();
273
- if (rawBatch.hasReentrantOps === true && this.params.config.enableGroupedBatching) {
272
+ if (
273
+ rawBatch.hasReentrantOps === true &&
274
+ this.params.groupingManager.shouldGroup(rawBatch)
275
+ ) {
274
276
  assert(!this.rebasing, 0x6fa /* A rebased batch should never have reentrant ops */);
275
277
  // If a batch contains reentrant ops (ops created as a result from processing another op)
276
278
  // 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.1.1";
9
+ export const pkgVersion = "2.0.0-internal.7.1.2";