No history yet

Architecture and Planning

Defining the Throughput Challenge

To scrape 100,000 LinkedIn profiles in five days, a simple script won't suffice. The core constraint is throughput. Let's break down the numbers.

Five days translates to 432,000 seconds. To process 100,000 profiles, our system must average one profile every 4.32 seconds. This rate must account for network I/O, page rendering in a headless browser, data extraction, and handling any anti-scraping countermeasures like CAPTCHAs or dynamic content loading. A single-threaded process, or even a single machine, will inevitably fail due to these bottlenecks and the risk of IP-based rate limiting.

The only viable solution is a distributed system that can execute tasks in parallel, allowing us to scale horizontally to meet the required throughput.

A Decoupled Architecture

The foundation of a scalable scraping system is the separation of concerns. We'll design our architecture by decoupling the management of tasks from the execution of those tasks. This creates a clear distinction between a control plane and a data plane.

  • Control Plane: This is the orchestrator. Its sole responsibility is to manage the queue of 100,000 target profile URLs. It enqueues the tasks and can be used to monitor progress, handle retries for failed tasks, and manage the overall state of the job.
  • Data Plane: This is the workforce. It consists of numerous stateless worker nodes. Each worker pulls a single task (a profile URL) from the queue, executes the scraping logic using a headless browser, and pushes the extracted data to a persistent storage layer.

This separation is critical. If a worker in the data plane crashes, the task is not lost; it can be requeued and picked up by another worker. If we need more throughput, we simply add more workers to the data plane without altering the control plane. For this architecture, we will use Celery as the distributed task queue and Redis as the lightweight message broker that facilitates communication between the planes.