Skip to content

Commit 7bed4dc

Browse files
committed
Checkpoint functional coverage identity and open-loop source
1 parent 0c05a32 commit 7bed4dc

1,000 files changed

Lines changed: 17127 additions & 5921 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎README.md‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,13 @@ native report preservation and complete-operation test requirements.
360360

361361
Full-text search comes from [ZoneTree.FullTextSearch](https://github.com/ZoneTree/ZoneTree.FullTextSearch). KeyLoad then ranks the results it finds and checks permissions on each one.
362362

363+
Native Orleans [runtime adoption](docs/Features/ClusterRouting/RuntimeAdoption.md)
364+
and [journal-backed Durable Jobs](docs/Features/ClusterRouting/RuntimeJournal.md)
365+
are being integrated. The source includes due-work wakeups, bounded telemetry,
366+
local lifecycle ownership and saga timeout jobs; its final build and runtime
367+
tests remain blocked by the current shared compiler/analyzer migration. Native
368+
job restart/adoption and real SDK/MCP RF3 fault qualification remain open.
369+
363370
For detailed status, see the [implementation tracker](docs/implementation/status.json) and the [qualification records](docs/implementation/). We publish performance numbers only from real GitHub Actions runs, on the [website](https://www.keyload.cloud/).
364371

365372
Website publication runs independently in CI when source changes. It uses the newest completed benchmark run with a verified aggregate when available; otherwise it publishes the product site without performance figures. A completed benchmark run triggers a fresh website build. [ADR-112](docs/ADR/ADR-112-independent-website-publication.md) records the source, artifact and publication checks; the revised route still needs delivered-source Linux CI and Pages verification.

‎benchmarks/KeyLoad.BenchmarkScenarios/Features/BenchmarkComparisons/Benchmarks/EmbeddedBenchmarks.cs‎

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ namespace KeyLoad.BenchmarkScenarios.Features.BenchmarkComparisons;
1010
[MemoryDiagnoser]
1111
public class EmbeddedBenchmarks : IDisposable
1212
{
13+
private const int FirstVectorCoordinate = 1;
14+
private const int SecondVectorCoordinate = 2;
15+
private const int ThirdVectorCoordinate = 3;
16+
1317
private const string TemporaryDirectoryPrefix = "keyload-benchmark-";
1418
private const string TenantId = "benchmark";
1519
private const string DatabaseId = "database";
@@ -75,7 +79,7 @@ public byte[] CompositeKey()
7579
/// <summary>Computes cosine similarity over the existing eight-dimensional input pair.</summary>
7680
[Benchmark]
7781
public double ExactCosine()
78-
=> SearchEngine.Similarity([1, 2, 3, 4, 5, 6, 7, 8], [8, 7, 6, 5, 4, 3, 2, 1], DistanceMetric.Cosine);
82+
=> SearchEngine.Similarity([FirstVectorCoordinate, SecondVectorCoordinate, ThirdVectorCoordinate, 4, 5, 6, 7, 8], [8, 7, 6, 5, 4, ThirdVectorCoordinate, SecondVectorCoordinate, FirstVectorCoordinate], DistanceMetric.Cosine);
7983

8084
/// <summary>Releases the fixture's database, store and temporary directory.</summary>
8185
[GlobalCleanup]
@@ -123,15 +127,18 @@ internal DatabaseEngine Database
123127

124128
internal void Initialize(PartitionRef partition)
125129
{
130+
const int BootstrapCatalogVersion = 1;
131+
const int InitialCatalogRevision = 0;
132+
126133
store = new(new(directory), options.Storage, options.PointCache);
127134
database = new(store, new AuthorizationPolicy(), options.Database, options.DueWork, options.EventSource,
128-
options.Messaging, options.GraphExecution);
135+
options.Messaging, options.GraphExecution, options.ChangeFeedExecution, options.TimeSeriesExecution);
129136
database.Bootstrap(new(PrincipalId, PrincipalScope,
130137
[new(Wildcard, Wildcard, Capability.All)], [Wildcard])
131138
{ ClusterAdministrator = true },
132139
DatabaseEngine.Credential(PrincipalId, PrincipalId, BenchmarkCredential));
133140
var shardId = store.Identity.NodeId;
134-
var catalog = new BootstrapPhysicalShardCatalogRequest(1, 0, shardId, store.Identity.Incarnation,
141+
var catalog = new BootstrapPhysicalShardCatalogRequest(BootstrapCatalogVersion, InitialCatalogRevision, shardId, store.Identity.Incarnation,
135142
[shardId.ToString(GuidFormat)]);
136143
Database.Apply(Database.CreateNativeOperation(OperationKind.BootstrapPhysicalShardCatalog,
137144
PhysicalShardCatalogIdentity.CreateBootstrapCommandId(shardId), PrincipalId,

‎benchmarks/KeyLoad.BenchmarkScenarios/Features/BenchmarkComparisons/Benchmarks/ScaledStorageReadBenchmarks.cs‎

Lines changed: 20 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using BenchmarkDotNet.Attributes;
22
using BenchmarkDotNet.Configs;
33
using BenchmarkDotNet.Jobs;
4+
using Microsoft.Extensions.Options;
45

56
namespace KeyLoad.BenchmarkScenarios.Features.BenchmarkComparisons;
67

@@ -11,8 +12,6 @@ namespace KeyLoad.BenchmarkScenarios.Features.BenchmarkComparisons;
1112
[Config(typeof(ScaledStorageReadUnrollConfiguration))]
1213
public class ScaledStorageReadBenchmarks : IDisposable
1314
{
14-
private const string EngineEnvironmentVariable = "KEYLOAD_RAW_STORAGE_ENGINE";
15-
private const string RecordCountEnvironmentVariable = "KEYLOAD_SCALED_STORAGE_RECORD_COUNT";
1615
private const string ZoneTreeLabel = "zonetree";
1716
private const int SmallPayloadBytes = 32;
1817
private const int LargePayloadBytes = 1024;
@@ -31,6 +30,7 @@ public class ScaledStorageReadBenchmarks : IDisposable
3130
private const string ChecksumMessage = "A scaled benchmark checksum differs from the exact full-index oracle.";
3231
private ScaledRawStorageFixture? _fixture;
3332
private bool _disposed;
33+
private IOptions<BenchmarkScenarioSelectionOptions>? selection;
3434

3535
/// <summary>Gets or sets the one exact lowercase ZoneTree selection.</summary>
3636
[ParamsSource(nameof(Engines))]
@@ -45,10 +45,10 @@ public class ScaledStorageReadBenchmarks : IDisposable
4545
public int RecordCount { get; set; } = HundredThousand;
4646

4747
/// <summary>Provides exactly one process-selected engine.</summary>
48-
public IEnumerable<string> Engines => [SelectEngine()];
48+
public IEnumerable<string> Engines => [Selection.Value.Engine];
4949

5050
/// <summary>Provides exactly one process-selected qualification count.</summary>
51-
public IEnumerable<int> RecordCounts => [SelectRecordCount()];
51+
public IEnumerable<int> RecordCounts => [BenchmarkScenarioSelectionRegistration.RecordCount(Selection.Value)];
5252

5353
/// <summary>Creates the real bounded engine and completes its full setup oracle.</summary>
5454
[GlobalSetup]
@@ -73,9 +73,12 @@ public void Setup()
7373
[Benchmark(OperationsPerInvoke = ReadsPerInvocation)]
7474
public ulong SequentialRead()
7575
{
76+
const int ChecksumInitialValue = 0;
77+
const int OperationInitialValue = 0;
78+
7679
var fixture = RequireFixture();
77-
ulong checksum = 0;
78-
for (var operation = 0; operation < ReadsPerInvocation; operation++)
80+
ulong checksum = ChecksumInitialValue;
81+
for (var operation = OperationInitialValue; operation < ReadsPerInvocation; operation++)
7982
{
8083
var identity = fixture.ReadNextSequential();
8184
if (identity != (ulong)(operation % RecordCount))
@@ -93,9 +96,12 @@ public ulong SequentialRead()
9396
[Benchmark(OperationsPerInvoke = ReadsPerInvocation)]
9497
public ulong RandomRead()
9598
{
99+
const int ChecksumInitialValue = 0;
100+
const int OperationInitialValue = 0;
101+
96102
var fixture = RequireFixture();
97-
ulong checksum = 0;
98-
for (var operation = 0; operation < ReadsPerInvocation; operation++)
103+
ulong checksum = ChecksumInitialValue;
104+
for (var operation = OperationInitialValue; operation < ReadsPerInvocation; operation++)
99105
{
100106
var identity = fixture.ReadNextRandom();
101107
checksum += identity;
@@ -137,12 +143,8 @@ protected virtual void Dispose(bool disposing)
137143
_disposed = true;
138144
}
139145

140-
private static string SelectEngine()
141-
{
142-
var selected = Environment.GetEnvironmentVariable(EngineEnvironmentVariable) ?? ZoneTreeLabel;
143-
ValidateEngine(selected);
144-
return selected;
145-
}
146+
private IOptions<BenchmarkScenarioSelectionOptions> Selection
147+
=> selection ??= BenchmarkScenarioSelectionRegistration.ReadScaled();
146148

147149
private static void ValidateEngine(string label)
148150
{
@@ -152,24 +154,6 @@ private static void ValidateEngine(string label)
152154
}
153155
}
154156

155-
private static int SelectRecordCount()
156-
{
157-
var configured = Environment.GetEnvironmentVariable(RecordCountEnvironmentVariable);
158-
if (configured is null)
159-
{
160-
return HundredThousand;
161-
}
162-
163-
if (int.TryParse(configured, System.Globalization.NumberStyles.None,
164-
System.Globalization.CultureInfo.InvariantCulture, out var count)
165-
&& count is HundredThousand or OneMillion)
166-
{
167-
return count;
168-
}
169-
170-
throw new InvalidOperationException(InvalidCountMessage);
171-
}
172-
173157
private ScaledRawStorageFixture RequireFixture()
174158
{
175159
ObjectDisposedException.ThrowIf(_disposed, this);
@@ -178,8 +162,11 @@ private ScaledRawStorageFixture RequireFixture()
178162

179163
private ulong ValidateChecksum(ulong actual)
180164
{
165+
const int RecordCountStep = 1;
166+
const ulong ArithmeticSeriesDivisor = 2UL;
167+
181168
var cycles = (ulong)(ReadsPerInvocation / RecordCount);
182-
var expected = checked(cycles * (ulong)RecordCount * (ulong)(RecordCount - 1) / 2UL);
169+
var expected = checked(cycles * (ulong)RecordCount * (ulong)(RecordCount - RecordCountStep) / ArithmeticSeriesDivisor);
183170
if (actual != expected)
184171
{
185172
throw new InvalidOperationException(ChecksumMessage);

‎benchmarks/KeyLoad.BenchmarkScenarios/Features/BenchmarkComparisons/Benchmarks/Serialization/NativeCommandSerializationBenchmarks.cs‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@ namespace KeyLoad.BenchmarkScenarios.Features.BenchmarkComparisons;
55

66
/// <summary>Measures full native and historical typed JSON serialization of polymorphic command requests.</summary>
77
[MemoryDiagnoser]
8-
[SimpleJob(RuntimeMoniker.Net10_0, launchCount: 2, warmupCount: 3, iterationCount: 6, id: "NativeSerialization")]
8+
[SimpleJob(RuntimeMoniker.Net10_0, launchCount: 2, warmupCount: 3, iterationCount: 6, id: nameof(NativeSerialization))]
99
[IterationTime(200)]
1010
public class NativeCommandSerializationBenchmarks
1111
{
12+
private const string RequireStateFailureMessage = "The native serialization fixture is not initialized.";
13+
1214
private NativeSerializationBenchmarkState<CommandRequest>? state;
1315

1416
/// <summary>Gets or sets the document JSON byte length and vector backing byte length; envelope overhead is additional.</summary>
@@ -19,12 +21,14 @@ public class NativeCommandSerializationBenchmarks
1921
[GlobalSetup]
2022
public void Setup()
2123
{
24+
const string SetupFailureMessage = "The native serialization fixture is already initialized.";
25+
2226
if (state is not null)
2327
{
24-
throw new InvalidOperationException("The native serialization fixture is already initialized.");
28+
throw new InvalidOperationException(SetupFailureMessage);
2529
}
2630
var candidate = new NativeSerializationBenchmarkState<CommandRequest>(NativeSerializationBenchmarkCorpus.Command(PayloadBytes));
27-
NativeSerializationBenchmarkManifest.Write(nameof(NativeCommandSerializationBenchmarks), PayloadBytes, candidate);
31+
NativeSerializationBenchmarkManifest.Write(nameof(NativeCommandSerializationBenchmarks), PayloadBytes, candidate, BenchmarkArtifactRegistration.ReadNativeSerialization());
2832
state = candidate;
2933
}
3034

@@ -53,5 +57,5 @@ public void Setup()
5357
public void Cleanup() => state = null;
5458

5559
private NativeSerializationBenchmarkState<CommandRequest> RequireState()
56-
=> state ?? throw new InvalidOperationException("The native serialization fixture is not initialized.");
60+
=> state ?? throw new InvalidOperationException(RequireStateFailureMessage);
5761
}

‎benchmarks/KeyLoad.BenchmarkScenarios/Features/BenchmarkComparisons/Benchmarks/Serialization/NativeDocumentSerializationBenchmarks.cs‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@ namespace KeyLoad.BenchmarkScenarios.Features.BenchmarkComparisons;
55

66
/// <summary>Measures full native and historical typed JSON serialization of document results.</summary>
77
[MemoryDiagnoser]
8-
[SimpleJob(RuntimeMoniker.Net10_0, launchCount: 2, warmupCount: 3, iterationCount: 6, id: "NativeSerialization")]
8+
[SimpleJob(RuntimeMoniker.Net10_0, launchCount: 2, warmupCount: 3, iterationCount: 6, id: nameof(NativeSerialization))]
99
[IterationTime(200)]
1010
public class NativeDocumentSerializationBenchmarks
1111
{
12+
private const string RequireStateFailureMessage = "The native serialization fixture is not initialized.";
13+
1214
private NativeSerializationBenchmarkState<DocumentResult>? state;
1315

1416
/// <summary>Gets or sets the exact UTF-8 byte length of the embedded document JSON; envelope overhead is additional.</summary>
@@ -19,12 +21,14 @@ public class NativeDocumentSerializationBenchmarks
1921
[GlobalSetup]
2022
public void Setup()
2123
{
24+
const string SetupFailureMessage = "The native serialization fixture is already initialized.";
25+
2226
if (state is not null)
2327
{
24-
throw new InvalidOperationException("The native serialization fixture is already initialized.");
28+
throw new InvalidOperationException(SetupFailureMessage);
2529
}
2630
var candidate = new NativeSerializationBenchmarkState<DocumentResult>(NativeSerializationBenchmarkCorpus.Document(PayloadBytes));
27-
NativeSerializationBenchmarkManifest.Write(nameof(NativeDocumentSerializationBenchmarks), PayloadBytes, candidate);
31+
NativeSerializationBenchmarkManifest.Write(nameof(NativeDocumentSerializationBenchmarks), PayloadBytes, candidate, BenchmarkArtifactRegistration.ReadNativeSerialization());
2832
state = candidate;
2933
}
3034

@@ -53,5 +57,5 @@ public void Setup()
5357
public void Cleanup() => state = null;
5458

5559
private NativeSerializationBenchmarkState<DocumentResult> RequireState()
56-
=> state ?? throw new InvalidOperationException("The native serialization fixture is not initialized.");
60+
=> state ?? throw new InvalidOperationException(RequireStateFailureMessage);
5761
}

‎benchmarks/KeyLoad.BenchmarkScenarios/Features/BenchmarkComparisons/Benchmarks/Serialization/NativeSerializationBenchmarkCorpus.cs‎

Lines changed: 52 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,56 +6,92 @@ namespace KeyLoad.BenchmarkScenarios.Features.BenchmarkComparisons;
66

77
internal static class NativeSerializationBenchmarkCorpus
88
{
9+
private const string CorpusCommandIdentity = "f76ee337-b9f1-49d7-a407-fb28af7bac98";
10+
private const string CorpusCollection = "documents";
11+
private const string CorpusDocumentId = "document-1";
12+
private const int CorpusDocumentRevision = 42;
13+
private const string RedactedSecretField = "secret";
14+
private const string CorpusTenant = "tenant";
15+
private const string CorpusDatabase = "database";
16+
private const string CorpusDomain = "domain";
17+
918
internal const int SmallPayloadBytes = 1024;
1019
internal const int LargePayloadBytes = 16384;
1120
internal const string UnicodeText = "Київ🌍";
1221
private const string JsonPrefix = "{\"text\":\"Київ🌍\",\"escaped\":\"line\\n\\\"quoted\\\"\\\\tail\",\"number\":1.2300,\"padding\":\"";
1322
private const string JsonSuffix = "\"}";
1423
private const string PartitionId = "partition-1";
15-
private static readonly Guid CommandId = new("f76ee337-b9f1-49d7-a407-fb28af7bac98");
24+
private static readonly Guid CommandId = new(CorpusCommandIdentity);
1625

1726
internal static DocumentResult Document(int payloadBytes)
18-
=> new(new(Partition(), "documents", "document-1"), 42, Json(payloadBytes), true, ["secret", UnicodeText]);
27+
=> new(new(Partition(), CorpusCollection, CorpusDocumentId), CorpusDocumentRevision, Json(payloadBytes), true, [RedactedSecretField, UnicodeText]);
1928

2029
internal static CommandRequest Command(int payloadBytes)
2130
{
31+
const int StartEmptyCount = 0;
32+
const int VectorCycleLength = 31;
33+
const int PatternOffset = 15;
34+
const float PatternScale = 16f;
35+
const string CommandIdText = "semantic";
36+
const string CommandModelText = "model-α";
37+
const string CommandVersionText = "v1";
38+
const string CommandCollectionText = "documents";
39+
const string CommandCommandIdText = "document-1";
40+
const int PreviousDocumentRevision = 41;
41+
const string CommandOwnerIdText = "owner";
42+
const string CommandProjectIdText = "project";
43+
const string CommandJsonText = "{\"optional\":null}";
44+
const string CommandFieldText = "embedding";
45+
const int ExpectedVectorDocumentRevision = 42;
46+
const int CorpusOwnershipEpoch = 7;
47+
2248
RequireSize(payloadBytes);
2349
var dimension = payloadBytes / sizeof(float);
24-
var values = Enumerable.Range(0, dimension).Select(index => (index % 31 - 15) / 16f).ToImmutableArray();
25-
var space = new VectorSpace("semantic", dimension, DistanceMetric.Cosine, "model-α", "v1");
50+
var values = Enumerable.Range(StartEmptyCount, dimension).Select(index => (index % VectorCycleLength - PatternOffset) / PatternScale).ToImmutableArray();
51+
var space = new VectorSpace(CommandIdText, dimension, DistanceMetric.Cosine, CommandModelText, CommandVersionText);
2652
return new(CommandId, Partition(),
2753
[
28-
new PutDocument("documents", "document-1", Json(payloadBytes), 41, new("owner", "project"), true),
29-
new PutDocument("documents", "document-2", "{\"optional\":null}"),
30-
new PutVector("documents", "document-1", "embedding", values, space, 42)
31-
], 7);
54+
new PutDocument(CommandCollectionText, CommandCommandIdText, Json(payloadBytes), PreviousDocumentRevision, new(CommandOwnerIdText, CommandProjectIdText), true),
55+
new PutDocument(CommandCollectionText, "document-2", CommandJsonText),
56+
new PutVector(CommandCollectionText, CommandCommandIdText, CommandFieldText, values, space, ExpectedVectorDocumentRevision)
57+
], CorpusOwnershipEpoch);
3258
}
3359

3460
internal static StorageMutation[] Storage(int payloadBytes)
3561
{
62+
const int IndexInitialValue = 0;
63+
const int PatternScale = 37;
64+
const int PatternOffset = 11;
65+
const int StorageEmptyCount = 0;
66+
const int MaximumCorpusByte = 255;
67+
const int StorageSingleItemCount = 1;
68+
const int SecondStorageKeyPrefix = 2;
69+
3670
RequireSize(payloadBytes);
3771
var value = new byte[payloadBytes];
38-
for (var index = 0; index < value.Length; index++)
72+
for (var index = IndexInitialValue; index < value.Length; index++)
3973
{
40-
value[index] = unchecked((byte)(index * 37 + 11));
74+
value[index] = unchecked((byte)(index * PatternScale + PatternOffset));
4175
}
4276
return
4377
[
44-
new(new byte[] { 0, 255, 1 }, value),
45-
new(new byte[] { 2, 0, 255 }, ReadOnlyMemory<byte>.Empty),
46-
new(new byte[] { 3, 255, 0 }, null),
47-
new(new byte[] { 4, 0, 254 }, Encoding.UTF8.GetBytes(UnicodeText))
78+
new(new byte[] { StorageEmptyCount, MaximumCorpusByte, StorageSingleItemCount }, value),
79+
new(new byte[] { SecondStorageKeyPrefix, StorageEmptyCount, MaximumCorpusByte }, ReadOnlyMemory<byte>.Empty),
80+
new(new byte[] { 3, MaximumCorpusByte, StorageEmptyCount }, null),
81+
new(new byte[] { 4, StorageEmptyCount, 254 }, Encoding.UTF8.GetBytes(UnicodeText))
4882
];
4983
}
5084

5185
internal static string Json(int payloadBytes)
5286
{
87+
const char CCharacter = 'x';
88+
5389
RequireSize(payloadBytes);
5490
var padding = payloadBytes - Encoding.UTF8.GetByteCount(JsonPrefix) - Encoding.UTF8.GetByteCount(JsonSuffix);
55-
return JsonPrefix + new string('x', padding) + JsonSuffix;
91+
return JsonPrefix + new string(CCharacter, padding) + JsonSuffix;
5692
}
5793

58-
private static PartitionRef Partition() => new("tenant", "database", "domain", PartitionId);
94+
private static PartitionRef Partition() => new(CorpusTenant, CorpusDatabase, CorpusDomain, PartitionId);
5995

6096
private static void RequireSize(int payloadBytes)
6197
{

0 commit comments

Comments
 (0)