This repository is used to test and profile memory usage in Cloudflare Workers with Sentry instrumentation.
$ pnpm iFollow these steps to profile memory usage using DevTools snapshots. For more details, see the Cloudflare documentation on memory profiling.
-
Start the development server
$ pnpm dev
-
Open DevTools
Press
din the terminal to open DevTools, then navigate to the "Memory" tab. -
Take an initial snapshot
Click "Take snapshot" to capture the baseline memory state.
-
Run load tests (in a separate terminal)
$ pnpm load-test
The load test runs for ~2 minutes with increasing traffic:
- 30s warm up at 10 req/s
- 60s ramp up at 50 req/s
- 30s sustained load at 100 req/s
-
Compare snapshots
Take additional snapshots during or after the load test to compare memory usage over time.
To investigate memory differences between versions, compare snapshots between these commits:
| Commit | Description |
|---|---|
c0decd2 |
Before fix (feat: Add artillery load tests) |
bce192b |
After fix (feat: Add experimental fix from jp/fixes) |
# Checkout baseline commit
$ git checkout c0decd222ec0e98303b7d7c600eb7c5dbd574d33
$ pnpm i
# Run profiling steps above, take snapshots
# Checkout fix commit
$ git checkout bce192b9a3b0685a35c1bee2a07b6ad3113da329
$ pnpm i
# Run profiling steps above, compare snapshots