↓ Ir para o conteúdo principal

← todas as notas

📎 Webclip

Elixir Developer Interview Questions: Hand the Candidate Broken Code

The text argues that effective Elixir interviews center on broken code and production-style failures instead of definition questions. Strong loops at KORE1 rely on three scenarios: finding design faults in a GenServer cache on paper, reasoning about supervision after repeated crashes, and working through database pool contention when an external call slows down. The goal is to test how candidates think about reliability, supervision trees, and resource limits in real systems rather than how well they recite terms.

Definition questions about GenServers, the BEAM, or “let it crash” only reveal what someone has read, since hobbyists and seasoned on-call engineers give the same confident answers. Because Elixir ranks high in developer admiration surveys, experienced developers tend to stay put, so hiring loops that waste their time lose them to other opportunities. The article discloses that KORE1 earns fees on successful placements and suffers directly when an engineer cannot keep services stable.

The author recommends printing a short GenServer that caches exchange rates and giving the candidate 10 minutes in silence. That module hides six faults: a blocking HTTP call inside the callback that stalls all callers behind the slowest request until timeouts fire, unsafe String.to_atom on user input that can exhaust the atom table, a crash on a failed request that wipes the in-memory map and triggers a thundering herd of refetches, lack of expiry for inherently time-sensitive exchange rates, using a single process for every read where ETS would avoid the queue, and missing status checks that can cache a bad error page as a rate. Strong candidates begin by asking what the cache is for, quickly identify the blocking call and atom usage, and only a few notice the silent poisoning from absent status validation.

When asked to rewrite the cache, strong answers move slow fetches out of the synchronous read path, for example into a Task under a Task.Supervisor or into a dedicated refresher process. They place rates in ETS, store an expiry per rate, and explicitly discuss what callers should receive when data is stale and the external service is unavailable, making clear that this decision belongs to the business. The interview is framed as a conversation about trade-offs, not just syntax changes.

The second scenario explores supervision behavior after repeated crashes. The article describes a worker in a small supervision tree that crashes 4 times in 5 seconds. With the default supervisor settings of 3 restarts in that window, the 4th crash forces the supervisor to shut down, stop all children, and exit. In a mix release where applications run in permanent mode, this failure can bubble up and terminate the entire node, bringing down endpoints and database pools because of a single unstable card processor.

Strong candidates respond by isolating risky workers into their own subtrees so that giving up only affects one branch, adjusting restart intensity or adding backoff when failures come from external services likely to recover, and questioning whether the worker needs restarting at all. In contrast, a weak response stops at “it restarts” without engaging with escalation or containment in the tree.

The third scenario focuses on Ecto pool limits and external latency. With Ecto’s default pool of 10 connections, a checkout flow that opens a transaction, inserts an order, calls a card processor, and then updates the order will seize the pool once the processor slows to 8 seconds. The article notes that 10 connections divided by 8 seconds caps throughput at about 1.25 checkouts per second. Other queries wait in the queue and ultimately fail, even for pages unrelated to checkout, because they share the same pool.

A strong candidate works the math out loud, then moves the external call outside the transaction and clearly names the trade-off that orders may exist without completed charges. More advanced answers add an idempotency key to prevent duplicate charges on retries. Weak candidates suggest increasing the pool size to 50, which only shifts the bottleneck to the database instead of solving the design issue.

The author advises tailoring which questions you use by team role. For real-time features like chat, presence, and live dashboards, the priorities are process mailboxes, LiveView memory, and node behavior overnight. Payments and settlement roles should emphasize supervision, multi-node setups, and duplicate-job scenarios. Phoenix product teams should cover database pool behavior and LiveView memory, illustrated by an example of 500 rows per LiveView across 4,000 users, which multiplies into about 2,000,000 row copies or roughly 4 GB at 2 KB per row, with streams as the usual mitigation.

For Rails-to-Elixir migration teams, the recommended loop includes the printed GenServer module, the pool scenario, and one judgment-focused question. The article warns that this loop suits seats responsible for production Elixir systems and does not match early-career hires still grasping basics like pattern matching, where simpler code exercises reveal more than advanced fault-tolerance discussions.

The piece closes by describing KORE1’s work designing interview loops that measure judgment instead of vocabulary, and by citing metrics such as a 17-day average from intake to accepted offer in IT searches and a 92% one-year retention rate, while noting that Elixir searches generally take longer. It suggests taking a complex module from your own codebase, removing timeouts, supervision, and comments, printing it, and observing what a finalist asks before changing any code. The gaps in what they notice indicate which topics to schedule next, and the author mentions a fuller guide that contrasts strong and rehearsed answers and covers supervision and partition questions in more depth.

Reading notes
#

  • Argues that the best Elixir interview questions present broken code and ask candidates to reason about behavior and fixes instead of reciting definitions.
  • Notes that definition questions about GenServers, the BEAM, or “let it crash” cannot distinguish hobbyists from experienced on-call engineers because answers sound the same.
  • Points out that Elixir ranks highly in a 2025 Stack Overflow survey of admired languages, so many Elixir engineers stay in current roles and poor interview loops lose them.
  • Discloses that KORE1 is a recruiting firm paid on successful placements and that unstable hires force repeat searches, influencing the author’s interest in better screening.
  • Recommends printing a small GenServer that caches exchange rates and giving candidates silent time to inspect it, since it contains six specific design and reliability faults.
  • Describes the blocking fault: an HTTP request inside the GenServer callback serializes all callers behind the slowest fetch and triggers call timeouts while they wait.
  • Highlights atom-leak risk from using String.to_atom on caller input, since atoms are never garbage collected and the default table has a fixed upper bound.
  • Explains that a failed request raises, crashes the GenServer, and wipes the entire cache map, causing a restart with an empty state and a surge of simultaneous refetches.
  • Treats missing expiry as a direct bug for exchange rates, because stale data is unacceptable without explicit refresh logic.
  • Criticizes the design of using one process to serve every read and suggests that ETS would avoid the read queue by providing concurrent access.
  • Notes the absence of status checks that can lead to caching an error page as an exchange rate, which silently corrupts future lookups.
  • Observes that strong candidates ask about the cache’s purpose before reviewing code, find the blocking call first, often spot atom misuse, and rarely find the status-code issue.
  • Suggests that good rewrites offload slow fetches into Tasks under Task.Supervisor or separate refresher processes so reads stay fast.
  • Recommends keeping exchange rates in ETS with per-entry expiry metadata to manage staleness explicitly.
  • Emphasizes that the decision about what callers receive when data is stale and the external service is down is a business choice and should be discussed openly.
  • Presents a supervision scenario where a worker crashes 4 times in 5 seconds and the default supervisor, which tolerates 3 restarts, then shuts down all children and exits.
  • Explains that in a mix release with permanent applications, this supervisor exit can bubble up and shut down the entire node, affecting endpoints and database pools.
  • Notes that a single unstable card processor process can indirectly bring down the endpoint, the DB pool, and the whole node under default supervision semantics.
  • Reports that strong candidates propose isolating the risky worker in its own subtree so that failure only sacrifices that branch instead of the full tree.
  • Mentions that another strong response is tuning restart intensity or adding backoff when failures stem from external services likely to recover.
  • Adds that candidates should question whether a given worker needs automatic restarts, rather than assuming restarts by default.
  • Labels “it restarts” as a weak, incomplete answer that ignores cascading failures and supervision limits.
  • Lays out an Ecto pool example where a transaction wraps inserting an order, calling a card processor, and updating the order while using the default 10-connection pool.
  • Calculates that an 8-second card processor latency caps throughput near 1.25 checkouts per second with 10 connections, causing queue buildup and failures for other requests.
  • Notes that unrelated pages fail because they share the same limited database connection pool with the checkout flow.
  • States that strong candidates compute this throughput bound explicitly and then move the external call out of the database transaction.
  • Describes the trade-off of moving the external call as allowing orders to exist without charges, a risk good candidates name and discuss.
  • Observes that stronger answers add idempotency keys so retries cannot double-charge customers.
  • Criticizes suggestions to increase the pool size to 50 as shifting the bottleneck to the database instead of addressing design flaws.
  • Advises selecting interview questions according to role, rather than running the entire loop for every seat.
  • For real-time layers such as chat, presence, and live dashboards, points to mailboxes, LiveView memory, and node stability at night as primary focus areas.
  • For payments and settlement roles, emphasizes supervision, multi-node behavior, and jobs that run twice as key interview themes.
  • For Phoenix product teams, highlights the database pool and LiveView memory footprint as central topics.
  • Illustrates LiveView memory risk by imagining 500 rows per LiveView with 4,000 users, yielding about 2,000,000 row copies and roughly 4 GB at 2 KB per row.
  • Notes that streams are the usual technique to mitigate heavy LiveView memory usage in large tables.
  • For Rails-to-Elixir migration teams, recommends combining the printed GenServer exercise with the pool scenario and one judgment-based question.
  • Argues that this interview loop is appropriate for roles that own production Elixir systems and is not suited to early-career developers.
  • Suggests that for junior candidates, basic pattern matching, function heads, and pipelines reveal more than questions about partitions or supervision tree escalations.
  • States that KORE1 helps teams design Elixir interview loops that measure judgment instead of vocabulary.
  • Shares that KORE1’s IT searches average 17 days from intake to accepted offer and that 92% of placed candidates remain with clients after one year.
  • Notes that Elixir-focused searches typically run longer than the firm’s overall IT average.
  • Encourages teams to select a complex module from their own repositories, remove timeouts, supervision, and comments, print it, and give it to finalists.
  • Suggests watching what candidates ask before editing code because their blind spots indicate which topics to explore in later interview rounds.
  • Mentions that the author’s full guide covers supervision trees, partition and duplicate-job scenarios, and side-by-side comparisons of strong versus rehearsed answers for Elixir interviews.