Set cluster scheduling policy on Windows
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 43.3k
- Forks
- 2.7k
- PR merge metrics
- No merged PRs in 30d
Description
What's going wrong?
On Windows, cluster scheduling is disabled and only one worker gets the entire load of requests. This can be fixed by setting cluster.schedulingPolicy = cluster.SCHED_RR; or the environment variable NODE_CLUSTER_SCHED_POLICY=rr. I tried the environment variable as a system global variable but it didn't work.
How could we reproduce this issue?
Run clustering on Windows and monitor the workers log.
Supporting information
--- PM2 report ----------------------------------------------------------------
Date : Fri Jan 14 2022 01:52:29 GMT+0000 (Coordinated Universal Time)
===============================================================================
--- Daemon -------------------------------------------------
pm2d version : 5.1.2
node version : 16.13.1
node path : not found
argv : C:\Program Files\nodejs\node.exe,C:\ProgramData\pm2\service\index.js
argv0 : C:\Program Files\nodejs\node.exe
user : undefined
uid : N/A
gid : N/A
uptime : 1827min
===============================================================================
--- CLI ----------------------------------------------------
local pm2 : 5.1.2
node version : 16.13.1
node path : not found
argv : C:\Program Files\nodejs\node.exe,C:\ProgramData\npm\npm\node_modules\pm2\bin\pm2,report
argv0 : node
user : Administrator
===============================================================================
--- System info --------------------------------------------
arch : x64
platform : win32
type : Windows_NT
cpus : AMD EPYC 7571
cpus nb : 8
freemem : 28164399104
totalmem : 34074025984
home : C:\Users\Administrator
===============================================================================
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing PM2's Windows cluster scheduling path and how it launches workers; compare the reported cluster.schedulingPolicy setting with NODE_CLUSTER_SCHED_POLICY=rr. Reproduce the issue on Windows and monitor the worker logs, then verify that requests are distributed across workers rather than handled by only one.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- backend, cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100