From 454f001a60f5052b7678c54444c0242a9887c20a Mon Sep 17 00:00:00 2001 From: Dotan Simha Date: Sun, 26 Jan 2025 16:57:00 +0200 Subject: [PATCH 1/4] docs(gateway): added a new page with resources info --- .../pages/docs/gateway/deployment/_meta.ts | 1 + .../docs/gateway/deployment/resources.mdx | 35 +++++++++++++++++++ pnpm-lock.yaml | 20 +++++------ 3 files changed, 46 insertions(+), 10 deletions(-) create mode 100644 packages/web/docs/src/pages/docs/gateway/deployment/resources.mdx diff --git a/packages/web/docs/src/pages/docs/gateway/deployment/_meta.ts b/packages/web/docs/src/pages/docs/gateway/deployment/_meta.ts index d1a331cd145..1b260fd6b6a 100644 --- a/packages/web/docs/src/pages/docs/gateway/deployment/_meta.ts +++ b/packages/web/docs/src/pages/docs/gateway/deployment/_meta.ts @@ -1,5 +1,6 @@ export default { index: 'Overview', + resources: 'Resources', docker: 'Docker', serverless: 'Serverless / On the Edge', 'node-frameworks': 'Frameworks', diff --git a/packages/web/docs/src/pages/docs/gateway/deployment/resources.mdx b/packages/web/docs/src/pages/docs/gateway/deployment/resources.mdx new file mode 100644 index 00000000000..706259bfbff --- /dev/null +++ b/packages/web/docs/src/pages/docs/gateway/deployment/resources.mdx @@ -0,0 +1,35 @@ +import { Callout } from '@theguild/components' + +# Resources + +Finding and defining the right amount of resources for your GraphQL gateway is important to ensure +ongoing performance and reliability. This guide will help you understand how to define the resources +for your gateway. + +## CPU and Memory + +The two main resources you need to define for your gateway are CPU and memory. These resources are +used to ensure that your gateway has enough resources to run efficiently. + +For most applications, you can with the following default values: + +- **CPU: 1** +- **Memory: 1GB** + +These values are a good starting point for most applications. However, you may need to adjust these +values based on your application's requirements. For example, if your application has a high volume +of traffic, you may need to increase the CPU and memory resources. + +For production environments with high-traffic, we recommend using the following values: + +- **CPU: 2** +- **Memory: 2-4GB** + +## Environment Variables + +We recommend setting `NODE_ENV` to `production` to ensure that your gateway runs in production mode. +This will also enable parallelism optimizations that can improve performance. + +By default, the gateway will available parallelism for the amount of workers to spawn. You can set +the `FORK` environment variable to the number of workers you want to spawn. For example, to spawn 12 +workers, you can set `FORK=12`. diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 45d9b3947e0..616bca89fa6 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -16497,8 +16497,8 @@ snapshots: dependencies: '@aws-crypto/sha256-browser': 3.0.0 '@aws-crypto/sha256-js': 3.0.0 - '@aws-sdk/client-sso-oidc': 3.596.0 - '@aws-sdk/client-sts': 3.596.0(@aws-sdk/client-sso-oidc@3.596.0) + '@aws-sdk/client-sso-oidc': 3.596.0(@aws-sdk/client-sts@3.596.0) + '@aws-sdk/client-sts': 3.596.0 '@aws-sdk/core': 3.592.0 '@aws-sdk/credential-provider-node': 3.596.0(@aws-sdk/client-sso-oidc@3.596.0)(@aws-sdk/client-sts@3.596.0) '@aws-sdk/middleware-host-header': 3.577.0 @@ -16605,11 +16605,11 @@ snapshots: transitivePeerDependencies: - aws-crt - '@aws-sdk/client-sso-oidc@3.596.0': + '@aws-sdk/client-sso-oidc@3.596.0(@aws-sdk/client-sts@3.596.0)': dependencies: '@aws-crypto/sha256-browser': 3.0.0 '@aws-crypto/sha256-js': 3.0.0 - '@aws-sdk/client-sts': 3.596.0(@aws-sdk/client-sso-oidc@3.596.0) + '@aws-sdk/client-sts': 3.596.0 '@aws-sdk/core': 3.592.0 '@aws-sdk/credential-provider-node': 3.596.0(@aws-sdk/client-sso-oidc@3.596.0)(@aws-sdk/client-sts@3.596.0) '@aws-sdk/middleware-host-header': 3.577.0 @@ -16648,6 +16648,7 @@ snapshots: '@smithy/util-utf8': 3.0.0 tslib: 2.8.1 transitivePeerDependencies: + - '@aws-sdk/client-sts' - aws-crt '@aws-sdk/client-sso-oidc@3.723.0(@aws-sdk/client-sts@3.723.0)': @@ -16781,11 +16782,11 @@ snapshots: transitivePeerDependencies: - aws-crt - '@aws-sdk/client-sts@3.596.0(@aws-sdk/client-sso-oidc@3.596.0)': + '@aws-sdk/client-sts@3.596.0': dependencies: '@aws-crypto/sha256-browser': 3.0.0 '@aws-crypto/sha256-js': 3.0.0 - '@aws-sdk/client-sso-oidc': 3.596.0 + '@aws-sdk/client-sso-oidc': 3.596.0(@aws-sdk/client-sts@3.596.0) '@aws-sdk/core': 3.592.0 '@aws-sdk/credential-provider-node': 3.596.0(@aws-sdk/client-sso-oidc@3.596.0)(@aws-sdk/client-sts@3.596.0) '@aws-sdk/middleware-host-header': 3.577.0 @@ -16824,7 +16825,6 @@ snapshots: '@smithy/util-utf8': 3.0.0 tslib: 2.8.1 transitivePeerDependencies: - - '@aws-sdk/client-sso-oidc' - aws-crt '@aws-sdk/client-sts@3.723.0': @@ -16938,7 +16938,7 @@ snapshots: '@aws-sdk/credential-provider-ini@3.596.0(@aws-sdk/client-sso-oidc@3.596.0)(@aws-sdk/client-sts@3.596.0)': dependencies: - '@aws-sdk/client-sts': 3.596.0(@aws-sdk/client-sso-oidc@3.596.0) + '@aws-sdk/client-sts': 3.596.0 '@aws-sdk/credential-provider-env': 3.587.0 '@aws-sdk/credential-provider-http': 3.596.0 '@aws-sdk/credential-provider-process': 3.587.0 @@ -17057,7 +17057,7 @@ snapshots: '@aws-sdk/credential-provider-web-identity@3.587.0(@aws-sdk/client-sts@3.596.0)': dependencies: - '@aws-sdk/client-sts': 3.596.0(@aws-sdk/client-sso-oidc@3.596.0) + '@aws-sdk/client-sts': 3.596.0 '@aws-sdk/types': 3.577.0 '@smithy/property-provider': 3.1.11 '@smithy/types': 3.7.2 @@ -17232,7 +17232,7 @@ snapshots: '@aws-sdk/token-providers@3.587.0(@aws-sdk/client-sso-oidc@3.596.0)': dependencies: - '@aws-sdk/client-sso-oidc': 3.596.0 + '@aws-sdk/client-sso-oidc': 3.596.0(@aws-sdk/client-sts@3.596.0) '@aws-sdk/types': 3.577.0 '@smithy/property-provider': 3.1.11 '@smithy/shared-ini-file-loader': 3.1.12 From d5db21d25c5c3c395653cd39489625cd732ebaa3 Mon Sep 17 00:00:00 2001 From: Dotan Simha Date: Mon, 27 Jan 2025 09:30:34 +0200 Subject: [PATCH 2/4] wip --- .../src/pages/docs/gateway/deployment/resources.mdx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/web/docs/src/pages/docs/gateway/deployment/resources.mdx b/packages/web/docs/src/pages/docs/gateway/deployment/resources.mdx index 706259bfbff..f6cafaa926a 100644 --- a/packages/web/docs/src/pages/docs/gateway/deployment/resources.mdx +++ b/packages/web/docs/src/pages/docs/gateway/deployment/resources.mdx @@ -28,8 +28,11 @@ For production environments with high-traffic, we recommend using the following ## Environment Variables We recommend setting `NODE_ENV` to `production` to ensure that your gateway runs in production mode. -This will also enable parallelism optimizations that can improve performance. +This will also enable [parallelism optimizations](https://nodejs.org/api/cluster.html) that can +improve performance. -By default, the gateway will available parallelism for the amount of workers to spawn. You can set -the `FORK` environment variable to the number of workers you want to spawn. For example, to spawn 12 -workers, you can set `FORK=12`. +By default, the gateway will use the available parallelism (amount of CPUs, based on the NodeJS +`os.availableParallelism`) for the amount of workers to spawn. + +You can set the `FORK` environment variable to the number of workers you want to spawn. For example, +to spawn 12 workers, you can set `FORK=12`. From f42faec339f58e3b5acb233e16067bb9c8e42e34 Mon Sep 17 00:00:00 2001 From: Dotan Simha Date: Mon, 27 Jan 2025 09:31:43 +0200 Subject: [PATCH 3/4] fix wording --- .../docs/gateway/deployment/resources.mdx | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/packages/web/docs/src/pages/docs/gateway/deployment/resources.mdx b/packages/web/docs/src/pages/docs/gateway/deployment/resources.mdx index f6cafaa926a..6fa05fb47bd 100644 --- a/packages/web/docs/src/pages/docs/gateway/deployment/resources.mdx +++ b/packages/web/docs/src/pages/docs/gateway/deployment/resources.mdx @@ -2,37 +2,37 @@ import { Callout } from '@theguild/components' # Resources -Finding and defining the right amount of resources for your GraphQL gateway is important to ensure -ongoing performance and reliability. This guide will help you understand how to define the resources -for your gateway. +Defining the right amount of resources for your GraphQL gateway is crucial for maintaining +performance and reliability. This guide will help you understand how to allocate resources +effectively. ## CPU and Memory -The two main resources you need to define for your gateway are CPU and memory. These resources are -used to ensure that your gateway has enough resources to run efficiently. +The primary resources you need to allocate for your gateway are CPU and memory. These resources +ensure that your gateway runs efficiently. -For most applications, you can with the following default values: +For most applications, you can start with the following default values: - **CPU: 1** - **Memory: 1GB** -These values are a good starting point for most applications. However, you may need to adjust these -values based on your application's requirements. For example, if your application has a high volume -of traffic, you may need to increase the CPU and memory resources. +These values are suitable for most applications. However, you may need to adjust them based on your +application's specific requirements. For instance, if your application experiences high traffic, you +may need to increase the CPU and memory allocations. -For production environments with high-traffic, we recommend using the following values: +For production environments with high traffic, we recommend the following values: - **CPU: 2** - **Memory: 2-4GB** ## Environment Variables -We recommend setting `NODE_ENV` to `production` to ensure that your gateway runs in production mode. -This will also enable [parallelism optimizations](https://nodejs.org/api/cluster.html) that can -improve performance. +Set `NODE_ENV` to `production` to ensure your gateway runs in production mode. This setting also +enables [parallelism optimizations](https://nodejs.org/api/cluster.html) that can enhance +performance. -By default, the gateway will use the available parallelism (amount of CPUs, based on the NodeJS -`os.availableParallelism`) for the amount of workers to spawn. +By default, the gateway uses the available parallelism (number of CPUs, based on NodeJS's +`os.availableParallelism`) to determine the number of workers to spawn. -You can set the `FORK` environment variable to the number of workers you want to spawn. For example, -to spawn 12 workers, you can set `FORK=12`. +You can set the `FORK` environment variable to specify the number of workers you want to spawn. For +example, to spawn 12 workers, set `FORK=12`. From 8eb67ca3aeeec51e5b28158bf1706770eca4759f Mon Sep 17 00:00:00 2001 From: Dotan Simha Date: Mon, 27 Jan 2025 09:32:40 +0200 Subject: [PATCH 4/4] fixes --- packages/web/docs/src/pages/docs/gateway/deployment/_meta.ts | 2 +- .../deployment/{resources.mdx => resources-requirements.mdx} | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename packages/web/docs/src/pages/docs/gateway/deployment/{resources.mdx => resources-requirements.mdx} (98%) diff --git a/packages/web/docs/src/pages/docs/gateway/deployment/_meta.ts b/packages/web/docs/src/pages/docs/gateway/deployment/_meta.ts index 1b260fd6b6a..a2f946221c0 100644 --- a/packages/web/docs/src/pages/docs/gateway/deployment/_meta.ts +++ b/packages/web/docs/src/pages/docs/gateway/deployment/_meta.ts @@ -1,6 +1,6 @@ export default { index: 'Overview', - resources: 'Resources', + 'resources-requirements': 'Resources', docker: 'Docker', serverless: 'Serverless / On the Edge', 'node-frameworks': 'Frameworks', diff --git a/packages/web/docs/src/pages/docs/gateway/deployment/resources.mdx b/packages/web/docs/src/pages/docs/gateway/deployment/resources-requirements.mdx similarity index 98% rename from packages/web/docs/src/pages/docs/gateway/deployment/resources.mdx rename to packages/web/docs/src/pages/docs/gateway/deployment/resources-requirements.mdx index 6fa05fb47bd..6cd127f935b 100644 --- a/packages/web/docs/src/pages/docs/gateway/deployment/resources.mdx +++ b/packages/web/docs/src/pages/docs/gateway/deployment/resources-requirements.mdx @@ -1,6 +1,6 @@ import { Callout } from '@theguild/components' -# Resources +# Resources Requirements Defining the right amount of resources for your GraphQL gateway is crucial for maintaining performance and reliability. This guide will help you understand how to allocate resources