Skip to content

MM3y3r/reproduce-apollo-react-memleak

 
 

Repository files navigation

QUE FUUUUNNY :D

To reproduce apollographql/react-apollo#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 <Query> component

Only instantiating an apollo client and rendering empty <ApolloProvider>

3. Not using getDataFromTree

Using <Query> but not waiting for the result

4. Light query

5. Large query

How to measure heap size

Install and build apps

$ yarn --pure-lockfile
$ yarn build

Draw heap size graph

First, start GraphQL server process:

$ yarn start-gql

Second, start SSR server process, which is the target to monitor:

$ yarn start-ssr

Next benchmark via ab command:

$ 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:

$ ./plot.py

Dump heap snapshot

Send SIGUSR1 to the SSR server process.

About

To reproduce react-apollo memory leak

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 95.2%
  • Python 4.8%