-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into feat/contentful-rich-text-tables
- Loading branch information
Showing
607 changed files
with
30,669 additions
and
24,123 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
**/.classpath | ||
**/.dockerignore | ||
**/.env | ||
**/.git | ||
**/.gitignore | ||
**/.project | ||
**/.settings | ||
**/.toolstarget | ||
**/.vs | ||
**/.vscode | ||
**/*.*proj.user | ||
**/*.dbmdl | ||
**/*.jfm | ||
**/charts | ||
**/docker-compose* | ||
**/compose* | ||
**/Dockerfile* | ||
**/node_modules | ||
**/npm-debug.log | ||
**/obj | ||
**/secrets.dev.yaml | ||
**/values.dev.yaml | ||
README.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
FROM node:14-buster | ||
ENV NODE_ENV=production | ||
ENV CI=1 | ||
ENV GATSBY_CPU_COUNT=4 | ||
RUN apt-get update -y && apt-get upgrade -y && apt-get install git curl npm -y | ||
RUN npm i -g gatsby-cli gatsby-dev-cli | ||
WORKDIR /usr/src/app | ||
RUN echo "\n\necho \"Welcome to the Gatsby Memory benchmark container!\\n - /usr/src/gatsby : Your local gatsby repo\\n - /usr/src/app : The memory benchmark gatsby site\\n\"" > /root/.bashrc | ||
|
||
# set up gatsby-dev | ||
RUN gatsby-dev --set-path-to-repo /usr/src/gatsby | ||
|
||
# keep the process running | ||
ENTRYPOINT ["tail", "-f", "/dev/null"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
# Gatsby Memory Benchmark | ||
|
||
The goal of this benchmark is to test Gatsby's memory usage and look for potential optimizations. | ||
|
||
## The Docker Container | ||
|
||
The docker container used in these tests sets up a Debian instance with node 14 installed (as well as npm/yarn/etc). | ||
It has ports 9000 (for hosting gatsby) and 9229 (for debugging) exposed. | ||
|
||
Within the container, two points to your local filesystem are mounted: | ||
|
||
- /usr/src/gatsby : Your local gatsby repo | ||
- /usr/src/site : The memory benchmark gatsby site | ||
|
||
## Commands | ||
|
||
### Docker | ||
|
||
These commands are used for interfacing with docker and have built-in utilities for managing the docker container. | ||
|
||
#### yarn docker:build | ||
|
||
Builds the container used for testing. | ||
|
||
#### yarn docker:start | ||
|
||
Starts the container built by `yarn docker:build`. | ||
|
||
#### yarn docker:connect | ||
|
||
Connects to the container started by `yarn docker:start`. | ||
|
||
#### yarn docker:start-and-connect | ||
|
||
A shorthand for start + connect. | ||
|
||
#### yarn docker:stop | ||
|
||
Stop the container used for testing. | ||
|
||
#### yarn docker:stats | ||
|
||
Show a polling display of the container's docker stats. | ||
|
||
### Gatsby | ||
|
||
These commands are used for interfacing with gatsby. | ||
|
||
#### yarn gatsby:build | ||
|
||
Simply an alias to `yarn gatsby build`. | ||
|
||
#### yarn gatsby:serve | ||
|
||
Starts `gatsby serve` on port 9000 and sets the host properly to work inside docker. | ||
|
||
#### yarn gatsby:develop | ||
|
||
Starts `gatsby develop` on port 9000 and sets the host properly to work inside docker. | ||
|
||
#### yarn gatsby:build:debug | ||
|
||
Runs `gatsby build` with `inspect-brk` set to start the [debugging process](https://www.gatsbyjs.com/docs/debugging-the-build-process/) on port 9229. | ||
|
||
#### yarn gatsby:develop:debug | ||
|
||
Runs `gatsby develop` with `inspect-brk` set to start the [debugging process](https://www.gatsbyjs.com/docs/debugging-the-build-process/) on port 9229. | ||
|
||
## Setup | ||
|
||
Currently we can reproduce builds crashing with out default settings | ||
|
||
- Docker container running with 2GB limit | ||
- 300 nodes x ~2MB each = ~600MB of "just" nodes data in each process (number of nodes can be controlled with NUM_NODES env var) | ||
- 3 workers + main process (`GATSBY_CPU_COUNT` set to 4 in docker image, but you can specify different value with env var - for example `GATSBY_CPU_COUNT=6 yarn gatsby:build`) | ||
- `eq_field` template using fast filters (single `eq` specifically) | ||
|
||
Goal is to make `eq_field` template to not cause crashes, then add next template (different operator) that cause crashes and repeat until all queries can be handled with set memory limits. | ||
|
||
### Workflow | ||
|
||
While `gatsby-dev` command is available inside docker, from my testing it seems like it doesn't pick up file changes when run there. Workflow that seems to work reliably: | ||
|
||
When starting working with this benchmark: | ||
|
||
- start `yarn watch` (possibly with `--scope`) in monorepo | ||
- start `gatsby-dev` outside of docker in benchmark directory (just like with regular site) | ||
- `yarn docker:connect` to get inside docker | ||
- `npm rebuild` to rebuild binaries inside docker | ||
|
||
And repeat as many times as you want: | ||
|
||
- make changes to `gatsby` source code as you normally would | ||
- run `yarn gatsby:build` inside docker | ||
|
||
## Testing | ||
|
||
TODO | ||
|
||
- How to configure memory limits | ||
- Where to look |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
plugins: [], | ||
} |
Oops, something went wrong.