Score:0

Restarting PM2 when the latency of the API it's serving becomes high

jp flag

I have an EC2 instance running which is housing a nodeJS/GraphQL based API application. The application is managed via PM2.

I want to have a setup/configuration which can continuously ping one endpoint (actual API) on the server to keep monitoring the latency. e.g, it can keep hitting login endpoint with some dummy credentials to make sure server the response is received within given threshold time. If the response continuously comes as delayed, the PM2 should restart the node process.

Is there a standard/accepted way of doing this? Health probe check or something. Not sure. Apologies if it's a bit vague/broad question/topic.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.