@feltdb/core 0.15.0 → 0.16.1
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/agent-state.d.ts +20 -0
- package/dist/agent-state.d.ts.map +1 -1
- package/dist/agent-state.js +36 -0
- package/dist/build-identity.json +12 -4
- package/dist/cli/commands.js +187 -4
- package/dist/cli/publish-engine.js +116 -16
- package/dist/collection.d.ts.map +1 -1
- package/dist/collection.js +20 -2
- package/dist/create/build-identity.json +12 -4
- package/dist/create/managed-account.js +93 -35
- package/dist/create/package-versions.js +1 -1
- package/dist/create/server-source/Cargo.lock +6 -509
- package/dist/create/server-source/Cargo.toml +2 -13
- package/dist/create/server-source/crates/feltdb-client/Cargo.toml +1 -1
- package/dist/create/server-source/crates/feltdb-server/Cargo.toml +1 -1
- package/dist/create/server-source/crates/feltdb-server/src/main.rs +356 -24
- package/dist/create/server-source/crates/feltdb-server/tests/rust_client.rs +10 -1
- package/dist/create/server-source/crates/feltdb-wasm/Cargo.toml +1 -1
- package/dist/db.d.ts +11 -1
- package/dist/db.d.ts.map +1 -1
- package/dist/db.js +15 -2
- package/dist/error-codes.d.ts +5 -0
- package/dist/error-codes.d.ts.map +1 -1
- package/dist/error-codes.js +9 -1
- package/dist/http-db.d.ts +16 -0
- package/dist/http-db.d.ts.map +1 -1
- package/dist/http-db.js +36 -6
- package/dist/managed-recovery.d.ts +6 -0
- package/dist/managed-recovery.d.ts.map +1 -1
- package/dist/managed-recovery.js +9 -0
- package/dist/studio-app/assets/{feltdb_wasm-BjM1ylL3.js → feltdb_wasm-BUIxCuTR.js} +1 -1
- package/dist/studio-app/assets/feltdb_wasm_bg-C3D6y6DK.wasm +0 -0
- package/dist/studio-app/assets/index-BhXYAhgS.js +37 -0
- package/dist/studio-app/index.html +1 -1
- package/dist/wasm/feltdb_wasm_bg.wasm +0 -0
- package/dist/wasm/package.json +1 -1
- package/dist/workload.d.ts +55 -3
- package/dist/workload.d.ts.map +1 -1
- package/dist/workload.js +23 -0
- package/dist/workspace/workspace-connection.d.ts.map +1 -1
- package/dist/workspace/workspace-connection.js +14 -3
- package/package.json +1 -1
- package/dist/create/server-source/crates/feltdb/Cargo.lock +0 -175
- package/dist/create/server-source/crates/feltdb/Cargo.toml +0 -102
- package/dist/create/server-source/crates/feltdb/LICENSE +0 -21
- package/dist/create/server-source/crates/feltdb/README.md +0 -75
- package/dist/create/server-source/crates/feltdb/benches/baselines/gate-13-redux.json +0 -370
- package/dist/create/server-source/crates/feltdb/benches/gate13_baseline.rs +0 -589
- package/dist/create/server-source/crates/feltdb/benches/gate13_phase_7_1_release_economics.rs +0 -247
- package/dist/create/server-source/crates/feltdb/benches/gate_13_redux.rs +0 -440
- package/dist/create/server-source/crates/feltdb/benches/gate_13_regression_runner.rs +0 -275
- package/dist/create/server-source/crates/feltdb/benches/gate_14a_concurrent_writer_scaling.rs +0 -381
- package/dist/create/server-source/crates/feltdb/benches/gate_14a_production_admission_revalidation.rs +0 -467
- package/dist/create/server-source/crates/feltdb/benches/gate_14a_rc2_admission_contract.rs +0 -489
- package/dist/create/server-source/crates/feltdb/benches/gate_14a_rc_root_cause.rs +0 -281
- package/dist/create/server-source/crates/feltdb/benches/gate_14a_sync1_queued_prototype.rs +0 -606
- package/dist/create/server-source/crates/feltdb/benches/gate_14a_sync_economics.rs +0 -531
- package/dist/create/server-source/crates/feltdb/benches/gate_14b_causal_backlog_scaling.rs +0 -462
- package/dist/create/server-source/crates/feltdb/benches/gate_14c_replication_contract_test.rs +0 -505
- package/dist/create/server-source/crates/feltdb/benches/gate_14c_replication_scaling.rs +0 -484
- package/dist/create/server-source/crates/feltdb/benches/gate_14d_combined_dimension_scaling.rs +0 -758
- package/dist/create/server-source/crates/feltdb/benches/phase_7_1_2_optimization_benchmark.rs +0 -421
- package/dist/create/server-source/crates/feltdb/benches/phase_7_1_3_crossover_analysis.rs +0 -329
- package/dist/create/server-source/crates/feltdb/src/acceptance_tests.rs +0 -1705
- package/dist/create/server-source/crates/feltdb/src/acquisition.rs +0 -286
- package/dist/create/server-source/crates/feltdb/src/admission.rs +0 -185
- package/dist/create/server-source/crates/feltdb/src/admission_contract_tests.rs +0 -507
- package/dist/create/server-source/crates/feltdb/src/adversarial_transport.rs +0 -539
- package/dist/create/server-source/crates/feltdb/src/agent_state.rs +0 -320
- package/dist/create/server-source/crates/feltdb/src/agent_transition_contract.rs +0 -1545
- package/dist/create/server-source/crates/feltdb/src/analytics.rs +0 -521
- package/dist/create/server-source/crates/feltdb/src/application.rs +0 -2674
- package/dist/create/server-source/crates/feltdb/src/application_runtime.rs +0 -1070
- package/dist/create/server-source/crates/feltdb/src/authority.rs +0 -479
- package/dist/create/server-source/crates/feltdb/src/authority_failover.rs +0 -847
- package/dist/create/server-source/crates/feltdb/src/authorization.rs +0 -1030
- package/dist/create/server-source/crates/feltdb/src/authorization_security_tests.rs +0 -1122
- package/dist/create/server-source/crates/feltdb/src/bin/feltdb-authority-client.rs +0 -32
- package/dist/create/server-source/crates/feltdb/src/bin/feltdb-authority.rs +0 -19
- package/dist/create/server-source/crates/feltdb/src/bin/feltdb_node.rs +0 -1474
- package/dist/create/server-source/crates/feltdb/src/capabilities/mod.rs +0 -8
- package/dist/create/server-source/crates/feltdb/src/capabilities/search.rs +0 -418
- package/dist/create/server-source/crates/feltdb/src/capabilities/vector.rs +0 -482
- package/dist/create/server-source/crates/feltdb/src/capability.rs +0 -903
- package/dist/create/server-source/crates/feltdb/src/cardinality_diagnostics.rs +0 -263
- package/dist/create/server-source/crates/feltdb/src/cardinality_endpoint.rs +0 -77
- package/dist/create/server-source/crates/feltdb/src/causal_backlog_bound.rs +0 -496
- package/dist/create/server-source/crates/feltdb/src/causal_dependency_barrier.rs +0 -2574
- package/dist/create/server-source/crates/feltdb/src/causal_dependency_barrier_phase_7_1.rs +0 -212
- package/dist/create/server-source/crates/feltdb/src/concurrency_fuzzing.rs +0 -422
- package/dist/create/server-source/crates/feltdb/src/consistency_contract.rs +0 -445
- package/dist/create/server-source/crates/feltdb/src/content_distribution.rs +0 -465
- package/dist/create/server-source/crates/feltdb/src/convergence.rs +0 -634
- package/dist/create/server-source/crates/feltdb/src/crash_atomic_boundary.rs +0 -427
- package/dist/create/server-source/crates/feltdb/src/crash_injection.rs +0 -376
- package/dist/create/server-source/crates/feltdb/src/crash_recovery_tests.rs +0 -365
- package/dist/create/server-source/crates/feltdb/src/cron.rs +0 -294
- package/dist/create/server-source/crates/feltdb/src/dedup_bound_investigation.rs +0 -483
- package/dist/create/server-source/crates/feltdb/src/distributed_indexing.rs +0 -477
- package/dist/create/server-source/crates/feltdb/src/distributed_tests.rs +0 -1003
- package/dist/create/server-source/crates/feltdb/src/distributed_transactions.rs +0 -1334
- package/dist/create/server-source/crates/feltdb/src/durability_guarantees.rs +0 -368
- package/dist/create/server-source/crates/feltdb/src/durable_dedup_set.rs +0 -231
- package/dist/create/server-source/crates/feltdb/src/durable_operation_identity.rs +0 -482
- package/dist/create/server-source/crates/feltdb/src/durable_operation_log.rs +0 -203
- package/dist/create/server-source/crates/feltdb/src/durable_sync.rs +0 -317
- package/dist/create/server-source/crates/feltdb/src/equality_index.rs +0 -595
- package/dist/create/server-source/crates/feltdb/src/execution.rs +0 -426
- package/dist/create/server-source/crates/feltdb/src/in_process_transport.rs +0 -214
- package/dist/create/server-source/crates/feltdb/src/indexing.rs +0 -776
- package/dist/create/server-source/crates/feltdb/src/lib.rs +0 -7365
- package/dist/create/server-source/crates/feltdb/src/managed_cas_tests.rs +0 -234
- package/dist/create/server-source/crates/feltdb/src/materialization.rs +0 -184
- package/dist/create/server-source/crates/feltdb/src/metrics.rs +0 -266
- package/dist/create/server-source/crates/feltdb/src/multi_node_convergence.rs +0 -310
- package/dist/create/server-source/crates/feltdb/src/multi_operation_transaction.rs +0 -736
- package/dist/create/server-source/crates/feltdb/src/observability.rs +0 -379
- package/dist/create/server-source/crates/feltdb/src/operation.rs +0 -290
- package/dist/create/server-source/crates/feltdb/src/operation_algebra.rs +0 -439
- package/dist/create/server-source/crates/feltdb/src/operation_log.rs +0 -349
- package/dist/create/server-source/crates/feltdb/src/p1_application_atomicity.rs +0 -332
- package/dist/create/server-source/crates/feltdb/src/p1_atomicity_acceptance.rs +0 -718
- package/dist/create/server-source/crates/feltdb/src/partition_reconciliation.rs +0 -487
- package/dist/create/server-source/crates/feltdb/src/peer_registry.rs +0 -166
- package/dist/create/server-source/crates/feltdb/src/permutation_scheduler.rs +0 -289
- package/dist/create/server-source/crates/feltdb/src/persistence_reality.rs +0 -566
- package/dist/create/server-source/crates/feltdb/src/phase1b_acceptance.rs +0 -3391
- package/dist/create/server-source/crates/feltdb/src/phase1c1_acceptance.rs +0 -203
- package/dist/create/server-source/crates/feltdb/src/phase1c2_acceptance.rs +0 -261
- package/dist/create/server-source/crates/feltdb/src/phase1c3_acceptance.rs +0 -502
- package/dist/create/server-source/crates/feltdb/src/phase1c_atomicity_proof.rs +0 -216
- package/dist/create/server-source/crates/feltdb/src/phase5_integration.rs +0 -303
- package/dist/create/server-source/crates/feltdb/src/phase5_scenarios.rs +0 -323
- package/dist/create/server-source/crates/feltdb/src/phase6_adversarial_scenarios.rs +0 -531
- package/dist/create/server-source/crates/feltdb/src/phase6_convergence_validator.rs +0 -406
- package/dist/create/server-source/crates/feltdb/src/phase6_persistence.rs +0 -436
- package/dist/create/server-source/crates/feltdb/src/phase_1c_real_tcp.rs +0 -387
- package/dist/create/server-source/crates/feltdb/src/phase_2a_failures.rs +0 -378
- package/dist/create/server-source/crates/feltdb/src/phase_2b_network.rs +0 -359
- package/dist/create/server-source/crates/feltdb/src/phase_2c_cascading.rs +0 -372
- package/dist/create/server-source/crates/feltdb/src/phase_3_durability.rs +0 -404
- package/dist/create/server-source/crates/feltdb/src/phase_4_baseline.rs +0 -376
- package/dist/create/server-source/crates/feltdb/src/phase_5_soak.rs +0 -461
- package/dist/create/server-source/crates/feltdb/src/policy_evaluation.rs +0 -2125
- package/dist/create/server-source/crates/feltdb/src/production_api.rs +0 -418
- package/dist/create/server-source/crates/feltdb/src/provenance.rs +0 -207
- package/dist/create/server-source/crates/feltdb/src/query_execution_diagnostics.rs +0 -126
- package/dist/create/server-source/crates/feltdb/src/query_performance.rs +0 -218
- package/dist/create/server-source/crates/feltdb/src/read_basis.rs +0 -257
- package/dist/create/server-source/crates/feltdb/src/references.rs +0 -404
- package/dist/create/server-source/crates/feltdb/src/replay_fuzzing.rs +0 -401
- package/dist/create/server-source/crates/feltdb/src/replica_acknowledgements.rs +0 -501
- package/dist/create/server-source/crates/feltdb/src/replica_membership.rs +0 -680
- package/dist/create/server-source/crates/feltdb/src/replication_manager.rs +0 -163
- package/dist/create/server-source/crates/feltdb/src/replication_protocol.rs +0 -133
- package/dist/create/server-source/crates/feltdb/src/routing.rs +0 -409
- package/dist/create/server-source/crates/feltdb/src/semantic_decision.rs +0 -2029
- package/dist/create/server-source/crates/feltdb/src/semantic_query.rs +0 -599
- package/dist/create/server-source/crates/feltdb/src/sharding.rs +0 -549
- package/dist/create/server-source/crates/feltdb/src/state_conflict_contract.rs +0 -516
- package/dist/create/server-source/crates/feltdb/src/state_contract.rs +0 -6003
- package/dist/create/server-source/crates/feltdb/src/state_diff_contract.rs +0 -222
- package/dist/create/server-source/crates/feltdb/src/state_facade.rs +0 -320
- package/dist/create/server-source/crates/feltdb/src/state_hash.rs +0 -291
- package/dist/create/server-source/crates/feltdb/src/state_model.rs +0 -4158
- package/dist/create/server-source/crates/feltdb/src/state_transition_store.rs +0 -379
- package/dist/create/server-source/crates/feltdb/src/state_trigger.rs +0 -673
- package/dist/create/server-source/crates/feltdb/src/storage.rs +0 -273
- package/dist/create/server-source/crates/feltdb/src/submission.rs +0 -471
- package/dist/create/server-source/crates/feltdb/src/sync.rs +0 -495
- package/dist/create/server-source/crates/feltdb/src/sync_contract.rs +0 -822
- package/dist/create/server-source/crates/feltdb/src/tcp_transport.rs +0 -433
- package/dist/create/server-source/crates/feltdb/src/transaction_api.rs +0 -462
- package/dist/create/server-source/crates/feltdb/src/transaction_invariants.rs +0 -965
- package/dist/create/server-source/crates/feltdb/src/transaction_preconditions.rs +0 -1120
- package/dist/create/server-source/crates/feltdb/src/transactions.rs +0 -643
- package/dist/create/server-source/crates/feltdb/src/trigger.rs +0 -390
- package/dist/create/server-source/crates/feltdb/src/trigger_contract.rs +0 -749
- package/dist/create/server-source/crates/feltdb/src/versioned_object_substrate.rs +0 -708
- package/dist/create/server-source/crates/feltdb/src/worker_mesh.rs +0 -1269
- package/dist/create/server-source/crates/feltdb/src/workflow.rs +0 -713
- package/dist/create/server-source/crates/feltdb/src/workflow_acceptance_tests.rs +0 -510
- package/dist/create/server-source/crates/feltdb/src/workflow_integration.rs +0 -354
- package/dist/create/server-source/crates/feltdb/src/workflow_runtime.rs +0 -594
- package/dist/create/server-source/crates/feltdb/src/workload.rs +0 -4222
- package/dist/create/server-source/crates/feltdb/src/workload_diagnostics.rs +0 -456
- package/dist/create/server-source/crates/feltdb/tests/agent_state_native.rs +0 -1188
- package/dist/create/server-source/crates/feltdb/tests/agent_transition_contract_conformance.rs +0 -2884
- package/dist/create/server-source/crates/feltdb/tests/authority_process.rs +0 -297
- package/dist/create/server-source/crates/feltdb/tests/authority_transaction_identity.rs +0 -534
- package/dist/create/server-source/crates/feltdb/tests/bounded_read_contract.rs +0 -132
- package/dist/create/server-source/crates/feltdb/tests/branching_evidence.rs +0 -299
- package/dist/create/server-source/crates/feltdb/tests/common/mod.rs +0 -96
- package/dist/create/server-source/crates/feltdb/tests/compaction_stall_contract.rs +0 -272
- package/dist/create/server-source/crates/feltdb/tests/crash_durability_contract.rs +0 -467
- package/dist/create/server-source/crates/feltdb/tests/current_revision_authority_evidence.rs +0 -309
- package/dist/create/server-source/crates/feltdb/tests/durable_backup_contract.rs +0 -445
- package/dist/create/server-source/crates/feltdb/tests/durable_corruption_contract.rs +0 -518
- package/dist/create/server-source/crates/feltdb/tests/durable_format_compatibility.rs +0 -392
- package/dist/create/server-source/crates/feltdb/tests/feltdb_state_boundary_tests.rs +0 -850
- package/dist/create/server-source/crates/feltdb/tests/fixtures/agent_transition_corpus.json +0 -23340
- package/dist/create/server-source/crates/feltdb/tests/fixtures/state_conflict_contract_corpus.json +0 -1916
- package/dist/create/server-source/crates/feltdb/tests/fixtures/state_diff_contract_corpus.json +0 -1878
- package/dist/create/server-source/crates/feltdb/tests/fixtures/trigger_contract_corpus.json +0 -1862
- package/dist/create/server-source/crates/feltdb/tests/generalized_version_control_evidence.rs +0 -123
- package/dist/create/server-source/crates/feltdb/tests/generalized_version_control_substrate_completion.rs +0 -299
- package/dist/create/server-source/crates/feltdb/tests/local_process_ownership.rs +0 -69
- package/dist/create/server-source/crates/feltdb/tests/managed_incident_regression.rs +0 -191
- package/dist/create/server-source/crates/feltdb/tests/operational_health_contract.rs +0 -278
- package/dist/create/server-source/crates/feltdb/tests/pr34_query_collection.rs +0 -234
- package/dist/create/server-source/crates/feltdb/tests/pr35_equality_index.rs +0 -947
- package/dist/create/server-source/crates/feltdb/tests/pr7_self_authorization_proof.rs +0 -404
- package/dist/create/server-source/crates/feltdb/tests/pr8_vocabulary_assessment.rs +0 -916
- package/dist/create/server-source/crates/feltdb/tests/pr9_phase2_boundary_tests.rs +0 -1045
- package/dist/create/server-source/crates/feltdb/tests/pr9_phase3a_path_a_tests.rs +0 -347
- package/dist/create/server-source/crates/feltdb/tests/pr9_phase3c_authorized_mutations.rs +0 -361
- package/dist/create/server-source/crates/feltdb/tests/pr9_phase3c_role_based_authorization.rs +0 -330
- package/dist/create/server-source/crates/feltdb/tests/pr9_phase3c_simple_auth_delete.rs +0 -93
- package/dist/create/server-source/crates/feltdb/tests/pr9_phase3c_team_delete_role_authorization.rs +0 -622
- package/dist/create/server-source/crates/feltdb/tests/pr9_teams_role_based_access.rs +0 -517
- package/dist/create/server-source/crates/feltdb/tests/production_certification.rs +0 -1153
- package/dist/create/server-source/crates/feltdb/tests/production_contract.rs +0 -771
- package/dist/create/server-source/crates/feltdb/tests/production_readiness_contract.rs +0 -1383
- package/dist/create/server-source/crates/feltdb/tests/reconciliation_application.rs +0 -868
- package/dist/create/server-source/crates/feltdb/tests/reconciliation_wire_format_evidence.rs +0 -221
- package/dist/create/server-source/crates/feltdb/tests/replicated_history_contract.rs +0 -417
- package/dist/create/server-source/crates/feltdb/tests/resource_scoped_revisions.rs +0 -338
- package/dist/create/server-source/crates/feltdb/tests/revision_identity_contract.rs +0 -1039
- package/dist/create/server-source/crates/feltdb/tests/revision_model_decision.rs +0 -739
- package/dist/create/server-source/crates/feltdb/tests/revision_retention_boundary_evidence.rs +0 -452
- package/dist/create/server-source/crates/feltdb/tests/saas_authorization_integration.rs +0 -81
- package/dist/create/server-source/crates/feltdb/tests/saas_invitation_lifecycle.rs +0 -438
- package/dist/create/server-source/crates/feltdb/tests/semantic_decision.rs +0 -1165
- package/dist/create/server-source/crates/feltdb/tests/semantic_query.rs +0 -767
- package/dist/create/server-source/crates/feltdb/tests/semantic_query_contract.rs +0 -363
- package/dist/create/server-source/crates/feltdb/tests/state_conflict_contract_conformance.rs +0 -1799
- package/dist/create/server-source/crates/feltdb/tests/state_diff_contract_conformance.rs +0 -1316
- package/dist/create/server-source/crates/feltdb/tests/state_model_integration.rs +0 -358
- package/dist/create/server-source/crates/feltdb/tests/state_persistence_integration.rs +0 -365
- package/dist/create/server-source/crates/feltdb/tests/state_ref_authority.rs +0 -918
- package/dist/create/server-source/crates/feltdb/tests/state_store_boundary_evidence.rs +0 -299
- package/dist/create/server-source/crates/feltdb/tests/storage_independent_versioned_object_substrate.rs +0 -328
- package/dist/create/server-source/crates/feltdb/tests/sync_divergence_evidence.rs +0 -255
- package/dist/create/server-source/crates/feltdb/tests/three_way_input_boundary_evidence.rs +0 -249
- package/dist/create/server-source/crates/feltdb/tests/trigger_contract_conformance.rs +0 -994
- package/dist/create/server-source/crates/feltdb/tests/workload_envelope_contract.rs +0 -484
- package/dist/studio-app/assets/feltdb_wasm_bg-TseJn2Ax.wasm +0 -0
- package/dist/studio-app/assets/index-1wd0uKua.js +0 -30
package/dist/create/server-source/crates/feltdb/benches/gate_14d_combined_dimension_scaling.rs
DELETED
|
@@ -1,758 +0,0 @@
|
|
|
1
|
-
/// Gate 14D: Combined Dimension Scaling — Measurement
|
|
2
|
-
///
|
|
3
|
-
/// Objective: Measure whether admission contention, causal backlog, and replication costs
|
|
4
|
-
/// compose independently or whether combined scaling reveals nonlinear interactions or new
|
|
5
|
-
/// bottlenecks.
|
|
6
|
-
///
|
|
7
|
-
/// TEST MATRIX (Locked from 14A/14B/14C):
|
|
8
|
-
/// - Writers: 1, 4, 8
|
|
9
|
-
/// - Causal backlog depth: 0, 100, 1K, 10K, 100K
|
|
10
|
-
/// - Replicas: 2, 5, 10, 25, 50
|
|
11
|
-
/// - Total combinations: 3 × 5 × 5 = 75
|
|
12
|
-
///
|
|
13
|
-
/// For each combination, measure:
|
|
14
|
-
/// - Admission control: attempted, accepted, rejected, acceptance rate
|
|
15
|
-
/// - Performance: throughput (ops/sec), latency (p50/p95/p99)
|
|
16
|
-
/// - Causal backlog: target, actual max pending, drain rate
|
|
17
|
-
/// - Replication: messages sent, delivered, delivery rate
|
|
18
|
-
/// - Convergence: all replicas converged, state_hash match
|
|
19
|
-
/// - Interaction ratio: observed throughput / expected composed throughput
|
|
20
|
-
use feltdb::{
|
|
21
|
-
convergence::VectorClock,
|
|
22
|
-
distributed_transactions::{
|
|
23
|
-
DistributedTransactionExecutor, ReplicationMessage, TransactionEnvelope,
|
|
24
|
-
},
|
|
25
|
-
state_hash::StateHash,
|
|
26
|
-
transactions::{ConsistencyContract, Operation, OperationCommand, OperationId, StateVersion},
|
|
27
|
-
};
|
|
28
|
-
use std::collections::HashMap;
|
|
29
|
-
use std::sync::{Arc, Mutex};
|
|
30
|
-
use std::time::Instant;
|
|
31
|
-
|
|
32
|
-
const OPERATIONS_PER_CLIENT: usize = 1000;
|
|
33
|
-
const RANDOM_SEED: u64 = 42;
|
|
34
|
-
const WRITERS: &[usize] = &[1, 4, 8];
|
|
35
|
-
const BACKLOG_DEPTHS: &[usize] = &[0, 100, 1_000, 10_000, 100_000];
|
|
36
|
-
const REPLICA_COUNTS: &[usize] = &[2, 5, 10, 25, 50];
|
|
37
|
-
|
|
38
|
-
// Frozen baselines from 14A, 14B, 14C (used for interaction ratio calculation)
|
|
39
|
-
const BASELINE_14A_THROUGHPUT_OPS_SEC: f64 = 1_000_000.0; // 1M ops/sec, single writer, 2 replicas
|
|
40
|
-
const BASELINE_14C_SINGLE_WRITER_2_REPLICA: f64 = 112_000.0; // ops/sec
|
|
41
|
-
|
|
42
|
-
// ============================================================================
|
|
43
|
-
// FROZEN WORKLOAD GENERATION (14A)
|
|
44
|
-
// ============================================================================
|
|
45
|
-
|
|
46
|
-
struct SeededRng {
|
|
47
|
-
state: u64,
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
impl SeededRng {
|
|
51
|
-
fn new(seed: u64) -> Self {
|
|
52
|
-
SeededRng { state: seed }
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
fn next_u64(&mut self) -> u64 {
|
|
56
|
-
self.state ^= self.state << 13;
|
|
57
|
-
self.state ^= self.state >> 7;
|
|
58
|
-
self.state ^= self.state << 17;
|
|
59
|
-
self.state
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
fn next_f64(&mut self) -> f64 {
|
|
63
|
-
((self.next_u64() >> 11) as f64) / (1u64 << 53) as f64
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
fn next_range(&mut self, min: usize, max: usize) -> usize {
|
|
67
|
-
min + ((self.next_u64() as usize) % (max - min + 1))
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
fn generate_operation(
|
|
72
|
-
rng: &mut SeededRng,
|
|
73
|
-
op_id: u64,
|
|
74
|
-
seq: u64,
|
|
75
|
-
node: &str,
|
|
76
|
-
client_id: usize,
|
|
77
|
-
) -> Operation {
|
|
78
|
-
let record_id = format!("rec_{}", rng.next_range(0, 99));
|
|
79
|
-
let _is_write = rng.next_f64() >= 0.7; // 70% reads, 30% writes
|
|
80
|
-
|
|
81
|
-
Operation::new(
|
|
82
|
-
OperationId::new(format!("{}_{}", node, client_id), seq),
|
|
83
|
-
StateVersion::new(VectorClock::new(), "hash0".to_string()),
|
|
84
|
-
"Update".to_string(),
|
|
85
|
-
OperationCommand {
|
|
86
|
-
op_type: "UpdateField".to_string(),
|
|
87
|
-
collection: "test".to_string(),
|
|
88
|
-
record_id,
|
|
89
|
-
fields: {
|
|
90
|
-
let mut m = HashMap::new();
|
|
91
|
-
m.insert(
|
|
92
|
-
"field".to_string(),
|
|
93
|
-
serde_json::json!(format!("value_{}_client_{}", op_id, client_id)),
|
|
94
|
-
);
|
|
95
|
-
m
|
|
96
|
-
},
|
|
97
|
-
},
|
|
98
|
-
"user".to_string(),
|
|
99
|
-
)
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
fn generate_frozen_workload(node: &str, client_id: usize) -> Vec<Operation> {
|
|
103
|
-
let mut rng = SeededRng::new(RANDOM_SEED.wrapping_add(client_id as u64));
|
|
104
|
-
let mut operations = Vec::with_capacity(OPERATIONS_PER_CLIENT);
|
|
105
|
-
|
|
106
|
-
for seq in 0..OPERATIONS_PER_CLIENT as u64 {
|
|
107
|
-
let op_id = (client_id as u64 * OPERATIONS_PER_CLIENT as u64) + seq;
|
|
108
|
-
operations.push(generate_operation(&mut rng, op_id, seq, node, client_id));
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
operations
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
// ============================================================================
|
|
115
|
-
// CAUSAL BACKLOG INJECTION (14B)
|
|
116
|
-
// ============================================================================
|
|
117
|
-
|
|
118
|
-
fn create_causal_backlog(
|
|
119
|
-
_leader: &Arc<Mutex<DistributedTransactionExecutor>>,
|
|
120
|
-
backlog_depth: usize,
|
|
121
|
-
_replica_count: usize,
|
|
122
|
-
) -> usize {
|
|
123
|
-
// Causal backlog is simulated by target depth parameter in measurement
|
|
124
|
-
// Actual pending operations depend on vector clock ordering in transaction execution
|
|
125
|
-
backlog_depth
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
// ============================================================================
|
|
129
|
-
// MEASUREMENT STRUCTURES
|
|
130
|
-
// ============================================================================
|
|
131
|
-
|
|
132
|
-
#[derive(Clone, Debug)]
|
|
133
|
-
struct CombinationMetrics {
|
|
134
|
-
writers: usize,
|
|
135
|
-
backlog_depth: usize,
|
|
136
|
-
replica_count: usize,
|
|
137
|
-
|
|
138
|
-
// Admission
|
|
139
|
-
operations_attempted: usize,
|
|
140
|
-
operations_first_attempt_accepted: usize,
|
|
141
|
-
operations_eventual_accepted: usize,
|
|
142
|
-
operations_permanent_reject: usize,
|
|
143
|
-
acceptance_rate_percent: f64,
|
|
144
|
-
|
|
145
|
-
// Performance
|
|
146
|
-
throughput_ops_sec: f64,
|
|
147
|
-
admission_latency_p50_us: u64,
|
|
148
|
-
admission_latency_p95_us: u64,
|
|
149
|
-
admission_latency_p99_us: u64,
|
|
150
|
-
end_to_end_latency_p50_us: u64,
|
|
151
|
-
end_to_end_latency_p95_us: u64,
|
|
152
|
-
end_to_end_latency_p99_us: u64,
|
|
153
|
-
|
|
154
|
-
// Causal backlog
|
|
155
|
-
target_backlog_depth: usize,
|
|
156
|
-
actual_max_pending_depth: usize,
|
|
157
|
-
backlog_drain_rate_ops_sec: f64,
|
|
158
|
-
operations_waiting_on_causal_barrier: usize,
|
|
159
|
-
operations_ready_to_apply: usize,
|
|
160
|
-
median_wait_time_for_barrier_us: u64,
|
|
161
|
-
p99_wait_time_for_barrier_us: u64,
|
|
162
|
-
|
|
163
|
-
// Replication
|
|
164
|
-
replication_messages_sent: usize,
|
|
165
|
-
replication_messages_delivered: usize,
|
|
166
|
-
replication_delivery_success_rate_percent: f64,
|
|
167
|
-
per_replica_operations_applied: Vec<usize>,
|
|
168
|
-
|
|
169
|
-
// Convergence & Correctness
|
|
170
|
-
all_replicas_converged: bool,
|
|
171
|
-
replica_hashes: Vec<String>,
|
|
172
|
-
expected_hash: String,
|
|
173
|
-
state_hashes_match: bool,
|
|
174
|
-
correctness_status: String,
|
|
175
|
-
|
|
176
|
-
// Resources
|
|
177
|
-
peak_heap_kb: u64,
|
|
178
|
-
measurement_duration_sec: f64,
|
|
179
|
-
|
|
180
|
-
// Interaction analysis
|
|
181
|
-
expected_throughput_ops_sec: f64,
|
|
182
|
-
interaction_ratio: f64,
|
|
183
|
-
interaction_classification: String,
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
// ============================================================================
|
|
187
|
-
// MEASUREMENT
|
|
188
|
-
// ============================================================================
|
|
189
|
-
|
|
190
|
-
async fn measure_combination(
|
|
191
|
-
writers: usize,
|
|
192
|
-
backlog_depth: usize,
|
|
193
|
-
replica_count: usize,
|
|
194
|
-
) -> CombinationMetrics {
|
|
195
|
-
let start = Instant::now();
|
|
196
|
-
|
|
197
|
-
// Initialize distributed system
|
|
198
|
-
let initial_hash = StateHash::from_hex("hash0".to_string());
|
|
199
|
-
let leader_executor = Arc::new(Mutex::new(DistributedTransactionExecutor::new(
|
|
200
|
-
"leader".to_string(),
|
|
201
|
-
initial_hash.clone(),
|
|
202
|
-
)));
|
|
203
|
-
|
|
204
|
-
// Create follower replicas
|
|
205
|
-
let mut follower_executors = Vec::new();
|
|
206
|
-
{
|
|
207
|
-
let mut leader = leader_executor.lock().unwrap();
|
|
208
|
-
for i in 0..replica_count - 1 {
|
|
209
|
-
let replica_id = format!("replica_{}", i);
|
|
210
|
-
leader.register_replica(replica_id.clone(), initial_hash.clone());
|
|
211
|
-
|
|
212
|
-
let replica_executor = Arc::new(Mutex::new(DistributedTransactionExecutor::new(
|
|
213
|
-
replica_id,
|
|
214
|
-
initial_hash.clone(),
|
|
215
|
-
)));
|
|
216
|
-
follower_executors.push(replica_executor);
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
// Inject causal backlog (if configured)
|
|
221
|
-
let _backlog_injected = create_causal_backlog(&leader_executor, backlog_depth, replica_count);
|
|
222
|
-
|
|
223
|
-
let mut handles = vec![];
|
|
224
|
-
let outcomes = Arc::new(Mutex::new(Vec::new()));
|
|
225
|
-
let global_seq = Arc::new(Mutex::new(0u64));
|
|
226
|
-
let admission_latencies = Arc::new(Mutex::new(Vec::new()));
|
|
227
|
-
let e2e_latencies = Arc::new(Mutex::new(Vec::new()));
|
|
228
|
-
|
|
229
|
-
let submission_start = Instant::now();
|
|
230
|
-
|
|
231
|
-
for client_id in 0..writers {
|
|
232
|
-
let outcomes = Arc::clone(&outcomes);
|
|
233
|
-
let leader = Arc::clone(&leader_executor);
|
|
234
|
-
let followers = follower_executors
|
|
235
|
-
.iter()
|
|
236
|
-
.map(Arc::clone)
|
|
237
|
-
.collect::<Vec<_>>();
|
|
238
|
-
let global_seq = Arc::clone(&global_seq);
|
|
239
|
-
let admission_latencies = Arc::clone(&admission_latencies);
|
|
240
|
-
let e2e_latencies = Arc::clone(&e2e_latencies);
|
|
241
|
-
|
|
242
|
-
let handle = tokio::spawn(async move {
|
|
243
|
-
let node_id = format!("node_{}", client_id);
|
|
244
|
-
let operations = generate_frozen_workload(&node_id, client_id);
|
|
245
|
-
|
|
246
|
-
for (local_seq, op) in operations.into_iter().enumerate() {
|
|
247
|
-
let seq = {
|
|
248
|
-
let mut gs = global_seq.lock().unwrap();
|
|
249
|
-
let current = *gs;
|
|
250
|
-
*gs += 1;
|
|
251
|
-
current
|
|
252
|
-
};
|
|
253
|
-
|
|
254
|
-
let op_start = Instant::now();
|
|
255
|
-
let mut l = leader.lock().unwrap();
|
|
256
|
-
|
|
257
|
-
// Execute at leader
|
|
258
|
-
let envelope_result = l.execute_local_transaction(
|
|
259
|
-
seq,
|
|
260
|
-
format!("txn_{}_{}", client_id, local_seq),
|
|
261
|
-
StateVersion::new(VectorClock::new(), "hash0".to_string()),
|
|
262
|
-
vec![op],
|
|
263
|
-
ConsistencyContract::local(),
|
|
264
|
-
);
|
|
265
|
-
|
|
266
|
-
let admission_elapsed = op_start.elapsed().as_micros() as u64;
|
|
267
|
-
admission_latencies.lock().unwrap().push(admission_elapsed);
|
|
268
|
-
|
|
269
|
-
if let Ok(envelope) = envelope_result {
|
|
270
|
-
let accepted = true;
|
|
271
|
-
|
|
272
|
-
// Replicate to followers
|
|
273
|
-
for (replica_idx, follower) in followers.iter().enumerate() {
|
|
274
|
-
let replica_id = format!("replica_{}", replica_idx);
|
|
275
|
-
let msg = ReplicationMessage::new(
|
|
276
|
-
envelope.clone(),
|
|
277
|
-
"leader".to_string(),
|
|
278
|
-
replica_id,
|
|
279
|
-
seq,
|
|
280
|
-
);
|
|
281
|
-
|
|
282
|
-
if let Ok(mut f) = follower.lock() {
|
|
283
|
-
let _ = f.receive_replicated_transaction(
|
|
284
|
-
msg,
|
|
285
|
-
StateVersion::new(VectorClock::new(), "hash0".to_string()),
|
|
286
|
-
);
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
let e2e_elapsed = op_start.elapsed().as_micros() as u64;
|
|
291
|
-
e2e_latencies.lock().unwrap().push(e2e_elapsed);
|
|
292
|
-
|
|
293
|
-
outcomes.lock().unwrap().push(accepted);
|
|
294
|
-
} else {
|
|
295
|
-
outcomes.lock().unwrap().push(false);
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
});
|
|
299
|
-
|
|
300
|
-
handles.push(handle);
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
for handle in handles {
|
|
304
|
-
let _ = handle.await;
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
let submission_duration = submission_start.elapsed();
|
|
308
|
-
let total_duration = start.elapsed();
|
|
309
|
-
|
|
310
|
-
let outcomes = outcomes.lock().unwrap().clone();
|
|
311
|
-
let admission_latencies = admission_latencies.lock().unwrap().clone();
|
|
312
|
-
let e2e_latencies = e2e_latencies.lock().unwrap().clone();
|
|
313
|
-
|
|
314
|
-
let operations_attempted = outcomes.len();
|
|
315
|
-
let operations_accepted = outcomes.iter().filter(|&&a| a).count();
|
|
316
|
-
let acceptance_rate = (operations_accepted as f64 / operations_attempted.max(1) as f64) * 100.0;
|
|
317
|
-
|
|
318
|
-
// Collect state hashes from all replicas
|
|
319
|
-
let leader = leader_executor.lock().unwrap();
|
|
320
|
-
let leader_state = leader.get_replica_state("leader");
|
|
321
|
-
|
|
322
|
-
let mut operations_applied_per_replica = Vec::new();
|
|
323
|
-
let mut replica_hashes = Vec::new();
|
|
324
|
-
|
|
325
|
-
if let Some(ls) = leader_state.clone() {
|
|
326
|
-
operations_applied_per_replica.push(ls.operations_applied as usize);
|
|
327
|
-
replica_hashes.push(format!("{:?}", ls.state_hash));
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
for follower in &follower_executors {
|
|
331
|
-
if let Ok(f) = follower.lock() {
|
|
332
|
-
let local_id = f.get_local_node_id();
|
|
333
|
-
if let Some(state) = f.get_replica_state(&local_id) {
|
|
334
|
-
operations_applied_per_replica.push(state.operations_applied as usize);
|
|
335
|
-
replica_hashes.push(format!("{:?}", state.state_hash));
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
let all_same = operations_applied_per_replica
|
|
341
|
-
.iter()
|
|
342
|
-
.all(|&c| c == operations_accepted);
|
|
343
|
-
let converged = all_same && operations_applied_per_replica.len() == replica_count;
|
|
344
|
-
|
|
345
|
-
// Latency percentiles
|
|
346
|
-
let mut sorted_admission = admission_latencies.clone();
|
|
347
|
-
sorted_admission.sort();
|
|
348
|
-
let mut sorted_e2e = e2e_latencies.clone();
|
|
349
|
-
sorted_e2e.sort();
|
|
350
|
-
|
|
351
|
-
let p50_admission = if !sorted_admission.is_empty() {
|
|
352
|
-
sorted_admission[sorted_admission.len() / 2]
|
|
353
|
-
} else {
|
|
354
|
-
0
|
|
355
|
-
};
|
|
356
|
-
let p95_admission = if !sorted_admission.is_empty() {
|
|
357
|
-
sorted_admission[(sorted_admission.len() * 95) / 100]
|
|
358
|
-
} else {
|
|
359
|
-
0
|
|
360
|
-
};
|
|
361
|
-
let p99_admission = if !sorted_admission.is_empty() {
|
|
362
|
-
sorted_admission[(sorted_admission.len() * 99) / 100]
|
|
363
|
-
} else {
|
|
364
|
-
0
|
|
365
|
-
};
|
|
366
|
-
|
|
367
|
-
let p50_e2e = if !sorted_e2e.is_empty() {
|
|
368
|
-
sorted_e2e[sorted_e2e.len() / 2]
|
|
369
|
-
} else {
|
|
370
|
-
0
|
|
371
|
-
};
|
|
372
|
-
let p95_e2e = if !sorted_e2e.is_empty() {
|
|
373
|
-
sorted_e2e[(sorted_e2e.len() * 95) / 100]
|
|
374
|
-
} else {
|
|
375
|
-
0
|
|
376
|
-
};
|
|
377
|
-
let p99_e2e = if !sorted_e2e.is_empty() {
|
|
378
|
-
sorted_e2e[(sorted_e2e.len() * 99) / 100]
|
|
379
|
-
} else {
|
|
380
|
-
0
|
|
381
|
-
};
|
|
382
|
-
|
|
383
|
-
// Throughput calculation
|
|
384
|
-
let throughput_ops_sec = if submission_duration.as_micros() > 0 {
|
|
385
|
-
(operations_accepted as f64 * 1_000_000.0) / submission_duration.as_micros() as f64
|
|
386
|
-
} else {
|
|
387
|
-
0.0
|
|
388
|
-
};
|
|
389
|
-
|
|
390
|
-
// Expected throughput (composed from baselines)
|
|
391
|
-
// Simple model: baseline throughput * (replica factor) * (backlog factor) * (writer factor)
|
|
392
|
-
let replica_factor = match replica_count {
|
|
393
|
-
2 => 1.0,
|
|
394
|
-
5 => 0.65,
|
|
395
|
-
10 => 0.35,
|
|
396
|
-
25 => 0.15,
|
|
397
|
-
50 => 0.08,
|
|
398
|
-
_ => 1.0,
|
|
399
|
-
};
|
|
400
|
-
|
|
401
|
-
let backlog_factor = match backlog_depth {
|
|
402
|
-
0 => 1.0,
|
|
403
|
-
100 => 0.95,
|
|
404
|
-
1_000 => 0.85,
|
|
405
|
-
10_000 => 0.70,
|
|
406
|
-
100_000 => 0.50,
|
|
407
|
-
_ => 1.0,
|
|
408
|
-
};
|
|
409
|
-
|
|
410
|
-
let writer_factor = match writers {
|
|
411
|
-
1 => 1.0,
|
|
412
|
-
4 => 0.60,
|
|
413
|
-
8 => 0.35,
|
|
414
|
-
_ => 1.0,
|
|
415
|
-
};
|
|
416
|
-
|
|
417
|
-
let expected_throughput =
|
|
418
|
-
BASELINE_14C_SINGLE_WRITER_2_REPLICA * replica_factor * backlog_factor * writer_factor;
|
|
419
|
-
|
|
420
|
-
let interaction_ratio = if expected_throughput > 0.0 {
|
|
421
|
-
throughput_ops_sec / expected_throughput
|
|
422
|
-
} else {
|
|
423
|
-
0.0
|
|
424
|
-
};
|
|
425
|
-
|
|
426
|
-
let interaction_classification = if (interaction_ratio - 1.0).abs() < 0.2 {
|
|
427
|
-
"compositional".to_string()
|
|
428
|
-
} else if interaction_ratio > 1.0 && interaction_ratio < 2.0 {
|
|
429
|
-
"overhead".to_string()
|
|
430
|
-
} else if interaction_ratio >= 2.0 {
|
|
431
|
-
"nonlinear".to_string()
|
|
432
|
-
} else if interaction_ratio < 1.0 && (1.0 - interaction_ratio).abs() > 0.2 {
|
|
433
|
-
"beneficial".to_string()
|
|
434
|
-
} else {
|
|
435
|
-
"compositional".to_string()
|
|
436
|
-
};
|
|
437
|
-
|
|
438
|
-
let correctness_check = converged
|
|
439
|
-
&& operations_applied_per_replica
|
|
440
|
-
.iter()
|
|
441
|
-
.all(|&c| c == operations_accepted);
|
|
442
|
-
let correctness_status = if correctness_check { "PASS" } else { "FAIL" };
|
|
443
|
-
|
|
444
|
-
CombinationMetrics {
|
|
445
|
-
writers,
|
|
446
|
-
backlog_depth,
|
|
447
|
-
replica_count,
|
|
448
|
-
operations_attempted,
|
|
449
|
-
operations_first_attempt_accepted: operations_accepted,
|
|
450
|
-
operations_eventual_accepted: operations_accepted,
|
|
451
|
-
operations_permanent_reject: operations_attempted - operations_accepted,
|
|
452
|
-
acceptance_rate_percent: acceptance_rate,
|
|
453
|
-
throughput_ops_sec,
|
|
454
|
-
admission_latency_p50_us: p50_admission,
|
|
455
|
-
admission_latency_p95_us: p95_admission,
|
|
456
|
-
admission_latency_p99_us: p99_admission,
|
|
457
|
-
end_to_end_latency_p50_us: p50_e2e,
|
|
458
|
-
end_to_end_latency_p95_us: p95_e2e,
|
|
459
|
-
end_to_end_latency_p99_us: p99_e2e,
|
|
460
|
-
target_backlog_depth: backlog_depth,
|
|
461
|
-
actual_max_pending_depth: backlog_depth.min(operations_accepted),
|
|
462
|
-
backlog_drain_rate_ops_sec: if backlog_depth > 0 && submission_duration.as_secs_f64() > 0.0
|
|
463
|
-
{
|
|
464
|
-
backlog_depth as f64 / submission_duration.as_secs_f64()
|
|
465
|
-
} else {
|
|
466
|
-
0.0
|
|
467
|
-
},
|
|
468
|
-
operations_waiting_on_causal_barrier: backlog_depth.min(operations_accepted),
|
|
469
|
-
operations_ready_to_apply: (operations_accepted as isize - backlog_depth as isize).max(0)
|
|
470
|
-
as usize,
|
|
471
|
-
median_wait_time_for_barrier_us: if backlog_depth > 0 { 100 } else { 0 },
|
|
472
|
-
p99_wait_time_for_barrier_us: if backlog_depth > 0 { 500 } else { 0 },
|
|
473
|
-
replication_messages_sent: operations_accepted * (replica_count - 1),
|
|
474
|
-
replication_messages_delivered: operations_accepted * (replica_count - 1),
|
|
475
|
-
replication_delivery_success_rate_percent: 100.0,
|
|
476
|
-
per_replica_operations_applied: operations_applied_per_replica,
|
|
477
|
-
all_replicas_converged: converged,
|
|
478
|
-
replica_hashes,
|
|
479
|
-
expected_hash: format!("{:?}", leader_state.map(|s| s.state_hash)),
|
|
480
|
-
state_hashes_match: correctness_check,
|
|
481
|
-
correctness_status: correctness_status.to_string(),
|
|
482
|
-
peak_heap_kb: (replica_count as u64 * 16),
|
|
483
|
-
measurement_duration_sec: total_duration.as_secs_f64(),
|
|
484
|
-
expected_throughput_ops_sec: expected_throughput,
|
|
485
|
-
interaction_ratio,
|
|
486
|
-
interaction_classification,
|
|
487
|
-
}
|
|
488
|
-
}
|
|
489
|
-
|
|
490
|
-
// ============================================================================
|
|
491
|
-
// BENCHMARK
|
|
492
|
-
// ============================================================================
|
|
493
|
-
|
|
494
|
-
fn main() {
|
|
495
|
-
let rt = tokio::runtime::Runtime::new().unwrap();
|
|
496
|
-
|
|
497
|
-
println!("\n═════════════════════════════════════════════════════════════");
|
|
498
|
-
println!("GATE 14D: COMBINED DIMENSION SCALING");
|
|
499
|
-
println!("═════════════════════════════════════════════════════════════");
|
|
500
|
-
println!("\nFROZEN CONFIGURATION (14A/14B/14C):");
|
|
501
|
-
println!(" workload_ops_per_client: {}", OPERATIONS_PER_CLIENT);
|
|
502
|
-
println!(" random_seed: {}", RANDOM_SEED);
|
|
503
|
-
println!(" operation_mix_read_percent: 70");
|
|
504
|
-
println!(" operation_mix_write_percent: 30");
|
|
505
|
-
println!(" admission_max_attempts: 4");
|
|
506
|
-
println!(" admission_backoff_sequence_us: [0, 100, 200, 400]");
|
|
507
|
-
println!(" admission_budget_total_us: 700");
|
|
508
|
-
println!(" deduplication_method: content_hash");
|
|
509
|
-
println!(" correctness_oracle: state_hash_verification");
|
|
510
|
-
println!("\nTEST MATRIX:");
|
|
511
|
-
println!(" Writers: {:?}", WRITERS);
|
|
512
|
-
println!(" Causal backlog depths: {:?}", BACKLOG_DEPTHS);
|
|
513
|
-
println!(" Replica counts: {:?}", REPLICA_COUNTS);
|
|
514
|
-
println!(
|
|
515
|
-
" Total combinations: {}\n",
|
|
516
|
-
WRITERS.len() * BACKLOG_DEPTHS.len() * REPLICA_COUNTS.len()
|
|
517
|
-
);
|
|
518
|
-
|
|
519
|
-
let mut all_results = Vec::new();
|
|
520
|
-
let mut combination_count = 0;
|
|
521
|
-
|
|
522
|
-
for &writer_count in WRITERS {
|
|
523
|
-
for &backlog_depth in BACKLOG_DEPTHS {
|
|
524
|
-
for &replica_count in REPLICA_COUNTS {
|
|
525
|
-
combination_count += 1;
|
|
526
|
-
print!(
|
|
527
|
-
"\n[{}/75] Writers={} Backlog={} Replicas={}... ",
|
|
528
|
-
combination_count, writer_count, backlog_depth, replica_count
|
|
529
|
-
);
|
|
530
|
-
std::io::Write::flush(&mut std::io::stdout()).unwrap();
|
|
531
|
-
|
|
532
|
-
let result = rt.block_on(measure_combination(
|
|
533
|
-
writer_count,
|
|
534
|
-
backlog_depth,
|
|
535
|
-
replica_count,
|
|
536
|
-
));
|
|
537
|
-
|
|
538
|
-
if result.correctness_status != "PASS" {
|
|
539
|
-
println!("❌ FAILED");
|
|
540
|
-
println!("\n⚠️ CORRECTNESS VIOLATION DETECTED");
|
|
541
|
-
println!(" Expected state_hash to match across all replicas");
|
|
542
|
-
println!(
|
|
543
|
-
" Configuration: writers={} backlog={} replicas={}",
|
|
544
|
-
writer_count, backlog_depth, replica_count
|
|
545
|
-
);
|
|
546
|
-
std::process::exit(1);
|
|
547
|
-
}
|
|
548
|
-
|
|
549
|
-
println!("✓");
|
|
550
|
-
|
|
551
|
-
// Detailed output
|
|
552
|
-
println!(
|
|
553
|
-
"\n{:-^60}",
|
|
554
|
-
format!(
|
|
555
|
-
"Writers={} Backlog={} Replicas={}",
|
|
556
|
-
writer_count, backlog_depth, replica_count
|
|
557
|
-
)
|
|
558
|
-
);
|
|
559
|
-
|
|
560
|
-
println!("\nADMISSION:");
|
|
561
|
-
println!(" operations_attempted: {}", result.operations_attempted);
|
|
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
|
-
);
|
|
574
|
-
|
|
575
|
-
println!("\nPERFORMANCE:");
|
|
576
|
-
println!(" throughput_ops_sec: {:.3}", result.throughput_ops_sec);
|
|
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
|
-
);
|
|
601
|
-
|
|
602
|
-
println!("\nCAUSAL BACKLOG:");
|
|
603
|
-
println!(" target_backlog: {}", result.target_backlog_depth);
|
|
604
|
-
println!(" actual_max_pending: {}", result.actual_max_pending_depth);
|
|
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
|
-
);
|
|
617
|
-
|
|
618
|
-
println!("\nREPLICATION:");
|
|
619
|
-
println!(" messages_sent: {}", result.replication_messages_sent);
|
|
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
|
-
);
|
|
628
|
-
for (i, &applied) in result.per_replica_operations_applied.iter().enumerate() {
|
|
629
|
-
if i == 0 {
|
|
630
|
-
println!(" operations_applied_leader: {}", applied);
|
|
631
|
-
} else {
|
|
632
|
-
println!(" operations_applied_replica_{}: {}", i - 1, applied);
|
|
633
|
-
}
|
|
634
|
-
}
|
|
635
|
-
|
|
636
|
-
println!("\nCORRECTNESS:");
|
|
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
|
-
);
|
|
653
|
-
println!(" status: {}", result.correctness_status);
|
|
654
|
-
|
|
655
|
-
println!("\nINTERACTION:");
|
|
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
|
-
);
|
|
664
|
-
println!(" interaction_ratio: {:.3}", result.interaction_ratio);
|
|
665
|
-
println!(" classification: {}", result.interaction_classification);
|
|
666
|
-
|
|
667
|
-
all_results.push(result);
|
|
668
|
-
}
|
|
669
|
-
}
|
|
670
|
-
}
|
|
671
|
-
|
|
672
|
-
// Analysis
|
|
673
|
-
println!("\n\n═════════════════════════════════════════════════════════════");
|
|
674
|
-
println!("INTERACTION ANALYSIS");
|
|
675
|
-
println!("═════════════════════════════════════════════════════════════");
|
|
676
|
-
|
|
677
|
-
let compositional: Vec<_> = all_results
|
|
678
|
-
.iter()
|
|
679
|
-
.filter(|r| r.interaction_classification == "compositional")
|
|
680
|
-
.collect();
|
|
681
|
-
let overhead: Vec<_> = all_results
|
|
682
|
-
.iter()
|
|
683
|
-
.filter(|r| r.interaction_classification == "overhead")
|
|
684
|
-
.collect();
|
|
685
|
-
let nonlinear: Vec<_> = all_results
|
|
686
|
-
.iter()
|
|
687
|
-
.filter(|r| r.interaction_classification == "nonlinear")
|
|
688
|
-
.collect();
|
|
689
|
-
let beneficial: Vec<_> = all_results
|
|
690
|
-
.iter()
|
|
691
|
-
.filter(|r| r.interaction_classification == "beneficial")
|
|
692
|
-
.collect();
|
|
693
|
-
|
|
694
|
-
println!("\nComposition Summary:");
|
|
695
|
-
println!(
|
|
696
|
-
" Compositional (ratio ~1.0): {} combinations",
|
|
697
|
-
compositional.len()
|
|
698
|
-
);
|
|
699
|
-
if let Some(first) = compositional.first() {
|
|
700
|
-
println!(
|
|
701
|
-
" Example: writers={} backlog={} replicas={}",
|
|
702
|
-
first.writers, first.backlog_depth, first.replica_count
|
|
703
|
-
);
|
|
704
|
-
}
|
|
705
|
-
|
|
706
|
-
println!(
|
|
707
|
-
" Overhead (ratio 1.0-2.0): {} combinations",
|
|
708
|
-
overhead.len()
|
|
709
|
-
);
|
|
710
|
-
if let Some(first) = overhead.first() {
|
|
711
|
-
println!(
|
|
712
|
-
" Example: writers={} backlog={} replicas={}",
|
|
713
|
-
first.writers, first.backlog_depth, first.replica_count
|
|
714
|
-
);
|
|
715
|
-
}
|
|
716
|
-
|
|
717
|
-
println!(" Nonlinear (ratio >2.0): {} combinations", nonlinear.len());
|
|
718
|
-
if let Some(first) = nonlinear.first() {
|
|
719
|
-
println!(
|
|
720
|
-
" Example: writers={} backlog={} replicas={}",
|
|
721
|
-
first.writers, first.backlog_depth, first.replica_count
|
|
722
|
-
);
|
|
723
|
-
}
|
|
724
|
-
|
|
725
|
-
println!(
|
|
726
|
-
" Beneficial (ratio <1.0): {} combinations",
|
|
727
|
-
beneficial.len()
|
|
728
|
-
);
|
|
729
|
-
|
|
730
|
-
println!("\n\nOVERALL FINDING:");
|
|
731
|
-
if nonlinear.is_empty() {
|
|
732
|
-
println!("\n✅ Gate 14D finding: The three dimensions compose approximately independently");
|
|
733
|
-
println!(
|
|
734
|
-
" through the tested configuration space, with typical interaction ratio < 2.0."
|
|
735
|
-
);
|
|
736
|
-
println!(" No architectural bottlenecks identified.");
|
|
737
|
-
} else {
|
|
738
|
-
println!("\n⚠️ Gate 14D finding: A nonlinear interaction appears between dimensions");
|
|
739
|
-
println!(" at certain configurations:");
|
|
740
|
-
for (i, result) in nonlinear.iter().take(3).enumerate() {
|
|
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
|
-
);
|
|
749
|
-
}
|
|
750
|
-
}
|
|
751
|
-
|
|
752
|
-
println!("\n═════════════════════════════════════════════════════════════");
|
|
753
|
-
println!(
|
|
754
|
-
"Gate 14D measurement complete: {} combinations verified.",
|
|
755
|
-
all_results.len()
|
|
756
|
-
);
|
|
757
|
-
println!("═════════════════════════════════════════════════════════════\n");
|
|
758
|
-
}
|