Skip to content

doc: point memory guide to nodejs-org #580

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 1 addition & 69 deletions documentation/memory/README.md
Original file line number Diff line number Diff line change
@@ -1,71 +1,3 @@
# Memory

In this document you can learn about how to debug memory related issues.

- [Memory](#memory)
- [My process runs out of memory](#my-process-runs-out-of-memory)
- [Symptoms](#symptoms)
- [Side Effects](#side-effects)
- [Debugging](#debugging)
- [My process utilizes memory inefficiently](#my-process-utilizes-memory-inefficiently)
- [Symptoms](#symptoms-1)
- [Side Effects](#side-effects-1)
- [Debugging](#debugging-1)

## My process runs out of memory

Node.js ​ _(JavaScript)_ ​ is a garbage collected language, so having memory
leaks is possible through retainers. As Node.js applications are usually
multi-tenant, business critical, and long-running, providing an accessible and
efficient way of finding a memory leak is essential.

### Symptoms

The user observes continuously increasing memory usage ​ _(can be fast or slow,
over days or even weeks)_ ​then sees the process crashing and restarting by the
process manager. The process is maybe running slower than before and the
restarts make certain requests to fail ​ _(load balancer responds with 502)_ ​.

### Side Effects

- Process restarts due to the memory exhaustion and request are dropped on the
floor
- Increased GC activity leads to higher CPU usage and slower response time
- Increased memory swapping slows down the process
- May not have enough available memory to get a Heap Snapshot

### Debugging

To debug a memory issue we need to be able to see how much space our specific
type of objects take, and what variables retain them to get garbage collected.
For the effective debugging we also need to know the allocation pattern of our
variables over time.

- [Using Heap Profiler](./step1/using_heap_profiler.md)
- [Using Heap Snapshot](./step2/using_heap_snapshot.md)
- [GC Traces](./step3/using_gc_traces.md)
- [Native Tools](./step4/using_native_tools.md)

## My process utilizes memory inefficiently

### Symptoms

The application uses an unexpected amount of memory and/or we observe elevated
garbage collector activity.

### Side Effects

- An elevated number of page faults
- Higher GC activity and CPU usage

### Debugging

To debug a memory issue we need to be able to see how much space our specific
type of objects take, and what variables retain them to get garbage collected.
For the effective debugging we also need to know the allocation pattern of our
variables over time.

- [Using Heap Profiler](./step1/using_heap_profiler.md)
- [Using Heap Snapshot](./step2/using_heap_snapshot.md)
- [GC Traces](./step3/using_gc_traces.md)
- [Native Tools](./step4/using_native_tools.md)
See: https://github.com/nodejs/nodejs.org/tree/main/locale/en/docs/guides/diagnostics/memory
1 change: 0 additions & 1 deletion documentation/memory/case_study.md

This file was deleted.

1 change: 0 additions & 1 deletion documentation/memory/investigation_flow.md

This file was deleted.

1 change: 0 additions & 1 deletion documentation/memory/setup.md

This file was deleted.

88 changes: 0 additions & 88 deletions documentation/memory/step1/using_heap_profiler.md

This file was deleted.

Binary file removed documentation/memory/step2/_cursor.png
Binary file not shown.
Binary file removed documentation/memory/step2/compare.png
Binary file not shown.
Binary file removed documentation/memory/step2/load-snapshot.png
Binary file not shown.
Binary file removed documentation/memory/step2/snapshot.png
Binary file not shown.
Binary file removed documentation/memory/step2/tools.png
Binary file not shown.
128 changes: 0 additions & 128 deletions documentation/memory/step2/using_heap_snapshot.md

This file was deleted.

Loading