Service Restarts
Tackling
Which Restarts?
Detecting Restarts


Health Checks
-
Consul
-
Readiness probe
-
Liveness probe - trigger restarts

-
Unhandled Errors
-
Blocking Code
-
Long GCs (rare)

Reasons for no response
in node.js services
Unhandled Errors

app.post('/register', (req: Request, res: Response) => {
// perform some action...
httpClient.post('api/audit');
res.send('ok');
});
app.post('/register', (req: Request, res: Response) => {
try {
// perform some action...
httpClient.post('api/audit');
res.send('ok');
} catch (err) {
res.status(500);
res.send('error');
}
});
app.post('/register', async (req: Request, res: Response) => {
try {
// perform some action...
await httpClient.post('api/audit');
res.send('ok');
} catch (err) {
res.status(500);
res.send('error');
}
});app.post('/register', async (req: Request, res: Response) => {
// perform some action...
httpClient.post('api/audit')
.catch(err => console.log(err));
res.send('ok');
});
Tackling
Unhandled Errors
Blocking Code

Dealing with
Blocking Code
-
Not easy to detect \ find the cause
-
Improve visibility
-
Code reviews!
Questions?
Services Restarts
By Tsachi Shushan
Services Restarts
- 410