Configuring Heartbeat Function
Introduction
- Deadlock
- Memory overflow
- Network errors
After you configure a heartbeat function, FunctionGraph sends a heartbeat request to your function instance every 5s. If the response is abnormal, FunctionGraph terminates the function instance.
The heartbeat request timeout is 3s. If no response is returned for six consecutive times, the function instance will be stopped.
Constraints
- Heartbeat detection is available for Java functions.
- The heartbeat function entry must be in the same file as your function handler.
Java heartbeat function format:
public boolean heartbeat() { // Custom detection logic return true
- The heartbeat function has no input parameter and its return value is Boolean.
Procedure
- Log in to the FunctionGraph console. In the navigation pane, choose Functions > Function List.
- Click the function to be configured to go to the function details page.
- Click the Configuration tab and choose Advanced Settings.
- Enable Heartbeat Function and set the function entry.
Figure 1 Configuring a heartbeat function
Table 1 Heartbeat function configuration Parameter
Description
Heartbeat Function
If this option is enabled, FunctionGraph detects exceptions when your function is running.
Heartbeat Function Entry
The heartbeat function entry must be in the same file as your function handler.
The value can contain a maximum of 128 characters in the format of "[package name].[class name].[execution function name]".
- Click Save.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot