All jobs / Automation developer
Automation developer interview question · 5+ years
A Python service does heavy numeric work per request and latency is unacceptable. What options do you weigh?
The strongest answer
Push the loop into a library that releases the GIL, move the work to a process pool or a separate service, precompute or cache, or accept that this part does not belong in Python
Why it works
Right — and knowing when to leave Python for one component is part of the answer.
What a good answer covers
- Vectorised or native code releases the GIL.
- Process pools give real parallelism.
- Precompute or cache where the input repeats.
- Some components should leave Python.
Answers that fall short
- Close, but not the strongest: Rewrite the whole service in another language immediately
Replacing everything is rarely the smallest change that works. - Weak: Add more replicas; CPU work scales horizontally for free
Replicas cost linearly and do not fix per-request latency. - Red flag: Use threads, which is what they are for
The GIL means threads do not help CPU-bound work.
Who gets asked this
- Backend developer
- Full-stack developer
- Automation developer
- DevOps / SRE / cloud
- Data analyst / BI
- Data engineer
- Data science / ML / AI
- AI engineer
More Automation developer questions
- Under load your async service exhausts database connections. What went wrong?
- What is a decorator, really?
- You need setup and guaranteed teardown around a block. What do you write?
- Can you rely on a dict keeping insertion order?
- One synchronous database call inside an async handler makes the whole service slow. Why?
- Three independent API calls run one after another in an async function. How do you overlap them?
- How do you compose several transformation stages over a huge stream without buffering?