ASAD PAVEL

SELECTED WORK // ENGINEERING FILES

CASE STUDIES

Five systems, the decisions behind them, and what happened in production. No slide-deck architecture — just the problem, the trade-offs, and the result.

01 // COINREAD

Improving Market Data Accuracy by 85% with Outlier Detection and Trust Scoring

Lead Software Engineer · Go, microservices, Prometheus, Kubernetes, in-memory caching

The problem

Coinread aggregated raw tickers from many exchanges, and the aggregated price fed downstream products and market-cap rankings. Exchanges can report zero or missing prices, distorted quotes on thin markets, or wrong symbol mappings, and one bad ticker could skew a coin's aggregate price and shift its rank. In a market-data product, that is a trust problem, not just a quality problem.

My role

I designed and built the outlier-detection service in Go, including the voting logic and all of the drivers. It sits between the raw-ticker service and the aggregation service: it examines every raw ticker and republishes only the ones it trusts. I also built most of the trust service with another engineer. It produces the scores that decide how much weight each exchange carries in the final price.

Approach

I made outlier detection its own microservice, so aggregation only ever sees filtered data. Every 60 seconds (or on demand for backfills) it:

  1. Pulls all raw tickers and skips the run if the dataset timestamp has not changed.
  2. Pre-validates each ticker: a missing symbol or a bad or zero USD price is marked invalid and treated as an outlier immediately.
  3. Fans out by symbol to a pool of four workers, enriching each symbol with rank, supply, and competitor data from the symbol service.
  4. Runs independent driver checks concurrently per symbol: standard drivers first, then must-pass drivers against the survivors only.
  5. Tallies the votes and republishes only the inliers, normalized, to the aggregation topic.

Each driver is a different way of detecting bad data, so they fail in different situations:

DriverScopeWhat it flags
mad-geckoLocal (across exchanges)Prices more than 10 median absolute deviations from the cross-exchange median; fails closed when prices are too uniform to measure.
median-priceGlobal (history)Price more than 40% away from the symbol's 24-hour historical median.
rank-cutoffGlobalA candidate whose implied market cap exceeds that of a boundary ticker ranked 400 to 500.
rank-disruptionGlobal, optional must-passMarket-cap rank drift beyond a tiered allowance: 5 places for ranks 1 to 20, up to 50 for ranks 151 to 400, unlimited above 400.
competitor-rankGlobal, optional must-passRank drift measured against the median rank of competing symbols.

Decision rule: a ticker is an inlier if at least one driver allows it. The three rank-type drivers count as a single vote so they cannot outvote the statistical checks, and any enabled must-pass driver can veto a ticker unconditionally.

Trust scores: outlier votes decide which tickers survive, and trust scores decide how much each surviving exchange counts. A separate trust service scores exchanges and markets against reference exchanges such as Binance, Kraken, and Bitstamp, using order-book quality (bid/ask spread and depth within 2%, weighted 0.5) and website traffic (weighted 0.2). Each measure is the distance from the reference median in MAD units. The aggregation service turns a score into a discount rate (100 minus the score, cached for six hours) that scales each exchange's volume before the volume-weighted price is calculated. A currency's tickers stay blocked until its trust data has been calculated.

Challenges

  • Failing safely: a driver error marks the item an outlier, and having no drivers marks everything an outlier. Bad data never leaks through, at the cost of dropping good data during a fault.
  • Expensive rank checks: the rank drivers need a candidate price, which means an on-demand call to the aggregation service. I cached those results for 15 minutes by content hash, de-duplicated concurrent calls with singleflight, and cached symbol, ticker, and boundary-ticker lookups for five minutes.
  • A leaking detector: a streaming anomaly detector (KS, diff, and CDF tests, flagging above 0.7 anomaly probability) leaked memory, so I disabled it rather than ship it. A historical-mean driver is also switched off.
  • Too little data to judge: statistics across exchanges are meaningless for a coin on one exchange. Local drivers are skipped unless the symbol has at least two pairs and two exchanges.
  • Explaining decisions: every run keeps per-symbol Prometheus counters for inliers, outliers, and invalid tickers, and can optionally produce an XLSX report so a surprising exclusion can be traced to the driver that caused it.

Results

  • Overall data accuracy improved by 85%.
  • Aggregation reads only the filtered set, so one misbehaving exchange can no longer skew a symbol's price or rank.
  • Drivers, thresholds, and the must-pass rules are configurable, so tuning does not need a redeploy of the detection logic.

What I learned

Several cheap, independent checks that vote beat one clever detector, and a veto rule covers the cases where consensus is wrong. The stateful detector was the hardest part to run reliably, which is why I would start with simple robust statistics like median and MAD.

02 // COINREAD

Cutting $40,000 a Year in Cloud Costs Across AWS and GCP

Lead Software Engineer · AWS, GCP, Terraform, Kubernetes, Docker, Datadog, Prometheus, Grafana

The problem

A data-heavy product on two clouds tends to accumulate waste: oversized servers, forgotten resources, and storage nobody revisits. Cloud spend was growing faster than the value it delivered.

Approach

  1. Audit first. I inventoried compute and storage across AWS and GCP and mapped each resource to the service that used it.
  2. Use real utilization data. Using existing monitoring (Datadog, Prometheus, Grafana), I compared provisioned capacity with actual usage.
  3. Right-size and clean up. I resized over-provisioned servers, removed idle resources, and optimized how storage was used. Compute and storage were where most of the savings came from.
  4. Keep it codified. Changes went through Terraform and Kubernetes charts so savings did not drift back.

Challenges

Cutting cost without hurting reliability. For a market-data product, performance regressions were not acceptable, so changes were made incrementally and watched through monitoring. I tested smaller instance sizes under realistic load before touching production, and rolled back one change that caused memory pressure.

Results

  • $40,000 saved annually across AWS and GCP.
  • A clearer picture of where infrastructure money went, which made future capacity decisions easier.

What I learned

The biggest savings came from simply looking. Regular cost reviews beat one-off clean-ups.

03 // ALLRITES

From 4+ Seconds to Sub-Second Page Loads, Plus a Multi-Region IaC Rollout

DevOps Engineer (Contract) · Sep–Dec 2022 · 8 developers, 1 QA, 1 Jira coordinator · PHP (Laravel), PHP-FPM, nginx, OPcache, Vue.js, Node.js, Redis, MySQL, Pulumi, AWS, Kubernetes, GitHub, AWS CodePipeline

The problem

Pages regularly took over four seconds to respond, and one frontend page froze the browser because it rendered too many Vue.js Bootstrap checkboxes. The backend ran PHP as mod_php under Apache with slow database queries, critical framework patches were outstanding, and the code lived on Bitbucket with a pipeline that needed work.

My role

I joined as the contract DevOps engineer alongside a core team of eight developers, one QA, and one Jira coordinator. I owned performance, infrastructure, security, and the delivery pipeline.

Approach

  • Frontend freeze: the page froze because it rendered too many Vue.js Bootstrap checkboxes at once. I replaced them with a lighter control built from plain HTML and CSS, and paginated the list based on the viewport so only the items in view are rendered.
  • Slow queries: I optimized the database queries behind the slowest pages. The worst offenders were unindexed queries that ran on every page load and API call, even for non-admin users who did not need the data.
  • PHP runtime: I moved from mod_php on Apache to PHP-FPM behind nginx and turned on OPcache. PHP-FPM runs PHP in its own worker pool, nginx handles many connections cheaply, and OPcache stops PHP recompiling scripts on every request.
  • Infrastructure as code: I set up a multi-region Kubernetes cluster on AWS with Pulumi, so the environment can be recreated from code.
  • Delivery: I moved the repositories from Bitbucket to GitHub and improved the CI/CD pipeline.
  • Security: I added a Web Application Firewall, set up a bastion host as the controlled entry point for administrative access, and applied critical patches to the backend framework. I also configured CSP, CORS, HSTS, and X-Frame-Options.

Challenges

The contract lasted four months, and my changes had to land without blocking a team of ten people shipping features. Changes to the web server, the PHP runtime, and the infrastructure touch everything, so they needed testing before release. I rolled changes out through staging first, so they could be checked before reaching production.

Results

  • Response times dropped from over four seconds to sub-second.
  • The checkbox page no longer freezes the browser.
  • Multi-region infrastructure that can be recreated from code.
  • A WAF, a bastion host, and security headers (CSP, CORS, HSTS, X-Frame-Options) in place, and critical framework patches applied.
  • Code on GitHub with a stronger CI/CD pipeline.

What I learned

Slowness rarely lives in one layer. The freeze was in the browser, while the slow responses came from queries and PHP's runtime, and each needed its own fix. I would profile both ends before choosing where to start.

04 // CRUISE SHIP OPERATOR

Running Ship Automation, Billing, and Attendance on Kubernetes at 99.9% Uptime

Developer and infrastructure engineer · Kubernetes (bare-metal cluster), Docker, Go, Python, PostgreSQL, Redis, Prometheus, Grafana

The problem

A cruise ship needed its core onboard systems — ship automation, billing, and crew attendance — to stay available while at sea, where connectivity is limited and on-site support is hard to get.

Approach

I worked alongside another engineer on this project. I designed and deployed a Kubernetes cluster to host all three systems, so they share one platform with consistent deployment, restart, and recovery behavior.

  • Self-healing workloads: failed services restart automatically without manual intervention.
  • Repeatable deployments: releases through GitHub Actions so updates are predictable.
  • Working without internet: everything runs on the ship's own servers, so billing, attendance, and automation do not need a connection. Data is queued locally and synced to shore when the satellite link is up, instead of failing when it drops. Images and updates are cached on board, so a deploy never depends on pulling from the internet at sea.
  • Failover: the cluster has several nodes, so if one machine dies, Kubernetes reschedules its workloads onto the others. Databases run with replication, and health checks restart crashed services automatically.
  • Data safety: backups are stored off the main nodes, with a restore I tested. Databases use persistent volumes, so a restarted pod does not lose data. Billing records are written to the database before anything else happens, so no transaction is lost in a crash. Prometheus and Grafana monitor disks and nodes and raise alerts before something fills up or fails.

Challenges

  • Operating with unreliable or limited internet. I made every system work without the internet. Everything ran on the ship's own servers, and the satellite link was only needed to sync data to shore.
  • Mixing very different workloads (real-time automation versus billing) on one cluster. I separated the systems with Kubernetes namespaces, so each one had its own boundary within the shared cluster.

Results

  • 99.9% uptime across ship-wide systems.
  • A single maintainable platform instead of separate ad-hoc servers.

What I learned

For environments where you cannot simply "go fix it," reliability has to be designed in, not patched on.

05 // PERSONAL PROJECT

Building a Custom DSL That Compiles to Factorio Circuit Blueprints

Creator and maintainer · JavaScript, HTML5, CSS3, Cloudflare Workers, GitHub Actions ·factorio.iampavel.dev

The problem

Factorio's circuit network is powerful, but building a large circuit by hand is tedious, because every combinator has to be placed and wired one at a time. Players wanted display gauges, upcycling calculators, and repeatable circuits without doing that work manually.

Approach

  • Browser-based tools that need no install or sign-up: blueprint generators, display gauge generators, and quality upcycling calculators for Factorio 2.x.
  • A custom domain-specific language (DSL) that works in both directions.Readable circuit text compiles into game-ready blueprints, and an imported blueprint is converted back into DSL automatically.
  • A five-stage parser that returns a semantic model instead of a syntax tree:
    1. Lower the shortcuts: REPEAT, LUT, MATH, and => expand into core blocks, and every generated line keeps its source line number.
    2. Scan blocks: a line-oriented scanner where a header word opens a block and the next header closes it. Half-typed headers are skipped rather than reported.
    3. Parse each block kind: deciders, arithmetic, constants, selectors, and entities each have a small parser. Deciders have their own tokenizer for comparators, wire and quality filters, and literals.
    4. Resolve late: wires and asserts resolve after all blocks are read, so forward references work, and port rules are enforced here.
    5. Emit the model: nodes, wires, parameters, and asserts, plus a list of errors with line, message, and severity.
  • A blueprint builder that turns the model into a Factorio blueprint: columns laid out depth-first, wires as entity and connector pairs, relay poles added automatically for long spans, and the result serialized as zlib-compressed JSON in base64. The same program always produces a byte-identical blueprint.
  • Layered tests using the Node test runner: parser tests pin the exact model and every error message; builder tests pin positions, entity numbers, wires, and encode/decode round trips; a fixture from headless Factorio 2.1.9 pins the real game keys; ASSERT blocks run on a circuit simulator; a sweep checks every shipped template; and a formatter test checks canonical output. A browser end-to-end test skips itself when no Chromium is available.

Challenges

  • Forgiving but exact: people write circuits one line at a time, so one bad or half-typed line should not break the whole file. I chose a line-oriented scanner and a semantic model over a full grammar and syntax tree: one pass, cheap error recovery, and line errors an editor can show. Unknown signals produce a warning and pass through instead of stopping the build.
  • Errors that point at the user's text: expanding shortcuts normally scrambles line numbers, so every generated line keeps its original source line, and errors still land on what the user typed.
  • Matching the real game: the output has to import into Factorio. A fixture made by importing a blueprint into headless Factorio 2.1.9, with keys checked against a real export instead of guessed, pins the format.

Results

  • Used by players and Twitch streamers.
  • 16,000 unique visitors in the last 30 days (measured on 02 December 2026).
  • Every shipped template is tested: it has to parse cleanly, build, and pass its own embedded asserts.
  • Deterministic output: the same program always produces a byte-identical blueprint.

What I learned

Testing in layers (parser shape, real game keys, simulated behavior) made it safe to keep adding features. Being forgiving about input while strict about output mattered as much as the language design itself.