@feltdb/core 0.8.3 → 0.8.5
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.
- package/dist/cli/commands.js +4 -1
- package/dist/cli/provisioning-neutrality.js +79 -0
- package/dist/collection.d.ts +43 -1
- package/dist/collection.d.ts.map +1 -1
- package/dist/collection.js +192 -22
- package/dist/create/create.js +25 -21
- package/dist/create/managed-account.js +11 -0
- package/dist/create/package-versions.js +1 -1
- package/dist/create/server-source/Cargo.lock +165 -0
- package/dist/create/server-source/Cargo.toml +9 -0
- package/dist/create/server-source/crates/feltdb/Cargo.toml +3 -0
- package/dist/create/server-source/crates/feltdb/benches/gate13_baseline.rs +44 -44
- package/dist/create/server-source/crates/feltdb/benches/gate13_phase_7_1_release_economics.rs +12 -24
- package/dist/create/server-source/crates/feltdb/benches/gate_13_redux.rs +7 -13
- package/dist/create/server-source/crates/feltdb/benches/gate_13_regression_runner.rs +13 -10
- package/dist/create/server-source/crates/feltdb/benches/gate_14a_concurrent_writer_scaling.rs +12 -9
- package/dist/create/server-source/crates/feltdb/benches/gate_14a_production_admission_revalidation.rs +78 -25
- package/dist/create/server-source/crates/feltdb/benches/gate_14a_rc2_admission_contract.rs +16 -13
- package/dist/create/server-source/crates/feltdb/benches/gate_14a_rc_root_cause.rs +13 -5
- package/dist/create/server-source/crates/feltdb/benches/gate_14a_sync1_queued_prototype.rs +41 -22
- package/dist/create/server-source/crates/feltdb/benches/gate_14a_sync_economics.rs +33 -15
- package/dist/create/server-source/crates/feltdb/benches/gate_14b_causal_backlog_scaling.rs +100 -33
- package/dist/create/server-source/crates/feltdb/benches/gate_14c_replication_contract_test.rs +56 -20
- package/dist/create/server-source/crates/feltdb/benches/gate_14c_replication_scaling.rs +116 -41
- package/dist/create/server-source/crates/feltdb/benches/gate_14d_combined_dimension_scaling.rs +186 -55
- package/dist/create/server-source/crates/feltdb/benches/phase_7_1_2_optimization_benchmark.rs +64 -26
- package/dist/create/server-source/crates/feltdb/benches/phase_7_1_3_crossover_analysis.rs +46 -15
- package/dist/create/server-source/crates/feltdb/src/admission.rs +8 -15
- package/dist/create/server-source/crates/feltdb/src/admission_contract_tests.rs +43 -13
- package/dist/create/server-source/crates/feltdb/src/adversarial_transport.rs +15 -42
- package/dist/create/server-source/crates/feltdb/src/analytics.rs +65 -19
- package/dist/create/server-source/crates/feltdb/src/application.rs +113 -30
- package/dist/create/server-source/crates/feltdb/src/authorization_security_tests.rs +475 -140
- package/dist/create/server-source/crates/feltdb/src/cardinality_diagnostics.rs +17 -15
- package/dist/create/server-source/crates/feltdb/src/cardinality_endpoint.rs +0 -1
- package/dist/create/server-source/crates/feltdb/src/causal_backlog_bound.rs +59 -15
- package/dist/create/server-source/crates/feltdb/src/causal_dependency_barrier.rs +266 -114
- package/dist/create/server-source/crates/feltdb/src/causal_dependency_barrier_phase_7_1.rs +25 -7
- package/dist/create/server-source/crates/feltdb/src/concurrency_fuzzing.rs +10 -15
- package/dist/create/server-source/crates/feltdb/src/consistency_contract.rs +3 -11
- package/dist/create/server-source/crates/feltdb/src/crash_atomic_boundary.rs +14 -5
- package/dist/create/server-source/crates/feltdb/src/crash_injection.rs +21 -25
- package/dist/create/server-source/crates/feltdb/src/crash_recovery_tests.rs +14 -11
- package/dist/create/server-source/crates/feltdb/src/dedup_bound_investigation.rs +103 -22
- package/dist/create/server-source/crates/feltdb/src/distributed_indexing.rs +18 -15
- package/dist/create/server-source/crates/feltdb/src/durability_guarantees.rs +12 -8
- package/dist/create/server-source/crates/feltdb/src/durable_dedup_set.rs +1 -5
- package/dist/create/server-source/crates/feltdb/src/durable_operation_identity.rs +87 -23
- package/dist/create/server-source/crates/feltdb/src/durable_operation_log.rs +3 -7
- package/dist/create/server-source/crates/feltdb/src/durable_sync.rs +10 -9
- package/dist/create/server-source/crates/feltdb/src/equality_index.rs +595 -0
- package/dist/create/server-source/crates/feltdb/src/in_process_transport.rs +1 -6
- package/dist/create/server-source/crates/feltdb/src/indexing.rs +35 -38
- package/dist/create/server-source/crates/feltdb/src/lib.rs +1050 -117
- package/dist/create/server-source/crates/feltdb/src/managed_cas_tests.rs +4 -1
- package/dist/create/server-source/crates/feltdb/src/metrics.rs +0 -1
- package/dist/create/server-source/crates/feltdb/src/multi_node_convergence.rs +1 -2
- package/dist/create/server-source/crates/feltdb/src/multi_operation_transaction.rs +107 -30
- package/dist/create/server-source/crates/feltdb/src/observability.rs +19 -6
- package/dist/create/server-source/crates/feltdb/src/operation_algebra.rs +12 -11
- package/dist/create/server-source/crates/feltdb/src/operation_log.rs +9 -4
- package/dist/create/server-source/crates/feltdb/src/p1_application_atomicity.rs +65 -18
- package/dist/create/server-source/crates/feltdb/src/p1_atomicity_acceptance.rs +193 -57
- package/dist/create/server-source/crates/feltdb/src/partition_reconciliation.rs +37 -27
- package/dist/create/server-source/crates/feltdb/src/permutation_scheduler.rs +38 -10
- package/dist/create/server-source/crates/feltdb/src/persistence_reality.rs +20 -14
- package/dist/create/server-source/crates/feltdb/src/phase1b_acceptance.rs +394 -229
- package/dist/create/server-source/crates/feltdb/src/phase1c1_acceptance.rs +8 -6
- package/dist/create/server-source/crates/feltdb/src/phase1c2_acceptance.rs +11 -13
- package/dist/create/server-source/crates/feltdb/src/phase1c3_acceptance.rs +90 -72
- package/dist/create/server-source/crates/feltdb/src/phase1c_atomicity_proof.rs +3 -3
- package/dist/create/server-source/crates/feltdb/src/phase5_integration.rs +33 -11
- package/dist/create/server-source/crates/feltdb/src/phase5_scenarios.rs +6 -6
- package/dist/create/server-source/crates/feltdb/src/phase6_adversarial_scenarios.rs +14 -56
- package/dist/create/server-source/crates/feltdb/src/phase6_convergence_validator.rs +29 -27
- package/dist/create/server-source/crates/feltdb/src/phase6_persistence.rs +35 -17
- package/dist/create/server-source/crates/feltdb/src/phase_1c_real_tcp.rs +8 -2
- package/dist/create/server-source/crates/feltdb/src/phase_2a_failures.rs +59 -15
- package/dist/create/server-source/crates/feltdb/src/phase_2b_network.rs +70 -17
- package/dist/create/server-source/crates/feltdb/src/phase_2c_cascading.rs +23 -6
- package/dist/create/server-source/crates/feltdb/src/phase_3_durability.rs +12 -3
- package/dist/create/server-source/crates/feltdb/src/phase_4_baseline.rs +41 -11
- package/dist/create/server-source/crates/feltdb/src/phase_5_soak.rs +56 -25
- package/dist/create/server-source/crates/feltdb/src/policy_evaluation.rs +701 -245
- package/dist/create/server-source/crates/feltdb/src/production_api.rs +31 -13
- package/dist/create/server-source/crates/feltdb/src/query_execution_diagnostics.rs +126 -0
- package/dist/create/server-source/crates/feltdb/src/query_performance.rs +6 -8
- package/dist/create/server-source/crates/feltdb/src/replay_fuzzing.rs +5 -5
- package/dist/create/server-source/crates/feltdb/src/replica_acknowledgements.rs +48 -18
- package/dist/create/server-source/crates/feltdb/src/replica_membership.rs +30 -11
- package/dist/create/server-source/crates/feltdb/src/replication_manager.rs +6 -3
- package/dist/create/server-source/crates/feltdb/src/replication_protocol.rs +4 -3
- package/dist/create/server-source/crates/feltdb/src/sharding.rs +36 -10
- package/dist/create/server-source/crates/feltdb/src/state_conflict_contract.rs +516 -0
- package/dist/create/server-source/crates/feltdb/src/state_contract.rs +305 -6
- package/dist/create/server-source/crates/feltdb/src/state_diff_contract.rs +222 -0
- package/dist/create/server-source/crates/feltdb/src/state_facade.rs +82 -54
- package/dist/create/server-source/crates/feltdb/src/state_hash.rs +2 -2
- package/dist/create/server-source/crates/feltdb/src/state_model.rs +1514 -537
- package/dist/create/server-source/crates/feltdb/src/state_transition_store.rs +6 -3
- package/dist/create/server-source/crates/feltdb/src/state_trigger.rs +672 -0
- package/dist/create/server-source/crates/feltdb/src/submission.rs +5 -11
- package/dist/create/server-source/crates/feltdb/src/sync.rs +12 -0
- package/dist/create/server-source/crates/feltdb/src/tcp_transport.rs +6 -8
- package/dist/create/server-source/crates/feltdb/src/transaction_api.rs +24 -35
- package/dist/create/server-source/crates/feltdb/src/transaction_invariants.rs +24 -8
- package/dist/create/server-source/crates/feltdb/src/transaction_preconditions.rs +248 -59
- package/dist/create/server-source/crates/feltdb/src/transactions.rs +17 -20
- package/dist/create/server-source/crates/feltdb/src/trigger_contract.rs +749 -0
- package/dist/create/server-source/crates/feltdb/src/worker_mesh.rs +1 -0
- package/dist/create/server-source/crates/feltdb/src/workload.rs +512 -4
- package/dist/create/server-source/crates/feltdb/src/workload_diagnostics.rs +442 -0
- package/dist/create/server-source/crates/feltdb/tests/branching_evidence.rs +299 -0
- package/dist/create/server-source/crates/feltdb/tests/current_revision_authority_evidence.rs +288 -0
- package/dist/create/server-source/crates/feltdb/tests/durable_format_compatibility.rs +392 -0
- package/dist/create/server-source/crates/feltdb/tests/feltdb_state_boundary_tests.rs +436 -220
- package/dist/create/server-source/crates/feltdb/tests/fixtures/state_conflict_contract_corpus.json +1916 -0
- package/dist/create/server-source/crates/feltdb/tests/fixtures/state_diff_contract_corpus.json +1878 -0
- package/dist/create/server-source/crates/feltdb/tests/fixtures/trigger_contract_corpus.json +1862 -0
- package/dist/create/server-source/crates/feltdb/tests/pr34_query_collection.rs +234 -0
- package/dist/create/server-source/crates/feltdb/tests/pr35_equality_index.rs +947 -0
- package/dist/create/server-source/crates/feltdb/tests/pr7_self_authorization_proof.rs +5 -8
- package/dist/create/server-source/crates/feltdb/tests/pr8_vocabulary_assessment.rs +52 -44
- package/dist/create/server-source/crates/feltdb/tests/pr9_phase2_boundary_tests.rs +33 -16
- package/dist/create/server-source/crates/feltdb/tests/pr9_phase3a_path_a_tests.rs +22 -7
- package/dist/create/server-source/crates/feltdb/tests/pr9_phase3c_authorized_mutations.rs +41 -22
- package/dist/create/server-source/crates/feltdb/tests/pr9_phase3c_role_based_authorization.rs +25 -8
- package/dist/create/server-source/crates/feltdb/tests/pr9_phase3c_simple_auth_delete.rs +9 -6
- package/dist/create/server-source/crates/feltdb/tests/pr9_phase3c_team_delete_role_authorization.rs +120 -69
- package/dist/create/server-source/crates/feltdb/tests/pr9_teams_role_based_access.rs +21 -10
- package/dist/create/server-source/crates/feltdb/tests/production_readiness_contract.rs +1032 -0
- package/dist/create/server-source/crates/feltdb/tests/reconciliation_application.rs +868 -0
- package/dist/create/server-source/crates/feltdb/tests/reconciliation_wire_format_evidence.rs +221 -0
- package/dist/create/server-source/crates/feltdb/tests/resource_scoped_revisions.rs +338 -0
- package/dist/create/server-source/crates/feltdb/tests/revision_identity_contract.rs +1039 -0
- package/dist/create/server-source/crates/feltdb/tests/revision_model_decision.rs +739 -0
- package/dist/create/server-source/crates/feltdb/tests/revision_retention_boundary_evidence.rs +427 -0
- package/dist/create/server-source/crates/feltdb/tests/saas_authorization_integration.rs +3 -3
- package/dist/create/server-source/crates/feltdb/tests/saas_invitation_lifecycle.rs +25 -22
- package/dist/create/server-source/crates/feltdb/tests/state_conflict_contract_conformance.rs +1799 -0
- package/dist/create/server-source/crates/feltdb/tests/state_diff_contract_conformance.rs +1316 -0
- package/dist/create/server-source/crates/feltdb/tests/state_model_integration.rs +53 -61
- package/dist/create/server-source/crates/feltdb/tests/state_persistence_integration.rs +156 -61
- package/dist/create/server-source/crates/feltdb/tests/state_store_boundary_evidence.rs +299 -0
- package/dist/create/server-source/crates/feltdb/tests/sync_divergence_evidence.rs +255 -0
- package/dist/create/server-source/crates/feltdb/tests/three_way_input_boundary_evidence.rs +249 -0
- package/dist/create/server-source/crates/feltdb/tests/trigger_contract_conformance.rs +994 -0
- package/dist/create/server-source/crates/feltdb-server/src/app_state.rs +2 -1
- package/dist/create/server-source/crates/feltdb-server/src/audit.rs +1137 -29
- package/dist/create/server-source/crates/feltdb-server/src/auth.rs +164 -13
- package/dist/create/server-source/crates/feltdb-server/src/main.rs +800 -34
- package/dist/db.d.ts +33 -34
- package/dist/db.d.ts.map +1 -1
- package/dist/db.js +74 -20
- package/dist/deployment.d.ts +30 -0
- package/dist/deployment.d.ts.map +1 -0
- package/dist/deployment.js +130 -0
- package/dist/embedded-transaction.d.ts +22 -4
- package/dist/embedded-transaction.d.ts.map +1 -1
- package/dist/embedded-transaction.js +51 -5
- package/dist/feltdb.d.ts +14 -2
- package/dist/feltdb.d.ts.map +1 -1
- package/dist/file-db.js +1 -1
- package/dist/http-client.d.ts +14 -0
- package/dist/http-client.d.ts.map +1 -1
- package/dist/http-client.js +23 -5
- package/dist/http-db.d.ts +119 -1
- package/dist/http-db.d.ts.map +1 -1
- package/dist/http-db.js +346 -31
- package/dist/index-core.d.ts +2 -0
- package/dist/index-core.d.ts.map +1 -1
- package/dist/index-core.js +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -0
- package/dist/indexeddb-db.d.ts.map +1 -1
- package/dist/indexeddb-db.js +35 -21
- package/dist/managed-recovery.d.ts +192 -0
- package/dist/managed-recovery.d.ts.map +1 -0
- package/dist/managed-recovery.js +242 -0
- package/dist/memory-db.js +1 -1
- package/dist/studio-app/assets/{feltdb_wasm-DB8cX151.js → feltdb_wasm-DaNwCLRX.js} +1 -1
- package/dist/studio-app/assets/feltdb_wasm_bg-DnsHNv6g.wasm +0 -0
- package/dist/studio-app/assets/index-j8IlhNqJ.js +29 -0
- package/dist/studio-app/index.html +1 -1
- package/dist/transaction.d.ts +30 -0
- package/dist/transaction.d.ts.map +1 -1
- package/dist/transaction.js +41 -0
- package/dist/wasm/feltdb_wasm_bg.wasm +0 -0
- package/dist/workload.d.ts +2 -1
- package/dist/workload.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/studio-app/assets/feltdb_wasm_bg-ClhDHp0S.wasm +0 -0
- package/dist/studio-app/assets/index-B0k4UAlI.js +0 -29
package/dist/create/server-source/crates/feltdb/benches/gate_14d_combined_dimension_scaling.rs
CHANGED
|
@@ -17,13 +17,13 @@
|
|
|
17
17
|
/// - Replication: messages sent, delivered, delivery rate
|
|
18
18
|
/// - Convergence: all replicas converged, state_hash match
|
|
19
19
|
/// - Interaction ratio: observed throughput / expected composed throughput
|
|
20
|
-
|
|
21
20
|
use feltdb::{
|
|
22
|
-
convergence::VectorClock,
|
|
21
|
+
convergence::VectorClock,
|
|
22
|
+
distributed_transactions::{
|
|
23
23
|
DistributedTransactionExecutor, ReplicationMessage, TransactionEnvelope,
|
|
24
24
|
},
|
|
25
25
|
state_hash::StateHash,
|
|
26
|
-
transactions::{Operation, OperationCommand, OperationId, StateVersion
|
|
26
|
+
transactions::{ConsistencyContract, Operation, OperationCommand, OperationId, StateVersion},
|
|
27
27
|
};
|
|
28
28
|
use std::collections::HashMap;
|
|
29
29
|
use std::sync::{Arc, Mutex};
|
|
@@ -68,7 +68,13 @@ impl SeededRng {
|
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
fn generate_operation(
|
|
71
|
+
fn generate_operation(
|
|
72
|
+
rng: &mut SeededRng,
|
|
73
|
+
op_id: u64,
|
|
74
|
+
seq: u64,
|
|
75
|
+
node: &str,
|
|
76
|
+
client_id: usize,
|
|
77
|
+
) -> Operation {
|
|
72
78
|
let record_id = format!("rec_{}", rng.next_range(0, 99));
|
|
73
79
|
let _is_write = rng.next_f64() >= 0.7; // 70% reads, 30% writes
|
|
74
80
|
|
|
@@ -190,9 +196,10 @@ async fn measure_combination(
|
|
|
190
196
|
|
|
191
197
|
// Initialize distributed system
|
|
192
198
|
let initial_hash = StateHash::from_hex("hash0".to_string());
|
|
193
|
-
let leader_executor = Arc::new(Mutex::new(
|
|
194
|
-
|
|
195
|
-
|
|
199
|
+
let leader_executor = Arc::new(Mutex::new(DistributedTransactionExecutor::new(
|
|
200
|
+
"leader".to_string(),
|
|
201
|
+
initial_hash.clone(),
|
|
202
|
+
)));
|
|
196
203
|
|
|
197
204
|
// Create follower replicas
|
|
198
205
|
let mut follower_executors = Vec::new();
|
|
@@ -202,9 +209,10 @@ async fn measure_combination(
|
|
|
202
209
|
let replica_id = format!("replica_{}", i);
|
|
203
210
|
leader.register_replica(replica_id.clone(), initial_hash.clone());
|
|
204
211
|
|
|
205
|
-
let replica_executor = Arc::new(Mutex::new(
|
|
206
|
-
|
|
207
|
-
|
|
212
|
+
let replica_executor = Arc::new(Mutex::new(DistributedTransactionExecutor::new(
|
|
213
|
+
replica_id,
|
|
214
|
+
initial_hash.clone(),
|
|
215
|
+
)));
|
|
208
216
|
follower_executors.push(replica_executor);
|
|
209
217
|
}
|
|
210
218
|
}
|
|
@@ -223,7 +231,10 @@ async fn measure_combination(
|
|
|
223
231
|
for client_id in 0..writers {
|
|
224
232
|
let outcomes = Arc::clone(&outcomes);
|
|
225
233
|
let leader = Arc::clone(&leader_executor);
|
|
226
|
-
let followers = follower_executors
|
|
234
|
+
let followers = follower_executors
|
|
235
|
+
.iter()
|
|
236
|
+
.map(Arc::clone)
|
|
237
|
+
.collect::<Vec<_>>();
|
|
227
238
|
let global_seq = Arc::clone(&global_seq);
|
|
228
239
|
let admission_latencies = Arc::clone(&admission_latencies);
|
|
229
240
|
let e2e_latencies = Arc::clone(&e2e_latencies);
|
|
@@ -326,7 +337,9 @@ async fn measure_combination(
|
|
|
326
337
|
}
|
|
327
338
|
}
|
|
328
339
|
|
|
329
|
-
let all_same = operations_applied_per_replica
|
|
340
|
+
let all_same = operations_applied_per_replica
|
|
341
|
+
.iter()
|
|
342
|
+
.all(|&c| c == operations_accepted);
|
|
330
343
|
let converged = all_same && operations_applied_per_replica.len() == replica_count;
|
|
331
344
|
|
|
332
345
|
// Latency percentiles
|
|
@@ -401,7 +414,8 @@ async fn measure_combination(
|
|
|
401
414
|
_ => 1.0,
|
|
402
415
|
};
|
|
403
416
|
|
|
404
|
-
let expected_throughput =
|
|
417
|
+
let expected_throughput =
|
|
418
|
+
BASELINE_14C_SINGLE_WRITER_2_REPLICA * replica_factor * backlog_factor * writer_factor;
|
|
405
419
|
|
|
406
420
|
let interaction_ratio = if expected_throughput > 0.0 {
|
|
407
421
|
throughput_ops_sec / expected_throughput
|
|
@@ -421,7 +435,10 @@ async fn measure_combination(
|
|
|
421
435
|
"compositional".to_string()
|
|
422
436
|
};
|
|
423
437
|
|
|
424
|
-
let correctness_check = converged
|
|
438
|
+
let correctness_check = converged
|
|
439
|
+
&& operations_applied_per_replica
|
|
440
|
+
.iter()
|
|
441
|
+
.all(|&c| c == operations_accepted);
|
|
425
442
|
let correctness_status = if correctness_check { "PASS" } else { "FAIL" };
|
|
426
443
|
|
|
427
444
|
CombinationMetrics {
|
|
@@ -442,13 +459,15 @@ async fn measure_combination(
|
|
|
442
459
|
end_to_end_latency_p99_us: p99_e2e,
|
|
443
460
|
target_backlog_depth: backlog_depth,
|
|
444
461
|
actual_max_pending_depth: backlog_depth.min(operations_accepted),
|
|
445
|
-
backlog_drain_rate_ops_sec: if backlog_depth > 0 && submission_duration.as_secs_f64() > 0.0
|
|
462
|
+
backlog_drain_rate_ops_sec: if backlog_depth > 0 && submission_duration.as_secs_f64() > 0.0
|
|
463
|
+
{
|
|
446
464
|
backlog_depth as f64 / submission_duration.as_secs_f64()
|
|
447
465
|
} else {
|
|
448
466
|
0.0
|
|
449
467
|
},
|
|
450
468
|
operations_waiting_on_causal_barrier: backlog_depth.min(operations_accepted),
|
|
451
|
-
operations_ready_to_apply: (operations_accepted as isize - backlog_depth as isize).max(0)
|
|
469
|
+
operations_ready_to_apply: (operations_accepted as isize - backlog_depth as isize).max(0)
|
|
470
|
+
as usize,
|
|
452
471
|
median_wait_time_for_barrier_us: if backlog_depth > 0 { 100 } else { 0 },
|
|
453
472
|
p99_wait_time_for_barrier_us: if backlog_depth > 0 { 500 } else { 0 },
|
|
454
473
|
replication_messages_sent: operations_accepted * (replica_count - 1),
|
|
@@ -492,7 +511,10 @@ fn main() {
|
|
|
492
511
|
println!(" Writers: {:?}", WRITERS);
|
|
493
512
|
println!(" Causal backlog depths: {:?}", BACKLOG_DEPTHS);
|
|
494
513
|
println!(" Replica counts: {:?}", REPLICA_COUNTS);
|
|
495
|
-
println!(
|
|
514
|
+
println!(
|
|
515
|
+
" Total combinations: {}\n",
|
|
516
|
+
WRITERS.len() * BACKLOG_DEPTHS.len() * REPLICA_COUNTS.len()
|
|
517
|
+
);
|
|
496
518
|
|
|
497
519
|
let mut all_results = Vec::new();
|
|
498
520
|
let mut combination_count = 0;
|
|
@@ -501,52 +523,108 @@ fn main() {
|
|
|
501
523
|
for &backlog_depth in BACKLOG_DEPTHS {
|
|
502
524
|
for &replica_count in REPLICA_COUNTS {
|
|
503
525
|
combination_count += 1;
|
|
504
|
-
print!(
|
|
505
|
-
|
|
526
|
+
print!(
|
|
527
|
+
"\n[{}/75] Writers={} Backlog={} Replicas={}... ",
|
|
528
|
+
combination_count, writer_count, backlog_depth, replica_count
|
|
529
|
+
);
|
|
506
530
|
std::io::Write::flush(&mut std::io::stdout()).unwrap();
|
|
507
531
|
|
|
508
|
-
let result = rt.block_on(measure_combination(
|
|
532
|
+
let result = rt.block_on(measure_combination(
|
|
533
|
+
writer_count,
|
|
534
|
+
backlog_depth,
|
|
535
|
+
replica_count,
|
|
536
|
+
));
|
|
509
537
|
|
|
510
538
|
if result.correctness_status != "PASS" {
|
|
511
539
|
println!("❌ FAILED");
|
|
512
540
|
println!("\n⚠️ CORRECTNESS VIOLATION DETECTED");
|
|
513
541
|
println!(" Expected state_hash to match across all replicas");
|
|
514
|
-
println!(
|
|
515
|
-
|
|
542
|
+
println!(
|
|
543
|
+
" Configuration: writers={} backlog={} replicas={}",
|
|
544
|
+
writer_count, backlog_depth, replica_count
|
|
545
|
+
);
|
|
516
546
|
std::process::exit(1);
|
|
517
547
|
}
|
|
518
548
|
|
|
519
549
|
println!("✓");
|
|
520
550
|
|
|
521
551
|
// Detailed output
|
|
522
|
-
println!(
|
|
552
|
+
println!(
|
|
553
|
+
"\n{:-^60}",
|
|
554
|
+
format!(
|
|
555
|
+
"Writers={} Backlog={} Replicas={}",
|
|
556
|
+
writer_count, backlog_depth, replica_count
|
|
557
|
+
)
|
|
558
|
+
);
|
|
523
559
|
|
|
524
560
|
println!("\nADMISSION:");
|
|
525
561
|
println!(" operations_attempted: {}", result.operations_attempted);
|
|
526
|
-
println!(
|
|
527
|
-
|
|
528
|
-
|
|
562
|
+
println!(
|
|
563
|
+
" operations_accepted: {}",
|
|
564
|
+
result.operations_first_attempt_accepted
|
|
565
|
+
);
|
|
566
|
+
println!(
|
|
567
|
+
" operations_rejected: {}",
|
|
568
|
+
result.operations_permanent_reject
|
|
569
|
+
);
|
|
570
|
+
println!(
|
|
571
|
+
" acceptance_rate_percent: {:.1}%",
|
|
572
|
+
result.acceptance_rate_percent
|
|
573
|
+
);
|
|
529
574
|
|
|
530
575
|
println!("\nPERFORMANCE:");
|
|
531
576
|
println!(" throughput_ops_sec: {:.3}", result.throughput_ops_sec);
|
|
532
|
-
println!(
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
println!(
|
|
537
|
-
|
|
577
|
+
println!(
|
|
578
|
+
" admission_latency_p50_us: {}",
|
|
579
|
+
result.admission_latency_p50_us
|
|
580
|
+
);
|
|
581
|
+
println!(
|
|
582
|
+
" admission_latency_p95_us: {}",
|
|
583
|
+
result.admission_latency_p95_us
|
|
584
|
+
);
|
|
585
|
+
println!(
|
|
586
|
+
" admission_latency_p99_us: {}",
|
|
587
|
+
result.admission_latency_p99_us
|
|
588
|
+
);
|
|
589
|
+
println!(
|
|
590
|
+
" end_to_end_latency_p50_us: {}",
|
|
591
|
+
result.end_to_end_latency_p50_us
|
|
592
|
+
);
|
|
593
|
+
println!(
|
|
594
|
+
" end_to_end_latency_p95_us: {}",
|
|
595
|
+
result.end_to_end_latency_p95_us
|
|
596
|
+
);
|
|
597
|
+
println!(
|
|
598
|
+
" end_to_end_latency_p99_us: {}",
|
|
599
|
+
result.end_to_end_latency_p99_us
|
|
600
|
+
);
|
|
538
601
|
|
|
539
602
|
println!("\nCAUSAL BACKLOG:");
|
|
540
603
|
println!(" target_backlog: {}", result.target_backlog_depth);
|
|
541
604
|
println!(" actual_max_pending: {}", result.actual_max_pending_depth);
|
|
542
|
-
println!(
|
|
543
|
-
|
|
544
|
-
|
|
605
|
+
println!(
|
|
606
|
+
" drain_rate_ops_sec: {:.3}",
|
|
607
|
+
result.backlog_drain_rate_ops_sec
|
|
608
|
+
);
|
|
609
|
+
println!(
|
|
610
|
+
" operations_waiting_on_barrier: {}",
|
|
611
|
+
result.operations_waiting_on_causal_barrier
|
|
612
|
+
);
|
|
613
|
+
println!(
|
|
614
|
+
" operations_ready_to_apply: {}",
|
|
615
|
+
result.operations_ready_to_apply
|
|
616
|
+
);
|
|
545
617
|
|
|
546
618
|
println!("\nREPLICATION:");
|
|
547
619
|
println!(" messages_sent: {}", result.replication_messages_sent);
|
|
548
|
-
println!(
|
|
549
|
-
|
|
620
|
+
println!(
|
|
621
|
+
" messages_delivered: {}",
|
|
622
|
+
result.replication_messages_delivered
|
|
623
|
+
);
|
|
624
|
+
println!(
|
|
625
|
+
" delivery_rate_percent: {:.1}%",
|
|
626
|
+
result.replication_delivery_success_rate_percent
|
|
627
|
+
);
|
|
550
628
|
for (i, &applied) in result.per_replica_operations_applied.iter().enumerate() {
|
|
551
629
|
if i == 0 {
|
|
552
630
|
println!(" operations_applied_leader: {}", applied);
|
|
@@ -556,13 +634,33 @@ fn main() {
|
|
|
556
634
|
}
|
|
557
635
|
|
|
558
636
|
println!("\nCORRECTNESS:");
|
|
559
|
-
println!(
|
|
560
|
-
|
|
637
|
+
println!(
|
|
638
|
+
" replicas_converged: {}",
|
|
639
|
+
if result.all_replicas_converged {
|
|
640
|
+
"YES"
|
|
641
|
+
} else {
|
|
642
|
+
"NO"
|
|
643
|
+
}
|
|
644
|
+
);
|
|
645
|
+
println!(
|
|
646
|
+
" state_hashes_match: {}",
|
|
647
|
+
if result.state_hashes_match {
|
|
648
|
+
"YES"
|
|
649
|
+
} else {
|
|
650
|
+
"NO"
|
|
651
|
+
}
|
|
652
|
+
);
|
|
561
653
|
println!(" status: {}", result.correctness_status);
|
|
562
654
|
|
|
563
655
|
println!("\nINTERACTION:");
|
|
564
|
-
println!(
|
|
565
|
-
|
|
656
|
+
println!(
|
|
657
|
+
" observed_throughput: {:.3} ops/sec",
|
|
658
|
+
result.throughput_ops_sec
|
|
659
|
+
);
|
|
660
|
+
println!(
|
|
661
|
+
" expected_throughput: {:.3} ops/sec (composed)",
|
|
662
|
+
result.expected_throughput_ops_sec
|
|
663
|
+
);
|
|
566
664
|
println!(" interaction_ratio: {:.3}", result.interaction_ratio);
|
|
567
665
|
println!(" classification: {}", result.interaction_classification);
|
|
568
666
|
|
|
@@ -576,52 +674,85 @@ fn main() {
|
|
|
576
674
|
println!("INTERACTION ANALYSIS");
|
|
577
675
|
println!("═════════════════════════════════════════════════════════════");
|
|
578
676
|
|
|
579
|
-
let compositional: Vec<_> = all_results
|
|
677
|
+
let compositional: Vec<_> = all_results
|
|
678
|
+
.iter()
|
|
580
679
|
.filter(|r| r.interaction_classification == "compositional")
|
|
581
680
|
.collect();
|
|
582
|
-
let overhead: Vec<_> = all_results
|
|
681
|
+
let overhead: Vec<_> = all_results
|
|
682
|
+
.iter()
|
|
583
683
|
.filter(|r| r.interaction_classification == "overhead")
|
|
584
684
|
.collect();
|
|
585
|
-
let nonlinear: Vec<_> = all_results
|
|
685
|
+
let nonlinear: Vec<_> = all_results
|
|
686
|
+
.iter()
|
|
586
687
|
.filter(|r| r.interaction_classification == "nonlinear")
|
|
587
688
|
.collect();
|
|
588
|
-
let beneficial: Vec<_> = all_results
|
|
689
|
+
let beneficial: Vec<_> = all_results
|
|
690
|
+
.iter()
|
|
589
691
|
.filter(|r| r.interaction_classification == "beneficial")
|
|
590
692
|
.collect();
|
|
591
693
|
|
|
592
694
|
println!("\nComposition Summary:");
|
|
593
|
-
println!(
|
|
695
|
+
println!(
|
|
696
|
+
" Compositional (ratio ~1.0): {} combinations",
|
|
697
|
+
compositional.len()
|
|
698
|
+
);
|
|
594
699
|
if let Some(first) = compositional.first() {
|
|
595
|
-
println!(
|
|
700
|
+
println!(
|
|
701
|
+
" Example: writers={} backlog={} replicas={}",
|
|
702
|
+
first.writers, first.backlog_depth, first.replica_count
|
|
703
|
+
);
|
|
596
704
|
}
|
|
597
705
|
|
|
598
|
-
println!(
|
|
706
|
+
println!(
|
|
707
|
+
" Overhead (ratio 1.0-2.0): {} combinations",
|
|
708
|
+
overhead.len()
|
|
709
|
+
);
|
|
599
710
|
if let Some(first) = overhead.first() {
|
|
600
|
-
println!(
|
|
711
|
+
println!(
|
|
712
|
+
" Example: writers={} backlog={} replicas={}",
|
|
713
|
+
first.writers, first.backlog_depth, first.replica_count
|
|
714
|
+
);
|
|
601
715
|
}
|
|
602
716
|
|
|
603
717
|
println!(" Nonlinear (ratio >2.0): {} combinations", nonlinear.len());
|
|
604
718
|
if let Some(first) = nonlinear.first() {
|
|
605
|
-
println!(
|
|
719
|
+
println!(
|
|
720
|
+
" Example: writers={} backlog={} replicas={}",
|
|
721
|
+
first.writers, first.backlog_depth, first.replica_count
|
|
722
|
+
);
|
|
606
723
|
}
|
|
607
724
|
|
|
608
|
-
println!(
|
|
725
|
+
println!(
|
|
726
|
+
" Beneficial (ratio <1.0): {} combinations",
|
|
727
|
+
beneficial.len()
|
|
728
|
+
);
|
|
609
729
|
|
|
610
730
|
println!("\n\nOVERALL FINDING:");
|
|
611
731
|
if nonlinear.is_empty() {
|
|
612
732
|
println!("\n✅ Gate 14D finding: The three dimensions compose approximately independently");
|
|
613
|
-
println!(
|
|
733
|
+
println!(
|
|
734
|
+
" through the tested configuration space, with typical interaction ratio < 2.0."
|
|
735
|
+
);
|
|
614
736
|
println!(" No architectural bottlenecks identified.");
|
|
615
737
|
} else {
|
|
616
738
|
println!("\n⚠️ Gate 14D finding: A nonlinear interaction appears between dimensions");
|
|
617
739
|
println!(" at certain configurations:");
|
|
618
740
|
for (i, result) in nonlinear.iter().take(3).enumerate() {
|
|
619
|
-
println!(
|
|
620
|
-
|
|
741
|
+
println!(
|
|
742
|
+
" {}. writers={} backlog={} replicas={} (ratio: {:.2})",
|
|
743
|
+
i + 1,
|
|
744
|
+
result.writers,
|
|
745
|
+
result.backlog_depth,
|
|
746
|
+
result.replica_count,
|
|
747
|
+
result.interaction_ratio
|
|
748
|
+
);
|
|
621
749
|
}
|
|
622
750
|
}
|
|
623
751
|
|
|
624
752
|
println!("\n═════════════════════════════════════════════════════════════");
|
|
625
|
-
println!(
|
|
753
|
+
println!(
|
|
754
|
+
"Gate 14D measurement complete: {} combinations verified.",
|
|
755
|
+
all_results.len()
|
|
756
|
+
);
|
|
626
757
|
println!("═════════════════════════════════════════════════════════════\n");
|
|
627
758
|
}
|
package/dist/create/server-source/crates/feltdb/benches/phase_7_1_2_optimization_benchmark.rs
CHANGED
|
@@ -7,17 +7,16 @@
|
|
|
7
7
|
///
|
|
8
8
|
/// Key principle: Don't declare victory from a microbenchmark.
|
|
9
9
|
/// Systematically measure: latency, examination counts, memory, concurrency.
|
|
10
|
-
|
|
11
|
-
use criterion::{black_box, criterion_group, criterion_main, Criterion, BenchmarkId};
|
|
10
|
+
use criterion::{black_box, criterion_group, criterion_main, BenchmarkId, Criterion};
|
|
12
11
|
use feltdb::causal_dependency_barrier::CausalDependencyBarrier;
|
|
13
12
|
use feltdb::convergence::VectorClock;
|
|
14
13
|
|
|
15
14
|
/// Benchmark workload configuration
|
|
16
15
|
#[derive(Clone, Debug)]
|
|
17
16
|
struct BenchmarkWorkload {
|
|
18
|
-
pending_size: usize,
|
|
19
|
-
frontier_advances: usize,
|
|
20
|
-
release_selectivity: f64,
|
|
17
|
+
pending_size: usize, // 10, 100, 1K, 10K, 100K
|
|
18
|
+
frontier_advances: usize, // 1, 10
|
|
19
|
+
release_selectivity: f64, // Fraction of operations that will be released
|
|
21
20
|
}
|
|
22
21
|
|
|
23
22
|
/// Metrics collected during a benchmark run
|
|
@@ -46,8 +45,7 @@ impl ReleaseMetrics {
|
|
|
46
45
|
if self.ref_pending_examined == 0 {
|
|
47
46
|
0.0
|
|
48
47
|
} else {
|
|
49
|
-
(1.0 - (self.opt_candidates_examined as f64 / self.ref_pending_examined as f64))
|
|
50
|
-
* 100.0
|
|
48
|
+
(1.0 - (self.opt_candidates_examined as f64 / self.ref_pending_examined as f64)) * 100.0
|
|
51
49
|
}
|
|
52
50
|
}
|
|
53
51
|
|
|
@@ -62,7 +60,10 @@ impl ReleaseMetrics {
|
|
|
62
60
|
}
|
|
63
61
|
|
|
64
62
|
/// Generate a benchmark workload with reproducible randomness
|
|
65
|
-
fn generate_workload(
|
|
63
|
+
fn generate_workload(
|
|
64
|
+
workload: &BenchmarkWorkload,
|
|
65
|
+
seed: u64,
|
|
66
|
+
) -> (Vec<(String, VectorClock)>, Vec<VectorClock>) {
|
|
66
67
|
use std::collections::hash_map::DefaultHasher;
|
|
67
68
|
use std::hash::{Hash, Hasher};
|
|
68
69
|
|
|
@@ -71,7 +72,9 @@ fn generate_workload(workload: &BenchmarkWorkload, seed: u64) -> (Vec<(String, V
|
|
|
71
72
|
let mut rng_seed = hasher.finish();
|
|
72
73
|
|
|
73
74
|
fn next_rng(seed: &mut u64) -> u64 {
|
|
74
|
-
*seed = seed
|
|
75
|
+
*seed = seed
|
|
76
|
+
.wrapping_mul(6364136223846793005)
|
|
77
|
+
.wrapping_add(1442695040888963407);
|
|
75
78
|
*seed
|
|
76
79
|
}
|
|
77
80
|
|
|
@@ -82,7 +85,8 @@ fn generate_workload(workload: &BenchmarkWorkload, seed: u64) -> (Vec<(String, V
|
|
|
82
85
|
for i in 0..workload.pending_size {
|
|
83
86
|
let mut required = VectorClock::new();
|
|
84
87
|
// Create dependency that will be satisfied based on selectivity
|
|
85
|
-
let release_threshold =
|
|
88
|
+
let release_threshold =
|
|
89
|
+
(workload.pending_size as f64 * workload.release_selectivity) as usize;
|
|
86
90
|
let ts = if i < release_threshold {
|
|
87
91
|
10 // Will be released when frontier advances to 10
|
|
88
92
|
} else {
|
|
@@ -188,8 +192,10 @@ fn benchmark_optimization_matrix(c: &mut Criterion) {
|
|
|
188
192
|
let selectivities = vec![0.10]; // Start with 10% release
|
|
189
193
|
|
|
190
194
|
println!("\n=== Phase 7.1.2: Optimization Matrix Metrics ===");
|
|
191
|
-
println!(
|
|
192
|
-
"
|
|
195
|
+
println!(
|
|
196
|
+
"{:<8} {:<10} {:<10} {:<15} {:<15} {:<12} {:<12}",
|
|
197
|
+
"Pending", "Advances", "Selectivity", "Ref (µs)", "Opt (µs)", "Speedup", "Candidate %"
|
|
198
|
+
);
|
|
193
199
|
|
|
194
200
|
for pending in &pending_sizes {
|
|
195
201
|
for advances in &advance_counts {
|
|
@@ -209,11 +215,23 @@ fn benchmark_optimization_matrix(c: &mut Criterion) {
|
|
|
209
215
|
let speedup = ref_metrics.ref_latency_ns as f64 / opt_metrics.opt_latency_ns as f64;
|
|
210
216
|
let candidate_reduction = opt_metrics.candidate_reduction_pct();
|
|
211
217
|
|
|
212
|
-
println!(
|
|
213
|
-
|
|
218
|
+
println!(
|
|
219
|
+
"{:<8} {:<10} {:<10.0}% {:<15.1} {:<15.1} {:<12.2}x {:<12.1}%",
|
|
220
|
+
pending,
|
|
221
|
+
advances,
|
|
222
|
+
selectivity * 100.0,
|
|
223
|
+
ref_us,
|
|
224
|
+
opt_us,
|
|
225
|
+
speedup,
|
|
226
|
+
candidate_reduction
|
|
227
|
+
);
|
|
214
228
|
|
|
215
|
-
let bench_name = format!(
|
|
216
|
-
|
|
229
|
+
let bench_name = format!(
|
|
230
|
+
"pending_{}_advances_{}_sel_{:.0}pct",
|
|
231
|
+
pending,
|
|
232
|
+
advances,
|
|
233
|
+
selectivity * 100.0
|
|
234
|
+
);
|
|
217
235
|
|
|
218
236
|
group.bench_with_input(
|
|
219
237
|
BenchmarkId::new("reference", &bench_name),
|
|
@@ -221,7 +239,11 @@ fn benchmark_optimization_matrix(c: &mut Criterion) {
|
|
|
221
239
|
|b, w| {
|
|
222
240
|
let (ops, advs) = generate_workload(w, 42);
|
|
223
241
|
b.iter(|| {
|
|
224
|
-
benchmark_reference_release(
|
|
242
|
+
benchmark_reference_release(
|
|
243
|
+
black_box(w),
|
|
244
|
+
black_box(&ops),
|
|
245
|
+
black_box(&advs),
|
|
246
|
+
)
|
|
225
247
|
});
|
|
226
248
|
},
|
|
227
249
|
);
|
|
@@ -232,7 +254,11 @@ fn benchmark_optimization_matrix(c: &mut Criterion) {
|
|
|
232
254
|
|b, w| {
|
|
233
255
|
let (ops, advs) = generate_workload(w, 42);
|
|
234
256
|
b.iter(|| {
|
|
235
|
-
benchmark_optimized_release(
|
|
257
|
+
benchmark_optimized_release(
|
|
258
|
+
black_box(w),
|
|
259
|
+
black_box(&ops),
|
|
260
|
+
black_box(&advs),
|
|
261
|
+
)
|
|
236
262
|
});
|
|
237
263
|
},
|
|
238
264
|
);
|
|
@@ -253,8 +279,10 @@ fn benchmark_selectivity_variation(c: &mut Criterion) {
|
|
|
253
279
|
let selectivities = vec![0.0, 0.01, 0.10, 0.25, 0.50, 0.75, 1.0];
|
|
254
280
|
|
|
255
281
|
println!("\n=== Phase 7.1.2: Selectivity Variation Metrics ===");
|
|
256
|
-
println!(
|
|
257
|
-
"
|
|
282
|
+
println!(
|
|
283
|
+
"{:<12} {:<15} {:<15} {:<12} {:<12}",
|
|
284
|
+
"Selectivity", "Ref (µs)", "Opt (µs)", "Speedup", "Candidate %"
|
|
285
|
+
);
|
|
258
286
|
|
|
259
287
|
for selectivity in selectivities {
|
|
260
288
|
let workload = BenchmarkWorkload {
|
|
@@ -276,8 +304,14 @@ fn benchmark_selectivity_variation(c: &mut Criterion) {
|
|
|
276
304
|
};
|
|
277
305
|
let candidate_reduction = opt_metrics.candidate_reduction_pct();
|
|
278
306
|
|
|
279
|
-
println!(
|
|
280
|
-
|
|
307
|
+
println!(
|
|
308
|
+
"{:<12.0}% {:<15.1} {:<15.1} {:<12.2}x {:<12.1}%",
|
|
309
|
+
selectivity * 100.0,
|
|
310
|
+
ref_us,
|
|
311
|
+
opt_us,
|
|
312
|
+
speedup,
|
|
313
|
+
candidate_reduction
|
|
314
|
+
);
|
|
281
315
|
|
|
282
316
|
let bench_name = format!("pending_1000_sel_{:.0}pct", selectivity * 100.0);
|
|
283
317
|
|
|
@@ -319,8 +353,10 @@ fn benchmark_pathological_scaling(c: &mut Criterion) {
|
|
|
319
353
|
let selectivity = 0.10; // 10% of pending operations become ready each advance
|
|
320
354
|
|
|
321
355
|
println!("\n=== Phase 7.1.2: Pathological Scaling (10 advances) ===");
|
|
322
|
-
println!(
|
|
323
|
-
"
|
|
356
|
+
println!(
|
|
357
|
+
"{:<10} {:<15} {:<15} {:<12} {:<12}",
|
|
358
|
+
"Pending", "Ref (µs)", "Opt (µs)", "Speedup", "Candidate %"
|
|
359
|
+
);
|
|
324
360
|
|
|
325
361
|
for pending in &pending_sizes {
|
|
326
362
|
let workload = BenchmarkWorkload {
|
|
@@ -342,8 +378,10 @@ fn benchmark_pathological_scaling(c: &mut Criterion) {
|
|
|
342
378
|
};
|
|
343
379
|
let candidate_reduction = opt_metrics.candidate_reduction_pct();
|
|
344
380
|
|
|
345
|
-
println!(
|
|
346
|
-
|
|
381
|
+
println!(
|
|
382
|
+
"{:<10} {:<15.1} {:<15.1} {:<12.2}x {:<12.1}%",
|
|
383
|
+
pending, ref_us, opt_us, speedup, candidate_reduction
|
|
384
|
+
);
|
|
347
385
|
|
|
348
386
|
let bench_name = format!("pending_{}_advances_{}", pending, advance_count);
|
|
349
387
|
|