Skip to content

JPeer264/temp-cloudflare-leak

Repository files navigation

Cloudflare Worker Memory Profiling

This repository is used to test and profile memory usage in Cloudflare Workers with Sentry instrumentation.

Setup

$ pnpm i

Memory Profiling

Follow these steps to profile memory usage using DevTools snapshots. For more details, see the Cloudflare documentation on memory profiling.

Steps

  1. Start the development server

    $ pnpm dev
  2. Open DevTools

    Press d in the terminal to open DevTools, then navigate to the "Memory" tab.

  3. Take an initial snapshot

    Click "Take snapshot" to capture the baseline memory state.

  4. 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
  5. Compare snapshots

    Take additional snapshots during or after the load test to compare memory usage over time.

Comparing Commits

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors