The situation
Quandoo hired me to build the Market Catalog from scratch: a monthly view of every restaurant in Quandoo’s markets, so the sales team could spot new openings, track changes and prioritise leads. There was no existing project, and the BigQuery project it would live in was empty.
Designing a warehouse from an empty project
I designed the Market Catalog warehouse in BigQuery, including the master table of restaurants that every source feeds into.
Building extraction pipelines for many sources
The catalog pulls from many websites every month, through APIs and scrapers. Each source is an Apache Beam pipeline on Dataflow, with CI/CD and tests in GitLab, dashboards in Google Data Studio and alerts on runs and data. The results go back into Salesforce, where the sales team works.
Refactoring a pre-existing scraper to optimise a three-day run down to 45 minutes
A pre-existing scraper ran as a single Kubernetes job on GKE. A full run took about three days, and it often failed on memory before finishing. When it failed, the catalog was late or incomplete, and a rerun cost another three days.
Why it was slow
The job did one thing at a time: open a page, read it, move to the next. But each restaurant page is independent of the others. This is work that can be split almost without limit, and the job wasn’t using that. Giving one pod more resources doesn’t change that.
So the fix was to change how the work was split, not to give it more resources.
The redesign
I redesigned the scraper as an Apache Beam pipeline on Google Dataflow, in three stages:
- Generate listing pages for each city: 76 cities across 13 countries.
- Extract restaurant URLs from every listing page.
- Scrape each restaurant profile: about 40 attributes, including address, location, contact details, price range, rankings, rating breakdowns, cuisines and reservation partner.
Dataflow spreads the last two stages across workers, scaling to more than 600 at peak.
Running a browser on hundreds of workers
The pages needed a real browser, so each Dataflow worker ran headless Chrome with Selenium inside a custom worker container. That brings its own problems, so I added guardrails:
- The Chrome driver restarts every 30 requests to avoid memory leaks, and is health-checked through its process ID.
- Chrome and plain HTTP requests have separate retry limits and timeouts.
- User agents rotate between requests.
- Writes to GCS retry with exponential backoff on transient errors.
- Chrome versions are pinned in the Docker image so a browser update can’t break a run.
Knowing what failed
A fast pipeline is only useful if you can trust its output. Every profile gets a row in a partitioned BigQuery status table, marked completed or failed, and failed profiles are reported after each run. The scraped data lands as JSON in GCS, one folder per run.
Three ways to run it
- Monthly: all markets, for the catalog.
- Single city: on demand, for example when Quandoo entered a new market.
- Salesforce run: sales associates flag accounts or leads in Salesforce, and the pipeline scrapes only those records. Deleted and converted records are skipped.
Shipping it safely
The pipeline is packaged as a Dataflow Flex Template. GitLab CI runs unit tests on every merge request, plus an end-to-end test that launches a real Dataflow job and checks that BigQuery matches the files in GCS. The same CI publishes the template and the container images.