Skip to content

Publication

Reducing marginal cost per visit in the Law Observatory

How a service approaching its operating limit moved to a bounded-cost model through caching, compression, and selective invalidation.

Ariel Eitner2026-09-169 min read

An analysis of the architecture that raised cost per visit in a public legislative-data service, and the interventions that reduced unnecessary transfers, renders, and invalidations.

Before opening the paper

Problem
With 8,034 regulations and 90,945 articles, the Observatory faced suspensions caused by operating cost. The backend received roughly 1,600 requests per hour for 46 visits: cost was not a function of traffic, but of design.
Resolution
Cacheable CDN delivery was restored, responses were compressed with Brotli/gzip, full invalidation was replaced with deltas, and reference resolution was precomputed on the server.
What you will find
The PDF documents the cost model, experimental diagnosis, interventions, link-fingerprint verification, and results. It includes limitations and projections without claiming a future bill before the post-deployment cycle.

01When cost does not follow traffic

When cost does not follow traffic

The starting point was an August 2026 cycle with USD 18.98 spent against a USD 20 cap. The three targeted categories accounted for 78% of the total, but traffic alone did not explain that operating pressure.

The system served roughly 46 visits per hour while the backend received close to 1,600 requests per hour. The gap showed that apparently static pages were regenerating and transferring far more data than necessary.

02Layered diagnosis

Layered diagnosis

The cache hierarchy prevented pages from being served from the CDN. In addition, every page included a full regulation dictionary: one case reached 1,100 kB and represented 94.6% of the HTML. Updates invalidated the entire site, and the backend delivered uncompressed responses.

Partial client-side citation resolution added extra lazy downloads. Measuring each layer avoided treating cost as a single symptom and made it possible to prioritise changes that reduced repeated work.

03Interventions on transfer and work

Interventions on transfer and work

The first intervention restored cacheability and CDN delivery. Brotli/gzip compression was then negotiated, with Brotli quality 5 selected as the balance between reduction and CPU.

Full invalidation was removed from the protocol and replaced with incremental delta updates. Finally, reference resolution moved to server-side precomputation; the full dictionary remained a lazy load for the cases that actually require it.

04Results and verification

Results and verification

Across a sample of twelve pages, HTML fell from 47,523 kB to 14,924 kB: 68.6% less. An article page dropped from 2,796 kB to 65 kB, and the home page from 2,830 kB to 95 kB. The navigation endpoint was reduced from 2,492,565 B to 7,147 B raw and 2,520 B with Brotli.

The projection for a full crawl fell from approximately 57 GB to 3 GB. To detect silent regressions, a link fingerprint verifies citation resolution and preserves self-references correctly. The paper distinguishes these measured results from final billing validation, which belongs to the cycle after deployment.

Related project

Observatorio de Leyes Argentinas

This article covers publishable technical decisions. It does not include private data, credentials, or exploitable security details.

For local legislation management, explore FARO, a digital municipal legislation platform (Spanish).

Download PDF