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

Delay the listening till bootstrapping completes #513

Closed
wants to merge 2 commits into from

Conversation

kumarrishav
Copy link
Member

App starts taking the requests as soon as it starts listening irrespective of app is ready or not (i.e boot).

@kumarrishav
Copy link
Member Author

Background

Goal: Zero downtime (zero 503/502)

Scenario 1: Start scenario

Running one process vs multiple processes via node cluster (or use process manager like pm2).

Once the app start's listening, the request starts coming in and it will return 503 (during the starting time/bootstraps). In one process case, the app can be behind the health check and can determine if the app is ready to server request (first 201 from the app). But in multiple process apps, as soon as the app starts listening, the master process will distribute the request to the worker process. There is a possibility that there is some time gap between the start of the worker process. Even one worker responds 200, it's possible that another worker is still bootstrapping, which results in 503. It will cause 2-3 503 (i tested in 2 process cluster).

Scenario 2: Graceful restart scenario,

In a graceful restart scenario, the app will come up and start taking the request as soon as it starts listening. So, the cluster doesn't know when to forward the request to the app as during that time, the app will be bootstrapping and it sends 503.

Delaying the listen until app is done with bootstrapping makes sure, when request comes, the app is ready to serve.

@kumarrishav
Copy link
Member Author

closing in favor #514

@kumarrishav kumarrishav deleted the patch-1 branch November 26, 2019 20:13
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.

1 participant