Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Document multiple app approach #4393

Merged
merged 10 commits into from Nov 7, 2022
17 changes: 17 additions & 0 deletions docs/Guides/Recommendations.md
Expand Up @@ -8,6 +8,7 @@ This document contains a set of recommendations when using Fastify.
- [HAProxy](#haproxy)
- [Nginx](#nginx)
- [Kubernetes](#kubernetes)
- [Running Multiple Instances](#multiple)

## Use A Reverse Proxy
<a id="reverseproxy"></a>
Expand Down Expand Up @@ -298,3 +299,19 @@ readinessProbe:
timeoutSeconds: 3
successThreshold: 1
failureThreshold: 5
```

## Running Multiple Instances
<a id="multiple"></a>

While [Use A Reverse Proxy](#use-a-reverse-proxy) explains why
climba03003 marked this conversation as resolved.
Show resolved Hide resolved
multiple Fastify apps on the same server should not be used for horizontal
scaling purposes, there are several use-cases where running multiple apps
would be a recommended approach. Most common examples would be exposing
healthcheck and metrics endpoints on a separate port, in order to prevent
public access.

It is perfectly fine to spin up several Fastify instances within the same
Node.js process and run them concurrently, even in the heavy load systems.
kibertoad marked this conversation as resolved.
Show resolved Hide resolved
Each Fastify instance only generates as much load as the traffic it receives,
plus the memory used for that Fastify instance.