Heartbeat Function
This section describes how to configure a heartbeat function on the FunctionGraph console to detect function exceptions.
Scenarios
The heartbeat function monitors user functions for issues like deadlocks, memory overflow, or network errors.
After a heartbeat function is configured, FunctionGraph sends a heartbeat request to the function instance every 5 seconds. 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.
Notes and Constraints
- Currently, heartbeat functions can be configured only 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.
Configuring Heartbeat Function
- Log in to the FunctionGraph console. In the navigation pane, choose Functions > Function List.
- Click the name of a function.
- Choose Configuration > Advanced Settings.
- Enable Heartbeat Function and set the function entry.
The heartbeat function entry must be in the same file as the handler. Format: [package name].[class name].[execution function name]. The value can contain a maximum of 128 characters.Figure 1 Configuring Heartbeat Function
- 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