Share replication encoding per interest; fix dev retained builds
Foundation / checks (deploy) (push) Successful in 3m26s
Foundation / checks (ecs) (push) Successful in 1m54s
Foundation / checks (client) (push) Successful in 12m36s
Foundation / checks (network) (push) Successful in 13m35s
Foundation / checks (tsan) (push) Successful in 7m48s
Foundation / checks (checks) (push) Successful in 32m51s
Foundation / checks (postgres) (push) Successful in 46m20s
Foundation / postgres-tools (push) Successful in 1m35s
Foundation / image (push) Successful in 2m32s
Foundation / server-image (push) Successful in 4m14s
Foundation / checks (deploy) (push) Successful in 3m26s
Foundation / checks (ecs) (push) Successful in 1m54s
Foundation / checks (client) (push) Successful in 12m36s
Foundation / checks (network) (push) Successful in 13m35s
Foundation / checks (tsan) (push) Successful in 7m48s
Foundation / checks (checks) (push) Successful in 32m51s
Foundation / checks (postgres) (push) Successful in 46m20s
Foundation / postgres-tools (push) Successful in 1m35s
Foundation / image (push) Successful in 2m32s
Foundation / server-image (push) Successful in 4m14s
ADR-0097. The second evolution-dev load drill (image 7952185d) held 20 sessions with client budgets met (response p95 111 ms, outcome p95 about 1.2 s, 20 Hz, no starvation) but the server over its own: tick work p99 48-70 ms (25 ms budget), session layer 1.2-2.0 ms per session at p99 (0.5 ms budget), governor refusing and shedding to level 3 to little effect. ReplicationServer::tick re-encoded every environment cell and organism for each session. Sessions with the same requested interest (no perception predicate) now share one encoding per tick; markers stay per session. Locally 21 sessions: about 970 us -> 360 us per tick. The drill now waits for two consecutive calm reports before the bots. The dev overlay's REGION_RETAINED listed the deployed build itself (61df6a1,f88bee2), which the deploy policy refuses (CI deploy failed on those commits); it now lists only the other builds, keeping 6c96629e, the build of the region head. Refreshes the dev session window. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
#include "evo/network/replication.hpp"
|
||||
#include "network_test.hpp"
|
||||
#include <algorithm>
|
||||
#include <chrono>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <map>
|
||||
@@ -447,8 +448,58 @@ void shedding() {
|
||||
CHECK(client.latest()->environment.size() == 225 && baseline != 0);
|
||||
}
|
||||
|
||||
// M10.9d (ADR-0097): sessions with the same interest share one encoding of the environment
|
||||
// per tick; each still converges on exactly its square, and another interest gets its own.
|
||||
// Prints the server's time per tick for 20 sessions (a development reference).
|
||||
void shared_interest() {
|
||||
auto server = *ReplicationServer::create(limits());
|
||||
World world;
|
||||
constexpr std::uint64_t sessions = 21;
|
||||
std::vector<SnapshotAssembler> clients;
|
||||
for (std::uint64_t id = 1; id <= sessions; ++id) {
|
||||
CHECK(server.open(id, 5));
|
||||
// Session 21 looks elsewhere (centre 3, 0): its own square.
|
||||
CHECK(server.set_interest(id, {id == sessions ? 3 : 0, 0, slice, 7}));
|
||||
clients.emplace_back(identity, 5);
|
||||
}
|
||||
const auto source = [&](const SessionInterest&) { return world.source(); };
|
||||
std::uint64_t tick = 0;
|
||||
std::chrono::nanoseconds spent{};
|
||||
const auto step = [&] {
|
||||
const auto started = std::chrono::steady_clock::now();
|
||||
const auto out = server.tick(++tick, source, {});
|
||||
spent += std::chrono::steady_clock::now() - started;
|
||||
for (std::uint64_t id = 1; id <= sessions; ++id)
|
||||
for (const auto& a : deliver(clients[id - 1], for_session(out, id)))
|
||||
server.acknowledge(id, a);
|
||||
};
|
||||
for (int i = 0; i < 6; ++i)
|
||||
step();
|
||||
for (std::uint64_t id = 1; id <= sessions; ++id) {
|
||||
const auto& view = clients[id - 1].latest()->environment;
|
||||
const std::int64_t centre = id == sessions ? 3 : 0;
|
||||
CHECK(view.size() == 225 && std::ranges::all_of(view, [&](const auto& c) {
|
||||
return std::abs(c.voxel.x - centre) <= 7 && std::abs(c.voxel.y) <= 7;
|
||||
}));
|
||||
}
|
||||
// A change reaches every session that sees it.
|
||||
world.quantity[{1, 1}] = 77;
|
||||
spent = {};
|
||||
for (int i = 0; i < 40; ++i)
|
||||
step();
|
||||
for (auto& c : clients)
|
||||
CHECK(std::ranges::any_of(c.latest()->environment, [](const auto& e) {
|
||||
return e.voxel.x == 1 && e.voxel.y == 1 && e.quantity[0] == 77;
|
||||
}));
|
||||
std::printf("replication shared_interest sessions=%llu us_per_tick=%lld\n",
|
||||
static_cast<unsigned long long>(sessions),
|
||||
static_cast<long long>(
|
||||
std::chrono::duration_cast<std::chrono::microseconds>(spent).count() / 40));
|
||||
}
|
||||
|
||||
void replication_tests() {
|
||||
codec_v2();
|
||||
shared_interest();
|
||||
convergence_and_deltas();
|
||||
shedding();
|
||||
concealment();
|
||||
|
||||
Reference in New Issue
Block a user