All fields

“Clustering & Worker Threads” in Information Technology

27 questions across 1 technology.

Information Technology

27 questions in 1 technology

#QuestionTechnologyTopicLevel
1How do you use SharedArrayBuffer to share memory directly between Node.js worker threads, and what are the safety considerations? Node.js › Clustering & Worker ThreadsNode.jsClustering & Worker ThreadsAdvanced
2What is the os.cpus() function used for when setting up clustering in a Node.js application? Node.js › Clustering & Worker ThreadsNode.jsClustering & Worker ThreadsBeginner
3How do you pass data between the main thread and a worker thread using postMessage(), and what are the limits on what can be sent? Node.js › Clustering & Worker ThreadsNode.jsClustering & Worker ThreadsIntermediate
4What is the difference between the number of CPU cores and the optimal number of cluster workers for a given Node.js application? Node.js › Clustering & Worker ThreadsNode.jsClustering & Worker ThreadsIntermediate
5What is the difference between spawning a Worker Thread and spawning a Child Process for running a CPU-intensive JavaScript function? Node.js › Clustering & Worker ThreadsNode.jsClustering & Worker ThreadsIntermediate
6How do you gracefully terminate a worker thread, and what's the difference between worker.terminate() and letting it exit naturally? Node.js › Clustering & Worker ThreadsNode.jsClustering & Worker ThreadsIntermediate
7What is a worker thread pool, and why would you build one rather than creating a new Worker for every task? Node.js › Clustering & Worker ThreadsNode.jsClustering & Worker ThreadsAdvanced
8How do you handle an uncaught exception inside a specific cluster worker without taking down the entire application? Node.js › Clustering & Worker ThreadsNode.jsClustering & Worker ThreadsAdvanced
9What is the WorkerData option when creating a Worker, and how does it differ from communicating via postMessage() after creation? Node.js › Clustering & Worker ThreadsNode.jsClustering & Worker ThreadsAdvanced
10What is the difference in behavior between the 'primary' and 'worker' role in Node's cluster module regarding which code paths execute? Node.js › Clustering & Worker ThreadsNode.jsClustering & Worker ThreadsAdvanced
11Why does Node.js provide a cluster module, given that a single Node.js process is single-threaded? Node.js › Clustering & Worker ThreadsNode.jsClustering & Worker ThreadsIntermediate
12How does PM2's cluster mode compare to manually using Node's built-in cluster module directly in application code? Node.js › Clustering & Worker ThreadsNode.jsClustering & Worker ThreadsIntermediate
13What is the difference between the 'sticky' and default load-balancing strategies when using Node's cluster module, and when does it matter? Node.js › Clustering & Worker ThreadsNode.jsClustering & Worker ThreadsIntermediate
14What happens to in-memory state (like an in-memory cache) when using the Node.js cluster module, and how do you handle this correctly? Node.js › Clustering & Worker ThreadsNode.jsClustering & Worker ThreadsAdvanced
15How does zero-downtime restart work with Node's cluster module or PM2, and why is it important for production deployments? Node.js › Clustering & Worker ThreadsNode.jsClustering & Worker ThreadsAdvanced
16How does Node.js implement the Worker Threads module differently from Child Processes, and when should each be used? Node.js › Advanced Node.jsNode.jsAdvanced Node.jsAdvanced
17What is the difference between concurrency and parallelism, and which one does Node.js's event loop actually provide by default? Node.js › Event Loop & Non-blocking IONode.jsEvent Loop & Non-blocking IOBeginner
18What problem does PM2 solve for running a Node.js application in production, beyond just executing 'node server.js'? Node.js › Deployment & Process Managers (PM2)Node.jsDeployment & Process Managers (PM2)Beginner
19What is a cron job, and how would you schedule recurring background tasks in a Node.js application using node-cron or BullMQ's repeatable jobs? Node.js › Background Jobs & QueuesNode.jsBackground Jobs & QueuesIntermediate
20What is a 'stalled' job in BullMQ, and what causes it? Node.js › Background Jobs & QueuesNode.jsBackground Jobs & QueuesIntermediate
21How does the event loop handle a large synchronous loop (like processing a huge array with a for loop), and what problem does this cause? Node.js › Event Loop & Non-blocking IONode.jsEvent Loop & Non-blocking IOIntermediate
22What is Redis Pub/Sub, and how would a Node.js application use it to broadcast real-time events across multiple server instances? Node.js › Caching with RedisNode.jsCaching with RedisIntermediate
23How do you detect and prevent event loop blocking in a long-running Node.js service? Node.js › Advanced Node.jsNode.jsAdvanced Node.jsAdvanced
24What is horizontal scaling for a Node.js application, and what specific architectural requirement does it impose? Node.js › Cloud & DevOpsNode.jsCloud & DevOpsAdvanced
25What is the difference between how Node.js handles I/O-bound concurrency versus CPU-bound work, and why does this distinction shape Node.js's ideal use cases? Node.js › Event Loop & Non-blocking IONode.jsEvent Loop & Non-blocking IOAdvanced
26How would you generate a video thumbnail in Node.js using ffmpeg via a library like fluent-ffmpeg? Node.js › File Uploads & Media ProcessingNode.jsFile Uploads & Media ProcessingAdvanced
27How does Node.js achieve high concurrency for I/O-bound workloads despite running JavaScript on a single main thread? Node.js › Node.js Fundamentals & Runtime ArchitectureNode.jsNode.js Fundamentals & Runtime ArchitectureAdvanced