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 d1a331cd14..a2f946221c 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-requirements': 'Resources', docker: 'Docker', serverless: 'Serverless / On the Edge', 'node-frameworks': 'Frameworks', diff --git a/packages/web/docs/src/pages/docs/gateway/deployment/resources-requirements.mdx b/packages/web/docs/src/pages/docs/gateway/deployment/resources-requirements.mdx new file mode 100644 index 0000000000..6cd127f935 --- /dev/null +++ b/packages/web/docs/src/pages/docs/gateway/deployment/resources-requirements.mdx @@ -0,0 +1,38 @@ +import { Callout } from '@theguild/components' + +# 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 +effectively. + +## CPU and Memory + +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 start with the following default values: + +- **CPU: 1** +- **Memory: 1GB** + +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 the following values: + +- **CPU: 2** +- **Memory: 2-4GB** + +## Environment Variables + +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 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 specify the number of workers you want to spawn. For +example, to spawn 12 workers, set `FORK=12`. diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 45d9b3947e..616bca89fa 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