mediumConceptDesignMidSeniorStaff
How does Node load your modules, and how would you make a Node service use more than one core?
6 min readUpdated 2026-08-15
Answer
Short answer
ESM resolves asynchronously and exposes live read-only bindings, CommonJS resolves synchronously and returns a mutable object, and interop leaks in both directions. Extra cores come from worker threads for CPU work, cluster or replicas for connections, child processes for other programs.
Keep modules explicit in the answer because that is the concept the interviewer is actually trying to test.
Was this answer helpful?
Likely follow-ups
- Your library needs to ship both a CommonJS and an ESM build. How do you avoid shipping two copies of its internal state?
- You add a worker pool and throughput gets worse. What are the likely reasons?
- Why is running four replicas under an orchestrator usually preferable to running cluster with four workers inside one container?
- How do you hand an incoming socket to a worker process without proxying its bytes through the primary?
Related questions
- You move a service from Java 11 to Java 21 and it fails at startup with InaccessibleObjectException. What changed, and what do you do about it?hardAlso on modules5 min
- Your Node service has low CPU but latency spikes for every request at the same moment. What is happening?mediumAlso on worker-threads4 min
- What is the KV cache, and why does it decide how many users one GPU can serve?hardSame kind of round: concept4 min
- Your team wants to expose internal systems to an agent through MCP servers. What does the Model Context Protocol standardise, and what does it leave you to secure?hardSame kind of round: concept5 min