nodejs / nodejs/node

node only using half of the available memory

Offen
#35,573 15 Kommentare 12 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

memory never-stale
Vorherrschende Sprache
JavaScript
Sterne
122k
Forks
37.3k
Ø Merge
4 T. 2 Std.
Gemergte PRs (30 T.)
283

Beschreibung

  • Version: 12.19.0
  • Platform: Debian Buster
  • Subsystem:
What steps will reproduce the bug?
  1. Start a container with limited memory (something like docker run --rm -it --memory=1G --memory-swap=1G node:12.19.0-buster-slim bash
  2. Inspect heap size (node -e 'const v8 = require("v8"); console.log(v8.getHeapStatistics());')
How often does it reproduce? Is there a required condition?

100%

What is the expected behavior?

node would use all available memory

What do you see instead?

node is only using half of the memory, so we either need to give the container twice as much memory as we really want it to use (which is problematic) or also specify --max-old-space-size in addition to controlling the container which means we have to keep 2 different settings in sync and that's a big pain

Additional information

It appears that it was changed here, and only using half of memory makes sense when running on a system with multiple process, but when running in a docker container, using all of the memory allocated to the container makes more sense

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne damit, das Problem mit dem bereitgestellten docker run-Befehl und der Prüfung node -e v8.getHeapStatistics() zu reproduzieren. Verfolge, wie Node.js das Speicherlimit des Containers bestimmt, und vergleiche diesen Wert mit der erwarteten 1G-Zuweisung; abgeschlossen ist die Aufgabe, wenn die Runtime den Heap angemessen dimensioniert, ohne eine separate --max-old-space-size-Einstellung zu benötigen.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
docker, javascript, linux, node.js
Bereich
backend, devops, performance
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Ruhig
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
52/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.