Joystream / joystream

Joystream Monorepo
http://www.joystream.org
GNU General Public License v3.0
1.42k stars 115 forks source link

QueryNode: Run graphql-server with pm2 cluster mode #4863

Closed mnaamani closed 1 year ago

mnaamani commented 1 year ago

Enable horizontal scaling graphql-server on machine using pm2 process manager in cluster mode.

The updated script to start graphql-server will only start a single node cluster. Once the graphql-server is running we can manage the cluster with pm2:

Get status:

docker exec -it graphql-server yarn pm2 status

Add one more instance to the cluster

docker exec -it graphql-server yarn pm2 scale graphql-server +1

Monitor the cluster:

docker exec -it graphql-server yarn pm2 status

Its important to note that the processor send status updates to the graphql-server. As more instances are added, these udpates are balanced across the cluster, so they will appear less frequent from the point of view of applications that are subscribing through the graphql-server to these updates.