Skip to content

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

Merged
mnaamani merged 4 commits intoJoystream:masterfrom
mnaamani:graphql-server-cluster
Oct 25, 2023
Merged

QueryNode: Run graphql-server with pm2 cluster mode#4863
mnaamani merged 4 commits intoJoystream:masterfrom
mnaamani:graphql-server-cluster

Conversation

@mnaamani
Copy link
Copy Markdown
Member

@mnaamani mnaamani commented Sep 11, 2023

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.

@mnaamani mnaamani force-pushed the graphql-server-cluster branch from 710993e to da57d7b Compare October 10, 2023 05:45
@mnaamani mnaamani marked this pull request as ready for review October 10, 2023 05:50
Copy link
Copy Markdown
Contributor

@zeeshanakram3 zeeshanakram3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mnaamani mnaamani merged commit da2f47b into Joystream:master Oct 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants