Make a slow property-search API measurably faster and cheaper: measure it at its Monday peak with an open-model load test derived from real traffic, find where each request's time goes with Server-Timing, metrics, flame graphs, statement statistics and query plans, fix nine problems (a missing index, N+1 queries, deep pagination, blocking work on the event loop, oversized payloads, a starved pool, a call without a deadline, an unbounded cache, a repeated aggregation), prove each fix with a bootstrap interval, plan capacity with a fitted model and gate regressions, all locally.
Performance Engineer. Advanced.
For engineers who read Python and SQL, run Docker Compose and want to make a slow API measurably faster: percentile budgets at a stated load, open-model load tests from real traffic, flame graphs, query plans and statement statistics, fixes for indexes, N+1 queries, pagination, pools, deadlines, memory and caching, each proved with a confidence interval, then a capacity plan and regression gates.
In this project you take a slow web API and make it measurably faster and cheaper: you measure it under a realistic load, find where each request's time goes, fix nine problems one at a time, prove each fix with statistics rather than a single run, size its resources and plan its capacity, and set up gates that stop regressions. Everything runs on your own computer with Docker Compose: the API, PostgreSQL, a valuation service it calls, Prometheus, Grafana, a load generator an
Larkhaven's listings API answers property searches from the website and two apps. At the Monday-morning peak, search's 95th percentile reaches 2.4 seconds against a 300 ms target; the team has doubled the number of API instances twice, rent estimates sometimes take ten seconds, and memory grows all week until a Sunday restart. Your job is not to add servers but to find out why each request is slow, fix it, and prove each fix.
Larkhaven's product team opened the project with "search is too slow on Monday mornings". That is a symptom, not a requirement: you cannot test it, and you cannot tell when you are done. This lesson turns the complaint into budgets you can measure, and shows how the API measures each request so you can see where its time went.
A load test is a model of your users. If the model is wrong, the numbers it produces are precise and meaningless: the right rate with the wrong requests, or the right requests sent in a way real users never would. This lesson covers the two ways a load generator can behave, why one of them hides the tail you are trying to measure, how Larkhaven's workload was built from traffic rather than guessed, and what to check before trusting a run.
Server-Timing told you a request spent 57 ms in Python and 4 ms in SQL. It cannot tell you which Python. A profiler can: it records which functions were running, how often, and what called them. This lesson shows how to profile a running async service without changing or restarting it, how to read a flame graph, and the problem this project's profile exposed: a loop that stalls every other request on its worker.
With the original code, Server-Timing on a search of the largest town reads db;dur=92.0: almost the whole request is one SQL statement. The statement is four lines long and looks innocent. This lesson shows how to ask PostgreSQL what it actually did with it, how to read the answer, and how to design an index from the query rather than from the table.
After the index, search's page query takes under a millisecond. Yet with P1 off, Server-Timing still shows db;dur= in the tens of milliseconds for a search, and the dashboard's "SQL statements per request" panel shows 41 for /search. No single statement is slow. This lesson is about the cost that does not appear in any query's plan: the trip to the database and back, paid once per statement.
Two problems in this lesson have the same shape: the API asks the database for far more than the response needs and throws the rest away. OFFSET pagination makes PostgreSQL produce and discard every earlier row; SELECT * fetches a kilobyte of description per row that the search results never show, and then the rows are serialised three times. Both are invisible on page 1 of a small result and expensive at scale.
Larkhaven doubled its API instances twice and the Monday peak still missed the budget, while the instances' CPUs sat half idle. That is the signature of a bottleneck that is a count, not a speed: requests queue for something there are too few of. This lesson covers the two places that happens in the API, the database connection pool and the HTTP client for the valuation service, and the arithmetic for sizing one and bounding the other.
Larkhaven's API starts a week at about 250 MB of resident memory and ends it much higher, never falling, until operations restart it on Sunday "to be safe". Nothing fails and latency is fine, so the restart has become a habit. This lesson is about reading that growth: what kinds of memory a process has, what a steady climb that tracks traffic means, how to find the code holding the memory without guessing, and the bounded cache that replaces the restart.
Some work is worth doing once. The rent summary (median and 90th-percentile rent for every town and bedroom count) sorts every active listing's rent on every request, for an answer that changes a few times an hour. Listing details are read many times between edits. This lesson is about recognising that shape, the two tools for it in this project (a bounded in-process cache and a materialised view), and the questions that keep reused answers correct.
"Add servers" was Larkhaven's first answer, twice, and it did not work, because the bottleneck was not the number of servers. Now that each request costs what it should, the question returns in its proper form: how many instances does the Monday peak need, with how much headroom, and what does each thousand requests cost? This lesson turns a concurrency ramp into a fitted model, checks the model honestly, and reads instances and cost off it.
Every fix in this project was proven by a comparison, and every one of them can be undone by a future change that nobody measured. This lesson is about the statistics behind "better", "worse" and "cannot tell", and the two gates that apply them: micro-benchmarks in CI on every pull request, and load comparisons on the lab host.
Starting point: a computer with Docker. End point: you know it has the CPUs, memory, disk and free ports the lab needs.
Starting point: the source folder and a working Docker. End point: .env with random passwords, both images built, every service healthy, 400,000 listings loaded, and the API running the original code.
Starting point: the lab running the original code. End point: a recorded run at the Monday peak and two at a trickle, with budgets checked and a first row in perfctl runs.
Starting point: runs of the original code. End point: you have seen one request's Server-Timing, the statements PostgreSQL spends its time on, and search's query plan with its sequential scan.
Starting point: the lab running. End point: two flame graphs in .lab/profiles/ and the busiest frames in text; SYS_PTRACE removed again.
Starting point: the original code measured. End point: the API running all nine fixes with the schema matching, a closed-model ramp over eight concurrency levels, and a plan: one instance's capacity within the budget, the instances the Monday peak needs, and the cost per 1,000 requests.
Starting point: every fix on and the capacity plan in hand. End point: three runs at one instance's share of the Monday peak recorded, and every budget met on their median.
Starting point: every fix on and the budgets met at the share. End point: for each fix, a comparison of three interleaved runs with it against three without it, with an interval and a verdict.
Starting point: every fix on. End point: two ten-minute runs at the morning rate, with and without the bounded cache, their RSS growth and cache sizes recorded, and a traced run attributing the memory to the code that allocated it.
Starting point: the leave-one-out runs recorded. End point: the micro-benchmarks timed, the macro gate failing on the without-P1 runs and passing on two sets of the same version.
Starting point: the lab running. End point: scripts/lab-check.sh has run every stage unattended and left its evidence under .lab/, and the offline checks (format, lint, strict types, unit and database tests, the workload derivation) have passed in the toolbox.
Starting point: a lab you stopped, or finished with. End point: either the lab running again with its data, or nothing left: no containers, volumes, network, images, .lab/ or .env.
Learning Access: INR 199 plus 18% GST. Source Pack: INR 399 plus 18% GST. 90 days of online access. No auto-renewal.
Runs entirely on your machine with Docker Compose: about 1.5 GB of container images and a 400,000-listing synthetic database generated locally. The valuation service the API calls is a local emulator, so no cloud account, payment method or hosted lab is used or included. The lessons' numbers were measured on an 8-CPU virtual machine; reproducing them exactly on cloud hardware is optional and would be paid to that provider. Running the optional CI workflow uses your own GitHub Actions minutes.
Vectametric Project Source Licence (2026-09-27): lawfully obtained source may be copied, modified and deployed for personal learning and interview preparation, including personal portfolio demonstrations with attribution. These permissions continue after online access expires. Do not resell or redistribute the Source Pack or its original source files, unchanged or modified. Commercial or client production use requires separate written permission. Packages and container images downloaded when building or running, such as FastAPI, psycopg, PostgreSQL, k6, py-spy, Prometheus and Grafana, retain their own licences. See LICENSE.txt and the Project Source Licence section of the site Terms for the full rules.
You can read the project material without deploying it. Running a cloud build requires the accounts, permissions and tools listed in that project's prerequisites. Deployment runs in your environment, not in a hosted Vectametric lab.
Yes. Learning Access includes the online source-file browser and explanations. The Source Pack adds the downloadable reference repository where available. The project's licence governs use of the source.
No. Cloud and CI usage are separate. Read the project's cost notice, set a budget and stop deadline, and follow its destruction and leftover-resource checks.
The project curriculum lists the available scenarios and interview topics. These focus on understanding the architecture and explaining decisions; they are not a promise of particular interview questions or a job.
The project page and checkout show the online access period for your selected plan. Access does not auto-renew. Downloaded source remains subject to its licence; future releases are not automatically included.
Review the Terms and No-Refund Policy before confirming access. All sales are final; Vectametric does not offer refunds.
Vectametric home · Roadmaps · Vecta IT Exams · Vecta Government Exams · Vecta Banking & Finance Exams · Vecta Entrance Exams · About us · Contact · Privacy Policy · Terms and Conditions · No-Refund Policy