← Salesforce Interview Insights

Salesforce·Machine Learning Engineer·Technical Phone Screen·Senior

Senior
May 2026

Summary

Salesforce ML Engineer interview that was basically a systems/coding round disguised as a Python exercise. One meaty implementation question plus a follow-up design discussion, which I wasn't fully expecting.

Questions Asked (2)

Q1

Build a small web crawler in Python that takes a start URL, a max depth, and an output CSV path. It should stay within the same domain, fetch pages concurrently, extract URL, title, and HTTP status code from each HTML page, deduplicate by normalized URL, skip non-HTML resources, sort results by title then URL, and write everything to a CSV.

System DesignAlgorithms & Data StructuresTechnical Trade-offs
Author's notes

This looked manageable until I started thinking about URL normalization and what 'same domain' actually means when you have subdomains, redirects, trailing slashes.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements and constraints, then outline a modular design with separate components for URL management, fetching, parsing, and output. Discuss concurrency using asyncio and aiohttp, and explain how you handle deduplication, domain restriction, and sorting. Finally, mention trade-offs and potential extensions.

Pro tip: Emphasize politeness and robustness: implement rate limiting and respect robots.txt to avoid overwhelming servers, and handle exceptions gracefully to ensure the crawler doesn't crash on malformed pages.

1. Clarify Requirements and Constraints

Ask about expected scale, politeness policies, and whether JavaScript rendering is needed. Confirm that only HTML pages are processed and that concurrency should be bounded.

2. Design Architecture

Outline a modular design: a URL frontier (queue) with deduplication, a fetcher using asyncio and aiohttp with a semaphore for concurrency control, a parser using BeautifulSoup or lxml, and a CSV writer.

3. Implement Core Logic

Describe how to normalize URLs (e.g., remove fragments, sort query params), enforce same-domain restriction, skip non-HTML via Content-Type header, and extract title and status code.

4. Handle Concurrency and Depth

Use asyncio.Queue for BFS traversal, track depth per URL, and use asyncio.gather with a semaphore to limit concurrent requests. Ensure proper error handling and timeouts.

5. Output and Sorting

Collect results in a list, sort by title then URL, and write to CSV using the csv module. Discuss memory considerations for large crawls.

Key Points to Mention

  • URL normalization techniques (e.g., lowercasing scheme/host, removing default ports, sorting query parameters)
  • Concurrency model: asyncio with aiohttp and semaphore for bounded parallelism
  • Domain restriction: compare netloc of parsed URLs to the start URL's netloc
  • Content-Type checking to skip non-HTML resources (e.g., images, PDFs)
  • Deduplication using a set of normalized URLs and a visited set
  • Trade-offs: memory vs. speed, politeness (rate limiting, robots.txt), and error handling

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q2

What are the main edge cases in a web crawler like this, and how would you evolve it into something production-ready?

System DesignTechnical Trade-offsAPI & Integrations
Author's notes

Talked through politeness delays, robots.txt, retry logic with backoff, and handling circular redirects.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the crawler's purpose and scale, then systematically cover edge cases across crawling, data handling, and system reliability. For production readiness, discuss architectural improvements like distributed crawling, robust storage, and monitoring, tying them to ML data pipeline needs.

Pro tip: Emphasize that production crawlers must handle politeness and legal compliance (robots.txt, rate limiting) and that data quality directly impacts ML model performance, so validation and deduplication are critical.

1. Clarify scope and assumptions

Ask about the crawler's target sites, scale, and data usage to tailor edge cases and production requirements. Confirm whether it's for ML training data, which implies needs for freshness, diversity, and labeling.

2. Identify edge cases

Enumerate edge cases in crawling (e.g., dynamic content, infinite loops, traps), data handling (e.g., duplicates, encoding issues), and system failures (e.g., network errors, crashes). Prioritize based on impact.

3. Propose production enhancements

Suggest architectural changes: distributed crawling with queues, scalable storage (e.g., data lakes), and monitoring/alerting. Include ML-specific needs like data versioning and feature extraction pipelines.

4. Discuss trade-offs and metrics

Highlight trade-offs between speed, coverage, and politeness; and between data freshness and cost. Define success metrics like crawl rate, data quality, and model performance impact.

5. Summarize and connect to ML

Recap key points and explicitly link how a production-ready crawler supports ML workflows, such as providing clean, timely data for training and inference.

Key Points to Mention

  • Handling dynamic content (JavaScript-rendered pages) and anti-bot mechanisms
  • Politeness policies: robots.txt, rate limiting, and user-agent identification
  • Data quality issues: deduplication, normalization, and schema validation
  • Scalability: distributed architecture, fault tolerance, and incremental crawling
  • Monitoring and observability: logging, metrics, and alerting for crawl health
  • ML integration: data versioning, feature store updates, and feedback loops

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.