ADR: The store does the work
- Status
- accepted
- Date
- 2026-10-18
The hundred thousand vehicles live in the store and nowhere else: the Catalogue table on Azure SQL Database and the catalogue container on Cosmos DB, each vehicle written once with the slot its id's hash gives its auction window. A listing, the filter values, a vehicle by id and the simulated room's picks are queries against the store the request is on; the store filters, orders and pages, and only the page comes back. The deterministic expansion of the 200 seed vehicles is now the seeder: it fills an empty store once and is let go. Each .NET process runs under a heap limit of 30 per cent; since 19 October there is one (ADR: One web app for every .NET process).
Reading list
For Steve, when he is fresh, in this order:
- Memory, held by the build, the Best Practices page: the eight rules, each with why, the number this change moved, and the code that holds it.
- This record: why the catalogue in memory was a cache pretending to be a store, what replaced it, and what it measured.
- ADR-094, compiled before it ships: where the GC settings this record leans on were chosen.
- Microsoft Learn, Fundamentals of garbage collection: generations, and why a long-lived object costs more than a short-lived one.
- Microsoft Learn, The large object heap on Windows: the 85,000-byte line and what crossing it costs.
- Microsoft Learn, Runtime configuration options for garbage collection: every setting this record names, including the one that has to be written in hexadecimal.
Each outside link was fetched on 2026-10-18 before it was cited.
In plain words
The site used to load all hundred thousand vehicles into its own memory, twice, once for each database, and answer every search by sorting through that copy. The databases held only the 200 starting vehicles. Now the databases hold all hundred thousand and answer the search themselves; the site asks for one page and gets one page.
What that is worth: the memory the four apps share stops being spent on a second copy of data a database already keeps, and the database does the job it is built for. A slower answer is the price, and this record says exactly how much slower.
Context
Steve's ruling, 2026-10-18, 15:41 to 15:43 CDT: keep the B2, keep the hundred thousand vehicles, but stop holding them in RAM, "this work should happen on the database", and hold the apps to memory best practices he can learn from.
The plan card read 2.77 GB of 3.5 GB at 15:40 CDT. Measured before anything changed, 1.0.3.176 at 22:01 to 22:03 UTC, about fifty minutes after its roll:
The plan as a whole: 82 per cent, 2.87 of 3.5 GB, amber, with a thirty-day 95th of 83 and a peak of 93. Workstation GC with concurrent collection was already in effect on both (ADR-094), and Store:WarmOthers was already off, but the keep-warm loop loaded the other store's catalogue within minutes anyway, so each site held both.
A catalogue in memory was a cache pretending to be a store. It had no bound, it never expired, it was rebuilt from the seed on every start, and it was the one copy the site trusted. The databases, which are the place a hundred thousand rows belong, held two hundred.
Decision
The store holds the hundred thousand, each with its slot. AuctionSchedule.Window puts every window at the day's anchor plus an offset that depends on the id alone. Those two offsets, start and end, are written beside each vehicle at the fill, with the price a buyer competes against and the lowercased searchable text. The hash stays the authority. A test reads all hundred thousand slots back and holds each one to the window the hash gives on four anchors either side of both daylight-saving changes, and the status the clock derives to the segment the slot gives. A vehicle's status is still derived from the window and the clock; the store compares the slot with now instead of the code doing it.
public readonly record struct CatalogueSlot(long StartOffsetMs, long EndOffsetMs)
{
public static CatalogueSlot For(string vehicleId)
{
var window = AuctionSchedule.Window(vehicleId, 0);
return new CatalogueSlot(window.StartsAtMs, window.EndsAtMs);
}
public static int PriceOf(Vehicle vehicle) => vehicle.CurrentBid ?? vehicle.StartingBid;
public CatalogueSegment SegmentAt(long sinceAnchorMs) =>
sinceAnchorMs < StartOffsetMs ? CatalogueSegment.Upcoming
: sinceAnchorMs < EndOffsetMs ? CatalogueSegment.Live
: CatalogueSegment.Ended;
}
Live from api/TheYard.Application/Shared/Auction/CatalogueFilter.cs, region slot, read from this build at 99df7a8.
[Fact]
public async Task The_slot_beside_every_vehicle_is_the_window_the_hash_gives_on_any_day()
{
var vehicles = await ExpansionAsync(100_000);
long[] anchors =
[
new DateTimeOffset(2026, 3, 8, 0, 0, 0, TimeSpan.Zero).ToUnixTimeMilliseconds(),
new DateTimeOffset(2026, 10, 18, 0, 0, 0, TimeSpan.Zero).ToUnixTimeMilliseconds(),
new DateTimeOffset(2026, 11, 1, 0, 0, 0, TimeSpan.Zero).ToUnixTimeMilliseconds(),
new DateTimeOffset(2027, 2, 28, 0, 0, 0, TimeSpan.Zero).ToUnixTimeMilliseconds(),
];
int wrong = 0;
foreach (var vehicle in vehicles)
{
var slot = CatalogueSlot.For(vehicle.Id);
foreach (long anchor in anchors)
{
var window = AuctionSchedule.Window(vehicle.Id, anchor);
long now = anchor + 13 * 3_600_000L;
var status = AuctionSchedule.Status(window, now);
var segment = slot.SegmentAt(now - anchor);
bool same = window.StartsAtMs == anchor + slot.StartOffsetMs
&& window.EndsAtMs == anchor + slot.EndOffsetMs
&& segment.ToString() == status.ToString();
wrong += same ? 0 : 1;
}
}
Assert.Equal(0, wrong);
}
Live from api/TheYard.Tests/StoreCatalogueTests.cs, region slot, read from this build at 99df7a8.
Application plans, the adapters translate. The port IVehicleCatalogue has five primitives: how full the store is, a fill, the counts split by schedule segment, one page in one order, and point reads by id. The listing is planned once, in InventoryService. The default listing is three segments read one after another (live by closest end, upcoming by soonest start, ended by most recent end), each off its own index, stopping at the page's last row. The adapters only translate a filter and an order into their own query:
private IQueryable<CatalogueRow> Query(YardDbContext db, CatalogueFilter filter)
{
long d = filter.SinceAnchorMs;
var rows = db.Catalogue.AsNoTracking();
if (_beyond)
{
rows = rows.Where(row => row.Seq < target);
}
if (filter.Make is { } make)
{
rows = rows.Where(row => row.Make == make);
}
if (filter.BodyStyle is { } bodyStyle)
{
rows = rows.Where(row => row.BodyStyle == bodyStyle);
}
if (filter.TitleStatus is { } titleStatus)
{
rows = rows.Where(row => row.TitleStatus == titleStatus);
}
if (filter.Province is { } province)
{
rows = rows.Where(row => row.Province == province);
}
rows = (filter.Segment, local && filter.Tokens.Count > 0) switch
{
(CatalogueSegment.Live, false) => rows.Where(row => row.StartOffsetMs <= d && row.EndOffsetMs > d),
(CatalogueSegment.Upcoming, false) => rows.Where(row => row.StartOffsetMs > d),
(CatalogueSegment.Ended, false) => rows.Where(row => row.EndOffsetMs <= d),
(CatalogueSegment.Live, true) => rows.Where(row => row.StartOffsetMs + 0 <= d && row.EndOffsetMs + 0 > d),
(CatalogueSegment.Upcoming, true) => rows.Where(row => row.StartOffsetMs + 0 > d),
(CatalogueSegment.Ended, true) => rows.Where(row => row.EndOffsetMs + 0 <= d),
_ => rows,
};
if (filter.MinCondition is { } grade)
{
rows = rows.Where(row => row.ConditionGrade >= grade);
}
if (filter.PriceMin is { } low)
{
rows = rows.Where(row => row.Price >= low);
}
if (filter.PriceMax is { } high)
{
rows = rows.Where(row => row.Price <= high);
}
foreach (var token in filter.Tokens)
{
string text = token.Text;
bool live = token.AlsoMatches.Contains(CatalogueSegment.Live);
bool upcoming = token.AlsoMatches.Contains(CatalogueSegment.Upcoming);
bool ended = token.AlsoMatches.Contains(CatalogueSegment.Ended);
rows = _words.Holding(db, rows, text, live, upcoming, ended, d);
}
if (filter.Exclude.Count > 0)
{
string[] moved = [.. filter.Exclude];
rows = rows.Where(row => !EF.Parameter(moved).Contains(row.Id));
}
return rows;
}
private static IQueryable<CatalogueRow> Ordered(IQueryable<CatalogueRow> rows, CatalogueOrder order) => order switch
{
CatalogueOrder.EndAscending => rows.OrderBy(row => row.EndOffsetMs).ThenBy(row => row.Seq),
CatalogueOrder.StartAscending => rows.OrderBy(row => row.StartOffsetMs).ThenBy(row => row.Seq),
CatalogueOrder.EndDescending => rows.OrderByDescending(row => row.EndOffsetMs).ThenBy(row => row.Seq),
CatalogueOrder.PriceAscending => rows.OrderBy(row => row.Price).ThenBy(row => row.Seq),
CatalogueOrder.PriceDescending => rows.OrderByDescending(row => row.Price).ThenBy(row => row.Seq),
CatalogueOrder.ConditionDescending => rows.OrderByDescending(row => row.ConditionGrade).ThenBy(row => row.Seq),
CatalogueOrder.BidsDescending => rows.OrderByDescending(row => row.BidCount).ThenBy(row => row.Seq),
_ => rows.OrderBy(row => row.Seq),
};
public async Task<SegmentCounts> CountAsync(CatalogueFilter filter, CancellationToken cancellation)
{
await using var db = await contexts.CreateDbContextAsync(cancellation);
await _words.WordsBeforeQueryAsync(db, filter, cancellation);
long d = filter.SinceAnchorMs;
var counts = await Query(db, filter.In(CatalogueSegment.Any))
.GroupBy(_ => 1)
.Select(all => new
{
Live = all.Count(row => row.StartOffsetMs <= d && row.EndOffsetMs > d),
Upcoming = all.Count(row => row.StartOffsetMs > d),
Ended = all.Count(row => row.EndOffsetMs <= d),
})
.FirstOrDefaultAsync(cancellation);
if (counts is null)
{
return SegmentCounts.None;
}
return filter.Segment switch
{
CatalogueSegment.Live => new SegmentCounts(counts.Live, 0, 0),
CatalogueSegment.Upcoming => new SegmentCounts(0, counts.Upcoming, 0),
CatalogueSegment.Ended => new SegmentCounts(0, 0, counts.Ended),
_ => new SegmentCounts(counts.Live, counts.Upcoming, counts.Ended),
};
}
public async Task<IReadOnlyList<CatalogueEntry>> PageAsync(CatalogueFilter filter, CatalogueOrder order, int skip, int take, CancellationToken cancellation)
{
if (take <= 0)
{
return [];
}
await using var db = await contexts.CreateDbContextAsync(cancellation);
await _words.WordsBeforeQueryAsync(db, filter, cancellation);
bool word = local && filter.Tokens.Count > 0;
if (!word && skip < DeepSkip)
{
var rows = await Ordered(Query(db, filter), order).Skip(skip).Take(take).ToListAsync(cancellation);
return [.. rows.Select(row => row.ToEntry())];
}
var places = await (word ? Unindexed(Query(db, filter), order) : Ordered(Query(db, filter), order))
.Skip(skip).Take(take).Select(row => row.Seq).ToListAsync(cancellation);
if (places.Count == 0)
{
return [];
}
var found = (await db.Catalogue.AsNoTracking().Where(row => EF.Parameter(places).Contains(row.Seq)).ToListAsync(cancellation))
.ToDictionary(row => row.Seq);
return [.. places.Select(place => found[place].ToEntry())];
}
Live from api/TheYard.Infrastructure/Shared/Auction/EfVehicleCatalogue.cs, region ef-catalogue-query, read from this build at 99df7a8.
private static (string Where, List<(string Name, object Value)> Parameters, string? Partition) Where(CatalogueFilter filter, int target)
{
var where = new StringBuilder(Written);
var parameters = new List<(string, object)> { ("@target", target), ("@d", filter.SinceAnchorMs) };
void Equal(string path, string name, string? value)
{
if (value is not null)
{
where.Append($" AND c.{path} = {name}");
parameters.Add((name, value));
}
}
Equal("make", "@make", filter.Make);
Equal("body_style", "@body", filter.BodyStyle);
Equal("title_status", "@title", filter.TitleStatus);
Equal("province", "@province", filter.Province);
where.Append(Segment(filter.Segment) is { } segment ? $" AND {segment}" : "");
if (filter.MinCondition is { } grade)
{
where.Append(" AND c.condition_grade >= @grade");
parameters.Add(("@grade", grade));
}
if (filter.PriceMin is { } low)
{
where.Append(" AND c.price >= @low");
parameters.Add(("@low", low));
}
if (filter.PriceMax is { } high)
{
where.Append(" AND c.price <= @high");
parameters.Add(("@high", high));
}
for (int i = 0; i < filter.Tokens.Count; i++)
{
var token = filter.Tokens[i];
bool word = token.Text.Length >= VehicleSearchIndex.WordLength;
var either = word
? new List<string> { $"STARTSWITH(c.search, @t{i})", $"CONTAINS(c.search, @s{i})" }
: new List<string> { $"CONTAINS(c.search, @t{i})" };
either.AddRange(token.AlsoMatches.Select(Segment).OfType<string>());
where.Append($" AND ({string.Join(" OR ", either)})");
parameters.Add(($"@t{i}", token.Text));
if (word)
{
parameters.Add(($"@s{i}", " " + token.Text));
}
}
if (filter.Exclude.Count > 0)
{
where.Append(" AND NOT ARRAY_CONTAINS(@moved, c.id)");
parameters.Add(("@moved", filter.Exclude.ToArray()));
}
return (where.ToString(), parameters, filter.Make);
}
internal static string? Segment(CatalogueSegment segment) => segment switch
{
CatalogueSegment.Live => "(c.start_offset <= @d AND c.end_offset > @d)",
CatalogueSegment.Upcoming => "c.start_offset > @d",
CatalogueSegment.Ended => "c.end_offset <= @d",
_ => null,
};
internal static string OrderBy(CatalogueOrder order) => order switch
{
CatalogueOrder.EndAscending => "c.end_offset ASC, c.seq ASC",
CatalogueOrder.StartAscending => "c.start_offset ASC, c.seq ASC",
CatalogueOrder.EndDescending => "c.end_offset DESC, c.seq ASC",
CatalogueOrder.PriceAscending => "c.price ASC, c.seq ASC",
CatalogueOrder.PriceDescending => "c.price DESC, c.seq ASC",
CatalogueOrder.ConditionDescending => "c.condition_grade DESC, c.seq ASC",
CatalogueOrder.BidsDescending => "c.bid_count DESC, c.seq ASC",
_ => "c.seq ASC",
};
private static QueryDefinition Define(string text, List<(string Name, object Value)> parameters)
{
var query = new QueryDefinition(text);
foreach (var (name, value) in parameters)
{
query = query.WithParameter(name, value);
}
return query;
}
public async Task<SegmentCounts> CountAsync(CatalogueFilter filter, CancellationToken cancellation)
{
async Task<int> Count(CatalogueSegment segment)
{
if (filter.Segment != CatalogueSegment.Any && filter.Segment != segment)
{
return 0;
}
var (where, parameters, partition) = Where(filter.In(segment), target);
var counts = await store.QueryAsync<int>(Catalogue, Define($"SELECT VALUE COUNT(1) FROM c WHERE {where}", parameters), partition, Label(partition), cancellation: cancellation);
return counts.Count == 0 ? 0 : counts[0];
}
return new SegmentCounts(
await Count(CatalogueSegment.Live),
await Count(CatalogueSegment.Upcoming),
await Count(CatalogueSegment.Ended));
}
public async Task<IReadOnlyList<CatalogueEntry>> PageAsync(CatalogueFilter filter, CatalogueOrder order, int skip, int take, CancellationToken cancellation)
{
if (take <= 0)
{
return [];
}
if (await _kept.PageAsync(filter, order, skip, take, cancellation) is { } kept)
{
return kept;
}
var (where, parameters, partition) = Where(filter, target);
var documents = await store.QueryAsync<CatalogueDocument>(
Catalogue,
Define($"SELECT * FROM c WHERE {where} ORDER BY {OrderBy(order)} OFFSET {skip} LIMIT {take}", parameters),
partition,
Label(partition), cancellation: cancellation);
return [.. documents.Select(document => document.ToEntry())];
}
Live from api/TheYard.Infrastructure.Cosmos/Shared/Auction/CosmosVehicleCatalogue.cs, region cosmos-catalogue-query, read from this build at 99df7a8.
On SQL Server each order is one index ending in Seq (api/TheYard.Database/Tables/Catalogue.sql), so a page is a seek and a scan that stops, and every read is AsNoTracking. The two schedule indexes carry the other end of the window, so a segment's count and a live page's test of its start never read the row, and a filtered count reads one narrow index holding only the columns a count compares, IX_Catalogue_Counts, rather than the table at about two kilobytes a row. That index leads with the columns no page ranges over, so the planner never pages off it and then sorts. Measured on the PC before it was added, against a local file of all hundred thousand: the unfiltered count took 400 to 600 ms and a listing 300 to 1,100 ms, enough for seven of the browser suite's 168 tests to run out of time under four browsers at once. A query starts from Seq < target only when the table holds rows past the catalogue, because that range over the clustered key is what kept the planner off the order's own index. When bids have moved prices, the count is the store's cached count less the moved vehicles that match on the dataset's figures, and the page is the store's cached page made longer by that many, with the moved ones dropped in the process and each row's place worked out from how many moved vehicles sort before it. Putting the ids into the store's query made it test every row it read against the list, 25 seconds for a count and 58 for a page once under the browser suite, and gave the cache a new key with every bid. And a cache miss loads once a key: everybody who asks while a count is loading waits for that one. Each descending order has an index that descends on its figure and ascends on the place, the way the page is ordered, because an index the wrong way round on either key had SQLite sort every live vehicle for a page of twenty-five (27 seconds once under the suite). A local SQLite file pools its connections, so its page cache outlives a statement; the pool for that one file is emptied before the file is deleted. StoreCatalogueTests reads SQLite's own plan for every count and page shape and fails on a count that reads the table or a page that sorts its matches. Counts are read only when a number needs them: unfiltered, the total is the catalogue's size, so the default listing's first pages, the ones most visitors read, cost the store one page and no count. A typed word is looked for in IX_Catalogue_Words, the searchable text beside every column a word's count or page compares or orders by. On a SQLite file, whose planner has no statistics, a word's page reads its places off that index alone, with the schedule and order columns written as + 0 so no other index can draw the planner into reading every row of a range for its text, and then reads the page's rows by their place. On Cosmos DB every path a WHERE names is in the indexing policy, every two-key ORDER BY has its composite index, and a vehicle read by id is a point read: the synthetic id is a seed id and six characters, and the seed's two hundred makes give every id its partition, so nothing a visitor opens fans out (ADR: The partition key). An unfiltered listing does fan out, to the container's one physical partition, which that record measured at the cost of a pinned page at this size.
A bid moves a price the store does not hold. Everybody's bids and the room's answers stay in memory, as they were (BidService, MarketService). When a move can change which vehicles match or where they sort (a price filter, a price sort, the bid-count sort), the store leaves those vehicles out, they are worked out in memory from their raised figures, and the two ordered lists are merged at the page. Otherwise the store's page is the page and the moves are laid on its rows. A test holds every page, at every offset tried, to the page the full sort over the raised catalogue gives.
bool overlayMatters = overlay is { Ids.Count: > 0 }
&& (sort is VehicleSort.PriceAsc or VehicleSort.PriceDesc or VehicleSort.MostBids
|| filter.PriceMin is not null || filter.PriceMax is not null);
if (!overlayMatters)
{
var (total, rows) = await _listing.StorePageAsync(catalogue, resolved, sort, offset, limit, cancellation);
return new SearchResult(total, [.. rows.Select(entry => Finish(entry.Vehicle, warm, overlay))]);
}
var matches = filter.Compile(clock);
var moved = await _listing.FindEntriesAsync(catalogue, overlay!.Ids, cancellation);
var raised = moved
.Select(entry => entry with { Vehicle = overlay.Apply(entry.Vehicle) })
.Where(entry => matches(entry.Vehicle))
.OrderBy(entry => Key(entry, sort, resolved.SinceAnchorMs))
.ToList();
int skip = Math.Max(0, offset - raised.Count);
int take = (int)Math.Min(int.MaxValue, (long)offset + limit - skip);
var (storeTotal, stored) = await _listing.StorePageAsync(catalogue, resolved with { Exclude = overlay.Ids }, sort, skip, take, cancellation, moved);
return new SearchResult(
storeTotal + raised.Count,
[.. Merge(stored, raised, sort, resolved.SinceAnchorMs, skip, offset, limit).Select(entry => Finish(entry.Vehicle, warm, null))]);
Live from api/TheYard.Application/Shared/Auction/Stock.Search.cs, region overlay, read from this build at 99df7a8.
The expansion is the seeder. At warm-up the site counts what its store holds. Full, the store answers and nothing is loaded. Short by a few thousand, the warm-up fills it first. Short by more, the site answers from the expansion in memory while it fills its own store beside itself at the store's pace, then switches, lets the list go, and runs one compacting collection so the dial shows the memory the same minute. The other site watches and switches when the fill is done. Catalogue__Keep turns that on for the deploy and leaves every test host alone.
private async Task<IVehicleCatalogue> PickAsync(CancellationToken cancellation)
{
if (_store is null)
{
return Bridge(await _seeder.LoadAsync(cancellation));
}
int filled;
try
{
filled = await _store.FilledAsync(cancellation);
}
catch (Exception ex) when (ex is not OutOfMemoryException)
{
_note = $"the store's catalogue could not be read ({ex.GetType().Name}), so the expansion answers from memory";
var unread = Bridge(await _seeder.LoadAsync(cancellation));
Watch(_store, cancellation);
return unread;
}
Volatile.Write(ref _filled, filled);
int missing = _store.Target - filled;
if (missing <= 0)
{
return _store;
}
var expansion = await _seeder.LoadAsync(cancellation);
if (missing <= _store.Pace.FillAtWarmUpTo)
{
await FillAsync(_store, expansion, filled, pause: false, cancellation);
return _store;
}
var bridge = Bridge(expansion);
if (_upkeep == CatalogueUpkeep.Fill)
{
_note = $"the store holds {filled:N0} of {_store.Target:N0}; filling it beside the site";
_pending = expansion;
var store = _store;
Filling = Task.Run(() => FillBesideAsync(store, filled, cancellation), cancellation);
}
else
{
_note = $"the store holds {filled:N0} of {_store.Target:N0}, and this site does not fill it, so the expansion answers from memory";
Watch(_store, cancellation);
}
return bridge;
}
private void Watch(IVehicleCatalogue store, CancellationToken cancellation)
{
if (_upkeep == CatalogueUpkeep.Off)
{
return;
}
Filling = Task.Run(async () =>
{
for (int minute = 0; minute < 24 * 60 && !cancellation.IsCancellationRequested; minute++)
{
await Task.Delay(TimeSpan.FromMinutes(1), cancellation);
try
{
int filled = await store.FilledAsync(cancellation);
Volatile.Write(ref _filled, filled);
if (filled >= store.Target)
{
SwitchTo(store);
return;
}
}
catch (Exception ex) when (ex is not OutOfMemoryException)
{
_note = $"the store's catalogue could not be counted ({ex.GetType().Name}); counting again in a minute";
}
}
}, cancellation);
}
private void SwitchTo(IVehicleCatalogue store)
{
_active = store;
_bridge = null;
_note = null;
switched();
GC.Collect(2, GCCollectionMode.Aggressive, blocking: true, compacting: true);
}
private MemoryCatalogue Bridge(IReadOnlyList<Vehicle> vehicles)
{
var bridge = new MemoryCatalogue(vehicles);
_bridge = bridge;
return bridge;
}
Live from api/TheYard.Application/Shared/Auction/StockSource.cs, region choose, read from this build at 99df7a8.
Every cache is bounded. BoundedCache holds the listing's counts and pages for one five-second bucket of the clock and the vehicles read by id for ten minutes, each bounded by a count and by an estimate of its bytes.
private readonly BoundedCache<string, SegmentCounts> _counts = new(512, 1L << 20, TimeSpan.FromSeconds(5), _ => 96);
private readonly BoundedCache<string, IReadOnlyList<CatalogueEntry>> _pages = new(64, 16L << 20, TimeSpan.FromSeconds(5), page => 64 + (page.Count * ExpectedVehicleBytes));
private readonly BoundedCache<string, CatalogueEntry> _vehicles = new(4_096, 8L << 20, TimeSpan.FromMinutes(10), _ => ExpectedVehicleBytes, comparer: StringComparer.Ordinal);
Live from api/TheYard.Application/Shared/Auction/CataloguePages.cs, region listing-cache, read from this build at 99df7a8.
A heap limit on each site. DOTNET_GCHeapHardLimitPercent is 0x1E on both .NET sites in infra/appservice.bicep. GC settings read from the environment are hexadecimal, so 30 would have been forty-eight per cent. With the limit, a regression is collected harder, and refused if it must be, inside its own share instead of taking memory from the other three apps on the plan.
The audit
The eight rules of the Memory page, applied to every app on the plan:
private static readonly Dictionary<string, string> Bounded = new(StringComparer.Ordinal)
{
["TheYard.Api.Features.Docs.EnforcedBy.Counted"] = "one per repository root this process serves, one in a running host, each one count per decision record",
["TheYard.Application.Shared.Caching.BoundedCache`2._map"] = "the bounded cache itself: a count and a byte limit, and an expiry",
["TheYard.Application.Shared.Caching.BoundedCache`2._recency"] = "the same cache's order of use, the same size as its map",
["TheYard.Application.Shared.Caching.BoundedCache`2._inflight"] = "the loads under way, one a key, each removed the moment it finishes",
["TheYard.Application.Shared.Auction.MemoryCatalogue._entries"] = "the list catalogue: the tests, the file fallback and a fill's bridge, let go when the store answers",
["TheYard.Application.Shared.Auction.MemoryCatalogue._slots"] = "one per vehicle of the list catalogue above",
["TheYard.Application.Shared.Auction.MemoryCatalogue._texts"] = "one per vehicle of the list catalogue above",
["TheYard.Application.Shared.Auction.MemoryCatalogue._byId"] = "one per vehicle of the list catalogue above",
["TheYard.Application.Shared.Auction.MemoryCatalogue._orders"] = "one sorted order per CatalogueOrder value, eight",
["TheYard.Application.Shared.Auction.Room._bids"] = "one per vehicle the room has raised: at most the catalogue, emptied by a reset",
["TheYard.Application.Shared.Auction.BidLedger._standing"] = "one per vehicle anybody bid on, the store's standing cached: at most the catalogue",
["TheYard.Application.Shared.Auction.BidLedger._byUser"] = "one per account with a bid, each holding that account's bids",
["TheYard.Application.Shared.History.MemoryResourceHistory._minutes"] = "a month of minutes, trimmed on every append",
["TheYard.Api.Shared.Instance.PulseDay._day"] = "one day of five-minute buckets, 289 at most, replaced whole or folded on every read",
["TheYard.Application.Shared.History.MemoryResourceHistory._hours"] = "a month of hours, trimmed on every append",
["TheYard.Application.Shared.History.MemoryNightlyRunLog._runs"] = "the nightly workflow's runs, one per GitHub run, a year of them, trimmed on every upsert",
["TheYard.Application.Shared.History.MemoryNightlyRunLog._firings"] = "the Function's judged slots, six a day, a year of them, trimmed on every upsert",
["TheYard.Api.Features.Admin.Cloud.ClaudeSource._records"] = "the usage documents of the last thirty days, replaced whole on every read",
["TheYard.Application.Features.Blog.MemoryBlogStore._posts"] = "the blog's posts where no database is attached, at most MaxRows, refused past it",
["TheYard.Application.Features.Blog.MemoryBlogStore._reads"] = "the blog's reads where no database is attached, the oldest dropped past MaxRows",
["TheYard.Application.Features.Blog.MemoryBlogStore._events"] = "the blog's events where no database is attached, the oldest dropped past MaxRows",
["TheYard.Application.Features.Blog.MemoryBlogStore._derived"] = "one entry a kept post, so bounded by the posts' own MaxRows",
["TheYard.Application.Features.Blog.MemoryLinkedInStore._parts"] = "LinkedIn posting's rows in the suite's memory: one a blog post, so bounded by the blog's own posts",
["TheYard.Application.Features.Admin.Foreman.ForemanToolbox._calls"] = "one run's tool calls, refused past ForemanCaps.ToolCalls, and the toolbox lives one run",
["TheYard.Application.Features.Blog.MemoryLinkedInStore._states"] = "the connects in flight in the suite's memory: each taken once, and every one past its ten minutes removed on each insert",
["TheYard.Application.Features.Blog.LinkedInTokenSeal._key"] = "the token seal's key: 32 bytes, derived once",
["TheYard.Application.Features.Blog.MemoryBlogVocabulary._tags"] = "the blog's tags where no database is attached: the starter's, a save's tags and the operator's behind the key, tens",
["TheYard.Application.Features.Blog.MemoryBlogVocabulary._synonyms"] = "the search's synonym words where no database is attached: the starter's and the operator's behind the key, tens",
["TheYard.Domain.Features.Blog.BlogVocabulary._synonyms"] = "one entry a synonym word of the vocabulary it indexes, which the store read whole, tens",
["TheYard.Application.Shared.Live.LiveRing`1._ring"] = "a live ring's samples, its size of them (LiveRings.Size or MemoryBoxLive.Size), the oldest dropped on every push",
["TheYard.Application.Shared.Live.LiveLease._touched"] = "one moment a card key, the catalogue's keys and no more",
["TheYard.Application.Shared.Live.LiveRings._rings"] = "one ring a live source, the sources this process has and no more",
["TheYard.Application.Features.Admin.Cloud.MemoryBoxSnapshots._waiting"] = "the box's snapshots the recorder has not taken, MemoryBoxSnapshots.MostWaiting of them, the oldest dropped on every accept",
["TheYard.Application.Shared.History.MemoryUsageLog._records"] = "every Claude lane's runs, one per lane and run, a year of them, trimmed on every upsert",
["TheYard.Application.Shared.History.MemoryPlanHistory._minutes"] = "a month of minutes, trimmed on every append",
["TheYard.Application.Shared.History.MemoryPlanHistory._hours"] = "a month of hours, trimmed on every append",
["TheYard.Domain.Shared.Auction.VehicleSearchIndex._byId"] = "one per vehicle of the catalogue it was built over; the site builds none",
["TheYard.Domain.Shared.Auction.ScheduleOrder._starts"] = "one per vehicle of the catalogue it was built over; the site builds none",
["TheYard.Domain.Shared.Auction.ScheduleOrder._ends"] = "one per vehicle of the catalogue it was built over; the site builds none",
["TheYard.Domain.Shared.Auction.ScheduleOrder._byEnd"] = "one per vehicle of the catalogue it was built over; the site builds none",
["TheYard.Domain.Shared.Auction.ScheduleOrder._byStart"] = "one per vehicle of the catalogue it was built over; the site builds none",
["TheYard.Api.Shared.Observability.LogRingBuffer._entries"] = "a ring of RingSizes.LogRing",
["TheYard.Api.Shared.Activity.RequestRingBuffer._entries"] = "a ring of RingSizes.RequestRing",
["TheYard.Api.Shared.Observability.SqlRingBuffer._entries"] = "a ring of two hundred statements",
["TheYard.Api.Shared.Observability.StoreRingBuffer._entries"] = "a ring of two hundred operations",
["TheYard.Api.Shared.Observability.ErrorRingBuffer._entries"] = "a ring of RingSizes.ErrorRing",
["TheYard.Api.Shared.MachineReadings.MachineSampler._samples"] = "a ring of an hour of samples",
["TheYard.Api.Shared.Observability.StartupTimings._steps"] = "the startup's named steps, a handful",
["TheYard.Api.Features.Accounts.RegistrationLimit._taken"] = "the registrations inside the allowance's window, at most the allowance",
["TheYard.Api.Features.Accounts.ForgotLimit._last"] = "at most ForgotLimit.MaxAddresses, the stale ones forgotten first",
["TheYard.Api.Shared.Instance.SelfTestCooldown._last"] = "the accounts that ran the self-test in the last minute",
["TheYard.Api.Shared.Proof.ProofRunner._accounts"] = "the proof's own accounts, one per store, two",
["TheYard.Api.Shared.Activity.ActivityReportCache._entries"] = "one per named window, three",
["TheYard.Api.Shared.Activity.ActivityReportCache._building"] = "one per named window, three",
["TheYard.Api.Features.Admin.Cloud.CloudRecorder._hourRead"] = "one per resource card, seven",
["TheYard.Api.Features.Admin.Cloud.CloudRecorder._liveHour"] = "one hour per resource card, seven, each replaced by the next",
["TheYard.Api.Features.Admin.Cloud.CloudRecorder._keptMinutes"] = "each card's minutes of the last ten, older ones removed on every write",
["TheYard.Api.Shared.PlanReadings.PlanRecorder._keptMinutes"] = "the plan's minutes of the last ten, older ones removed on every read",
["TheYard.Api.Features.Admin.Cloud.CloudReader._asked"] = "one per card, the cards in the catalogue",
["TheYard.Api.Features.Admin.Cloud.CloudReader._month"] = "one per card, seven",
["TheYard.Application.Shared.History.MonthKeep`1._kept"] = "thirty days of five-minute buckets, 8,640 at most, older ones dropped on every read",
["TheYard.Api.Shared.Hosted.KeptViews`1._cached"] = "one per slot asked for in the last hour: a Cloud card's or the plan's window, the Azure card's one view, a runs page; dropped with its slot an hour after the last ask",
["TheYard.Api.Shared.Hosted.KeptViews`1._watched"] = "one per slot asked for, dropped an hour after the last ask; the slots are the windows, process names and pages each route already accepts",
["TheYard.Api.Shared.Hosted.KeptViews`1._building"] = "every build under way, one a slot, shared by the requests and the keeper, each removed the moment it finishes",
["TheYard.Api.Shared.Hosted.ViewKeeper._views"] = "one per route that keeps its views, four, fixed at startup",
["TheYard.Application.Features.Blog.MemoryBlogImageStore._files"] = "the pictures the tests or the operator put in a process with no container, a handful",
["TheYard.Api.Features.Admin.Cloud.ProcessDescriptions._read"] = "one per file of the job hunt Function it reads, eleven: the ten processes and its own paragraph",
["TheYard.Api.Shared.Activity.ActivityCollector._stores"] = "one per store, two",
["TheYard.Api.Shared.Activity.ActivityCollector._keptToday"] = "one per visitor seen today, emptied of every earlier day on each drain",
["TheYard.Api.Shared.Auth.AdminKey._key"] = "the operator key's bytes, fixed at startup",
["TheYard.Api.Shared.Activity.VisitorTokens._key"] = "the visitor-token key's bytes, fixed at startup",
["TheYard.Api.Shared.Stores.Backends._all"] = "the two backends",
["TheYard.Api.Shared.Instance.SiteHosts._sites"] = "the configured sites, one per public name, read once at startup",
["TheYard.Api.Shared.Activity.RequestRecorder._siteHosts"] = "the same configured sites' names, copied once at startup",
["TheYard.Api.Shared.CostReadings.CostHistoryReader._cached"] = "one per named window, four",
["TheYard.Api.Shared.MachineReadings.MachineHistoryReader._cached"] = "one per named window, four",
["TheYard.Api.Shared.Observability.KeptRingReader._cache"] = "one per kept card and named window, each a known name",
["TheYard.Application.Shared.Auction.StockSource._pending"] = "the expansion handed to a fill, taken by the fill the moment it starts",
["TheYard.Application.Shared.Auction.MemoryBidStore._bids"] = "the bid store of a site whose store is down: one row per buyer's bid, gone with the process",
["TheYard.Application.Shared.Auction.MemoryBidStore._standings"] = "the same store's standings, one per vehicle bid on",
["TheYard.Application.Features.Accounts.MemoryResetLinks._kept"] = "reset links, each expiring in an hour and swept on every mint",
["TheYard.Application.Features.Visitors.MemoryVisitorStore._visitors"] = "the visitors of a site with no document store: one per stable hash, every person and scanner who has visited since the process started",
["TheYard.Application.Features.Links.MemoryLinkOpens._days"] = "one per tagged code per day it was opened; the operator sends a few dozen codes a week, and the site keeps none of this without a document store",
["TheYard.Application.Features.Review.MemoryReviewStore._rows"] = "one per visitor per day on the review route, of a site with no document store, gone with the process",
["TheYard.Api.Features.Docs.QualityTrendFence._kept"] = "one entry a quality number a page asks for, one today (the review route's short path)",
["TheYard.Application.Features.Review.ReviewLotKeeper._kept"] = "one lot a store, two (SQL and Cosmos DB), each replaced every fifteen seconds",
["TheYard.Api.Features.Links.ConfiguredLinkTargets._targets"] = "the pass-through addresses configuration names, two, read once at startup",
["TheYard.Infrastructure.Cosmos.Shared.Auction.CosmosVehicleCatalogue._makeBySeedId"] = "the seed's two hundred ids and their makes",
["TheYard.Infrastructure.Cosmos.Shared.Stores.CosmosStore._physicalPartitions"] = "one per container, read at startup",
["TheYard.Infrastructure.Cosmos.Shared.Auction.CosmosCatalogueKeysets._keysets"] = "one per order, seven, each the key of every 250th row: 400 places",
["TheYard.Infrastructure.Cosmos.Shared.Auction.CosmosCatalogueKeysets._walks"] = "one per order, seven",
};
private static readonly string[] Projects =
["TheYard.Data", "TheYard.Domain", "TheYard.Application", "TheYard.Infrastructure", "TheYard.Infrastructure.Cosmos", "TheYard.Api"];
private static bool IsCollection(Type type) =>
type != typeof(string)
&& (type.IsArray
|| (typeof(IEnumerable).IsAssignableFrom(type) && type.Namespace?.StartsWith("System.Collections", StringComparison.Ordinal) == true));
private static bool IsValue(Type type) =>
type.Name.EndsWith("Row", StringComparison.Ordinal)
|| type.Name.EndsWith("Document", StringComparison.Ordinal)
|| type.IsDefined(typeof(System.Runtime.CompilerServices.CompilerGeneratedAttribute))
|| type.GetMethod("<Clone>$", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) is not null
|| type.Namespace == "TheYard.Data";
private static bool IsOurs(Type type) => type.Namespace?.StartsWith("TheYard", StringComparison.Ordinal) == true;
[Fact]
public void The_scan_reads_only_the_types_this_codebase_wrote()
{
Assert.True(IsOurs(typeof(PlanChildren)));
Assert.True(IsOurs(typeof(MemoryRulesTests)));
Assert.False(IsOurs(typeof(System.Text.StringBuilder)));
}
[Fact]
public void Every_collection_a_long_lived_object_keeps_is_named_with_its_bound()
{
var found = Projects
.SelectMany(name => Assembly.Load(new AssemblyName(name)).GetTypes())
.Where(type => type.IsClass && IsOurs(type) && !IsValue(type) && !(type.FullName ?? "").Contains('<', StringComparison.Ordinal))
.SelectMany(type => type.GetFields(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.DeclaredOnly)
.Where(field => !field.IsLiteral && !field.Name.Contains('<', StringComparison.Ordinal) && IsCollection(field.FieldType) && !IsFrozen(field))
.Select(field => $"{type.FullName}.{field.Name}"))
.ToHashSet(StringComparer.Ordinal);
var unnamed = found.Except(Bounded.Keys).Order().ToList();
var gone = Bounded.Keys.Except(found).Order().ToList();
Assert.True(unnamed.Count == 0, "collections with no bound written down: " + string.Join(", ", unnamed));
Assert.True(gone.Count == 0, "bounds for collections that are gone: " + string.Join(", ", gone));
}
private static bool IsFrozen(FieldInfo field) =>
field.IsStatic && field.IsInitOnly
&& (field.FieldType.Name.StartsWith("IReadOnly", StringComparison.Ordinal)
|| field.FieldType.Name.StartsWith("Frozen", StringComparison.Ordinal)
|| field.FieldType.IsArray
|| field.FieldType == typeof(HashSet<string>));
[Fact]
public void A_bounded_cache_keeps_its_count_its_bytes_and_its_expiry()
{
var clock = new StepClock(new DateTimeOffset(2026, 10, 18, 12, 0, 0, TimeSpan.Zero));
var cache = new BoundedCache<string, string>(3, 100, TimeSpan.FromSeconds(5), text => text.Length, clock, StringComparer.Ordinal);
cache.Set("a", new string('a', 10));
cache.Set("b", new string('b', 10));
cache.Set("c", new string('c', 10));
Assert.True(cache.TryGet("a", out _));
cache.Set("d", new string('d', 10));
Assert.Equal(3, cache.Count);
Assert.False(cache.TryGet("b", out _));
cache.Set("big", new string('x', 90));
Assert.True(cache.Bytes <= 100);
Assert.True(cache.TryGet("big", out _));
cache.Set("too-big", new string('y', 101));
Assert.False(cache.TryGet("too-big", out _));
clock.Step(TimeSpan.FromSeconds(6));
Assert.False(cache.TryGet("big", out _));
cache.Clear();
Assert.Equal((0, 0L), (cache.Count, cache.Bytes));
}
[Fact]
public async Task A_bounded_cache_asks_the_factory_once_while_the_answer_is_fresh()
{
var cache = new BoundedCache<int, int>(10, 1_000, TimeSpan.FromMinutes(1), _ => 4);
int asked = 0;
int first = await cache.GetOrAddAsync(1, _ => Task.FromResult(++asked), CancellationToken.None);
int second = await cache.GetOrAddAsync(1, _ => Task.FromResult(++asked), CancellationToken.None);
Assert.Equal((1, 1, 1), (first, second, asked));
}
[Fact]
public async Task A_bounded_cache_loads_a_key_once_for_everybody_who_misses_together()
{
var cache = new BoundedCache<int, int>(10, 1_000, TimeSpan.FromMinutes(1), _ => 4);
var gate = new TaskCompletionSource<int>(TaskCreationOptions.RunContinuationsAsynchronously);
int asked = 0;
var waiting = Enumerable.Range(0, 8).Select(_ => cache.GetOrAddAsync(1, _ => { Interlocked.Increment(ref asked); return gate.Task; }, CancellationToken.None)).ToList();
gate.SetResult(42);
int[] answers = await Task.WhenAll(waiting);
Assert.Equal(1, asked);
Assert.All(answers, answer => Assert.Equal(42, answer));
}
[Fact]
public async Task A_bounded_cache_keeps_no_failed_load_and_the_next_caller_tries_again()
{
var cache = new BoundedCache<int, int>(10, 1_000, TimeSpan.FromMinutes(1), _ => 4);
await Assert.ThrowsAsync<InvalidOperationException>(() => cache.GetOrAddAsync(1, _ => Task.FromException<int>(new InvalidOperationException("the store is away")), CancellationToken.None));
int answer = await cache.GetOrAddAsync(1, _ => Task.FromResult(7), CancellationToken.None);
Assert.Equal(7, answer);
}
[Fact]
public void The_reset_limit_forgets_stale_addresses_before_it_refuses_a_new_one()
{
var now = new DateTimeOffset(2026, 10, 18, 12, 0, 0, TimeSpan.Zero);
var limit = new ForgotLimit(TimeSpan.FromMinutes(5), () => now);
for (int i = 0; i < ForgotLimit.MaxAddresses; i++)
{
Assert.True(limit.TryTake($"buyer{i}@example.com"));
}
Assert.False(limit.TryTake("one-more@example.com"));
Assert.False(limit.TryTake("buyer1@example.com"));
now = now.AddMinutes(6);
Assert.True(limit.TryTake("one-more@example.com"));
Assert.True(limit.Count <= ForgotLimit.MaxAddresses);
}
Live from api/TheYard.Tests/MemoryRulesTests.cs, region rule-b, read from this build at 99df7a8.
What it measured
The before is the table under Context. The after is read once the roll has finished, each store's fill has finished and the dial has settled ten minutes, and it is written into the addendum below with the same readings, because a number on this page has to be one somebody read.
Consequences
- A listing is now a store round trip or three, where it was a walk of a list in the same process, and the store bills for it: request units on Cosmos DB, DTU on SQL Database. The five-second cache is what keeps a busy minute from paying for the same page twice.
- The rule "nothing schedule-related is persisted" now has one exception, the slot, which is a copy of the hash's answer and is held to it by a test. CLAUDE.md says so.
- A site whose store is down still serves, from the expansion in memory, the way it did before this change. That is the one place the old cost comes back, and the Admin tab says when it has.
ScheduleOrder and the search index are no longer used by the site. They stay in Domain, with their tests, because this change was held to leaving Domain as it was; they go with the next change that touches it.
Where it sits
The port, IVehicleCatalogue, and the one plan for every listing, InventoryService and its parts, in TheYard.Application, beside the list catalogue the tests and the file fallback use. The two translations in the two adapter projects: EfVehicleCatalogue and the Catalogue table's row and model in TheYard.Infrastructure, CosmosVehicleCatalogue and its document in TheYard.Infrastructure.Cosmos. The schema in TheYard.Database, the container's policy in infra/cosmos/. The host wires one catalogue per store in Composition/Catalogues.cs and owns the outbound pool and the collector's reading. Domain does not change: the slot is the schedule's own answer on an anchor of zero.
What would change it: a catalogue too big for one physical partition or for the Basic tier's DTU, at which point the Cosmos key takes the make and the segment together and the SQL side takes a columnstore or a larger tier.
Files
api/TheYard.Application/Shared/Auction/Ports.cs - IVehicleCatalogue, the five primitives
api/TheYard.Application/Shared/Auction/CatalogueFilter.cs - the filter in the store's terms, the orders, the segments and the slot
api/TheYard.Application/Shared/Auction/Stock.cs and its parts .Warm.cs, .Search.cs, .Find.cs - the warm-up, the listing plan and the overlay's merge, the reads by id; beside it StockSource.cs, CataloguePages.cs and CatalogueFilterResolver.cs - the choice of store or list and the fill, the cached answers with and without the moved vehicles, the filter in the store's spelling
api/TheYard.Application/Shared/Auction/MemoryCatalogue.cs - the list catalogue: the tests, the file fallback and a fill's bridge
api/TheYard.Application/Shared/Caching/BoundedCache.cs - the one cache shape
api/TheYard.Infrastructure/Shared/Auction/EfVehicleCatalogue.cs, CatalogueRows.cs and CatalogueModel.cs - the relational adapter
api/TheYard.Database/Tables/Catalogue.sql - the table and one index per order
api/TheYard.Infrastructure.Cosmos/Shared/Auction/CosmosVehicleCatalogue.cs and Documents.Catalogue.cs - the document adapter
infra/cosmos/catalogue.json - the indexed paths and the composite indexes
api/TheYard.Api/Shared/Stores/Catalogues.cs - one catalogue per store, and who fills
api/TheYard.Infrastructure/Shared/Http/OutboundHttp.cs - the one outbound pool
infra/appservice.bicep - Catalogue__Keep and the heap limit
api/TheYard.Tests/StoreCatalogueTests.cs - the slot against the hash, and the relational adapter against the list
api/TheYard.Tests/StockTests.cs - the plan, the merge and the switch
api/TheYard.Tests/MemoryRulesTests.cs - the memory rules a test can hold
docs/best-practices/MEMORY.md - the eight rules, for a reader new to them
Addendum, 2026-10-19: what it measured after
Read on 1.0.3.179 at 04:43 UTC, ten minutes after both fills had finished at 04:33, with the same readings the table under Context used, from each site's own /api/admin/machines, the plan card and 32 listing reads per site at the offsets a visitor reaches (0 to 3,100), timed by the server:
The plan: 82 per cent before, 68 per cent after at 04:43 UTC, 2.38 of 3.5 GB, below its amber line for the first time since the catalogue moved into the processes on 8 October. The rendering service read about 90 MB and The Shed about 37 MB, as before.
The SQL side is faster than it was from memory, because each order is an index and a page is a seek that stops. The Cosmos DB side is slower, and the record says so rather than averaging it away: its OFFSET reads every document it skips, so the request units grow with the offset (16 RU for the first page, 1,665 for an offset of 40,000, which took 8.4 seconds and is more than the account's 1,000 RU a second), and the account is a region away from the plan, the 38 to 40 ms round trip ADR-079 measured, paid several times by a cross-partition ordered query. The p95 above includes three deep reads at 5,000, 20,000 and 40,000 on each site. On Azure SQL Database the same deep reads took 243, 299 and 298 ms once 1.0.3.179 read a deep page's places off the order's index; on 1.0.3.178 an offset of 40,000 took 6.4 seconds. The fix on the Cosmos DB side is a keyset read, the next page asked for after the last row's end and place rather than by a count of rows to skip, and it is the next change to this record.
Addendum, 2026-10-19 (1.0.3.182): the scan reads only this codebase's types
The rule that every collection a long-lived object keeps is named with its bound scans the six projects' assemblies by reflection. Under CI's coverage run those assemblies also carry the coverage collector's tracker classes, each with a static hit array, and the scan failed on them from 1.0.3.178 to 181 while the gate, which does not collect coverage, passed. MemoryRulesTests now reads only types whose namespace is TheYard's, and The_scan_reads_only_the_types_this_codebase_wrote holds the filter. No bound changed and no collection was added (ADR: The five-minute gate, the addendum of this date).
Addendum, 2026-10-19 (1.0.3.183): a typed word is a seek, a deep page on the document store starts from a kept place, and the memory readings carry their minute
An outside review read the live sites between 06:02 and 06:12 CDT on 19 October and found three things this record had claimed or left open that did not hold. Each was read again before it was changed, at 11:29 to 11:30 UTC, from the operator's PC through the public addresses.
A typed word on Azure SQL Database. The record's plan test held the words index on SQLite only, and no typed word was ever timed on Azure SQL Database. Timed, a word took about four seconds: chevrolet 4,777 ms, nissan 4,440, mazda 4,401, subaru 4,483, hyundai 3,705, each a word no visitor had typed since the last roll, against 543 to 898 ms for the same words on the Cosmos DB site. The cause was the query: a word was SearchText LIKE '%word%', a leading wildcard no index can seek, so the Basic tier's 5 DTU read the text of every one of the hundred thousand rows.
A word is now looked for in a table of words. CatalogueWords holds one row per distinct word of each vehicle's searchable text, about ten a vehicle, keyed by the place and the word so the fill's check for a vehicle's words is a seek, and indexed by the word so a typed word is a range on IX_CatalogueWords_Word that hands back the places the order's index then reads. A token of three characters or more matches the start of a word, so "hon" finds Honda and "onda" finds nothing; a shorter token is still looked for anywhere in the text, a scan on either store, and the search box says so. Every store and every in-memory filter asks the one question, VehicleSearchIndex.Holds, so the two sites and the moved vehicles merged at the page agree. On the document store the same rule is the text starting with the word or holding it after a space, which needs no new data.
The rows already stored got their words beside the site: the site that fills the catalogue has SQL Server split each row's text itself, two thousand places a statement with a fifth of a second between, and until the last row has its words a word is read the old way, slow and the same answer. A row the fill writes from now on gets its words in the same save. StoreCatalogueTests holds the word page's plan on SQLite to a range on the word index and never the old text index, and the list-equivalence test holds three-letter starts and middles to the list's answer. The times after, and what the backfill cost the Basic tier in DTU, are read once it has run and written below.
A deep page on the document store. OFFSET reads every document it skips. Read at 11:30 UTC on 1.0.3.181, the default listing's live segment cost 214 RU and 1,202 ms at an offset of 5,000, 831 RU and 3,912 ms at 20,000, and 1,659 RU and 8,087 ms at 40,000, against an account of 1,000 RU a second. The SQL site answered the same offsets in 181 to 238 ms, off its indexes.
A page deep in an order is now asked for from a kept place: the order key and place of every 250th row, and the page is the rows at or after it, by the order's own composite index, skipping fewer than 250. For the whole catalogue in any order, and for the upcoming segment by start and the ended segment by end, which are each the tail of their order over the whole catalogue, the places are walked once, a thousand a read, and hold for as long as the catalogue does, because the slot, the price, the grade and the dataset's bid count are written once by the fill. The live segment moves with the day, so its places are walked at one moment and corrected on each read by two small counts: the rows that ended since the walk, which all sort before any place still live, and the rows that started since and sort before the place, a few hundred an hour. They are walked again every hour and after midnight. A filter by make, body, title, province, grade, price or a typed word keeps OFFSET, because the places do not count those sets; the largest is a make's few thousand. The API keeps its page numbers, so no address a visitor holds changes. StoreCatalogueTests holds which pages are served this way, and the live Cosmos DB step reads one live page at an offset of 5,000 both ways, at the walk's moment and half an hour later, and holds the kept-place page to the same rows for under 100 RU. The times after are read once it rolls and written below.
The memory readings. The 1.0.3.181 entry in the changelog read the plan at 62 to 64 per cent and each .NET site at about 300 MB at 06:04 UTC, fifteen minutes after DOTNET_GCConserveMemory was set, and the table above read 68 per cent at 04:43 UTC. Neither held. At 11:30 UTC the plan read 73 per cent, 2.56 of 3.5 GB, with a 30-day 95th of 84.4 and a peak of 94; the SQL site's working set 395.7 MB, up from 357.3 an hour before, with a 106.6 MB heap and a 41.9 MB large object heap; the Cosmos DB site 366.2 MB, up from 338.4, with a 103.2 MB heap and a 31.8 MB large object heap. No vehicle is held in memory on either, and the heap limit is 986.4 MB on both, as written. Each number on a page that quotes numbers now carries the minute it was read. The settled reading, a day after 1.0.3.181 rolled, is written below when it is taken.
The document store read every four minutes from the SQL site. It is the keep-warm loop (ADR: Kept awake), which sends every public read through each store every four minutes, the Cosmos DB store included, so that store's connection and caches never go cold on either site. It is meant, and it stays.
Read after the roll. 1.0.3.183 was live on both sites at 22b3015 at 13:14 UTC, with every workflow on that commit green (CI #39257101995, Deploy #39257102076, Deploy Cosmos #39257102111, Deploy Render #39257102061, read with gh). The words were filled beside the site from 13:14 to 13:19 UTC: a fresh word on the SQL site read 4,660, 28,656, 12,252 and 11,893 ms while the fill ran, and 275 ms at 13:19:28, when it had finished. The fill cost the database about eleven minutes at 78 to 100 per cent of its DTU, three of them at 100, with its log writes peaking at 99 per cent (the ninety minutes before 13:19 UTC, one reading a minute).
Then, from the operator's PC, ten words never typed on either site before (13:19:34 to 13:22:16 UTC):
Before, five words read 3,705 to 4,777 ms on the SQL site. Now a word is a seek: eight of the ten answer under 500 ms, and the two that do not are the two with the most matches, where the time goes on counting 24,000 and 26,000 rows, not on finding them.
The deep pages on the document store, the second read two minutes after the first started the walk (13:22 UTC): offset 40,000 in 29.3 RU and 269 ms in the store, 475 ms from the PC; 20,000 in 37.0 RU and 244 ms; 5,000 in 28.6 RU and 89 ms for the page itself. Before, 40,000 was 1,659 RU and 8,087 ms. The first read at each depth still pays the old price once while it keeps its places (1,657 RU at 40,000), which is the walk the addendum describes. The SQL site's deep pages read 187 to 232 ms, as before. The plan read 70 to 71 per cent after the roll, against 73 before.
The settled reading. Taken right before the .NET sites became one web app, so it stands for 1.0.3.183 on the four-app shape: settled for 0.6 hours since the 1.0.3.183 roll at 13:14 UTC, read at 13:52 UTC from the plan card on both domains, which agreed. The plan at 73 per cent, 2.56 of 3.5 GB; the SQL site 414 MB, the Cosmos DB site 367 MB, the rendering service 106 MB and The Shed 103 MB; the plan outside the apps 1,626 MB. Steve's word at 07:58 CDT was that everything happens today, so the reading the addendum planned for 06:47 UTC on 20 October, a day after 1.0.3.181, was not waited for; the merge's own readings are in ADR: One web app for every .NET process.
Addendum, 2026-10-20 (1.0.4.0): the store's facts behind one port
The store's own readings (the plan's figures, the load and the statistics the Admin tab draws) are now answered by one IStoreDiagnostics port that both adapters implement, so the host holds no adapter-typed member and asks the store what it is doing the same way on either (ADR: The onion cut into vertical slices, rule 4). What the store does is unchanged; where the answer is read from moved inward.
Enforced by
3 rules in the rulebook cite this record, each held by a test on every release.