https://github.com/quramy/reproduce-apollo-react-memleak
To reproduce react-apollo memory leak
https://github.com/quramy/reproduce-apollo-react-memleak
graphql react react-apollo server-side-rendering
Last synced: about 2 months ago
JSON representation
To reproduce react-apollo memory leak
- Host: GitHub
- URL: https://github.com/quramy/reproduce-apollo-react-memleak
- Owner: Quramy
- Created: 2019-06-25T17:56:23.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2022-12-10T20:11:59.000Z (over 2 years ago)
- Last Synced: 2025-03-23T01:36:27.977Z (2 months ago)
- Topics: graphql, react, react-apollo, server-side-rendering
- Language: TypeScript
- Homepage:
- Size: 418 KB
- Stars: 1
- Watchers: 1
- Forks: 2
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Reproduce react-apollo memory leak
To reproduce https://github.com/apollographql/react-apollo/issues/2126 .
## Summary
I've measured heap size with 10,000 SSR request under the following condition.
All results indicate some memory increasing(about ~100 bytes / request).### 1. No ApolloProvider, no apollo client

### 2. No `` component
*Only instantiating an apollo client and rendering empty ``*
### 3. Not using getDataFromTree
*Using `` but not waiting for the result*
### 4. Light query
### 5. Large query
## How to measure heap size
### Install and build apps
```sh
$ yarn --pure-lockfile
$ yarn build
```### Draw heap size graph
First, start GraphQL server process:
```sh
$ yarn start-gql
```Second, start SSR server process, which is the target to monitor:
```sh
$ yarn start-ssr
```Next benchmark via ab command:
```sh
$ ab -n 1000 http://localhost:4010
```After shutdown the SSR server process, `heap.json` will be generated.
Finally, plot a heap size graph via the following:
```sh
$ ./plot.py
```### Dump heap snapshot
Send `SIGUSR1` to the SSR server process.