Dynamic V8 Heap Resizing for Kubernetes In-Place Scaling (--max-old-space-size-percentage)
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 5/5
- Tempo estimado
- Mais de uma semana
- Facilidade para iniciantes
- 35/100
- Tipo de issue
- Funcionalidade
- Clareza
- Razoavelmente clara
- Status de atividade
- Ativa
- Stack de tecnologia
- javascript, kubernetes, nodejs
- Domínio
- backend, cloud, operating-systems, performance
Direção de pesquisa
Comece pela implementação de --max-old-space-size-percentage e dos parâmetros de memória do cgroup que ele lê; em seguida, inspecione como os limites dos isolates do V8 podem ser atualizados em tempo de execução. Valide o design com Kubernetes InPlacePodVerticalScaling e com o aumento e a redução de memória; considera-se concluído quando a porcentagem é reaplicada após alterações no limite de tempo de execução, sem reinicialização.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
What is the problem this feature will solve?
Node.js supports percentage-based heap configuration via --max-old-space-size-percentage. However, this flag currently calculates V8's maximum old space size only once at process startup based on initial system or cgroup memory limits.
Kubernetes supports in-place resource resizing (InPlacePodVerticalScaling), which alters container memory limits dynamically at runtime without restarting the container. Because --max-old-space-size-percentage evaluates only at startup, it cannot react to runtime cgroup changes:
- Memory Upscaling: If Kubernetes increases a running container's memory limit, Node.js remains restricted to the initial V8 heap limit calculated at startup, failing to utilize the newly available RAM.
- Memory Downscaling: If Kubernetes decreases the container's memory limit below the initial V8 heap allocation, the container risks being terminated by the Linux Out-Of-Memory (OOM) killer before V8 triggers garbage collection or lowers its heap boundary.
To fully support zero-downtime Kubernetes in-place resizing, --max-old-space-size-percentage needs to dynamically recalculate and apply heap limits when cgroup memory parameters change at runtime.
What is the feature you are proposing to solve the problem?
Extend --max-old-space-size-percentage to actively monitor cgroup memory limit changes and adjust the V8 heap size dynamically during process execution.
Example Workflow
# Enable percentage-based allocation
node --max-old-space-size-percentage=80 app.js
- Initialization: Container starts with a 2 GiB memory limit. Node.js evaluates
--max-old-space-size-percentage=80and sets V8 max old space to~1.6 GiB. - Kubernetes Event: Kubernetes resizes the running pod in-place from 2 GiB to 4 GiB memory limit.
- Event Detection: Node.js detects the cgroup change event.
- Runtime Update: Node.js recalculates 80% of 4 GiB (
~3.2 GiB) and adjusts V8's isolate limits dynamically while the application continues processing traffic.
What alternatives have you considered?
No response
- Linguagem predominante
- JavaScript
- Estrelas
- 122k
- Forks
- 37.4k
- Merge médio
- 4d 2h
- PRs com merge (30d)
- 277
Guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de nodejs/node
-
doc
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 65/100
-
build
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 88/100
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 84/100
-
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 90/100
-
feature request
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
Todas as issues de nodejs/node
Issues semelhantes
-
Update HugeIcons library Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 65/100
antfu-collective/icones#398 ·
-
ECmail.com Aberta
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 90/100
wesbos/burner-email-providers#554 ·
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 65/100
radiantearth/stac-browser#1023 ·
-
HMR stops working Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
components-web-app/docs#92 ·