tencent cloud

Feedback

Business client disaster recovery solution

Last updated: 2024-12-27 15:50:39

    Overview

    The business client disaster recovery solution for the Risk Control Engine (RCE) service is an effective policy we provide to ensure that your online business processes remain unaffected even in the event of API exceptions, while enhancing user experience. This solution offers robust support to maintain business continuity and stability when facing various potential exceptions.

    Business Flow Diagram

    The request process for RCE involves the business client, Tencent Cloud API Gateway, and the RCE server. The sequence diagram for their interactions is as follows:
    

    Business Client (Backend) Disaster Recovery

    When an exception occurs during the request of the RCE API, the business client should handle the issue accordingly to ensure that the business process is not disrupted by response structure exception, request timeouts, or unresponsive services. The following are several types of abnormal returns where disaster recovery handling by the business client is required:
    The API returns an internal error, with the error code InternalError.
    {
    "Response": {
    "Error": {
    "Code": "InternalError",
    "Message": "An internal error has occurred. Retry your request, but if the problem persists, contact us."
    },
    "RequestId": "9f347b06-****-****-****-****62ba5bf6"
    }
    }
    For more details on error codes, see Common Error Codes.

    Monitoring and Alarms

    The business server can implement system monitoring for exceptions to promptly identify issues with the RCE service API and formulate appropriate emergency response plans. If the error rate exceeds the predefined threshold, alarms should be triggered immediately.

    Exception Handling and Retry Policy

    For certain types of errors (such as network errors or temporary service unavailability), the client can capture these errors and implement a retry policy based on actual business requirements. If all retries are exhausted and the server still does not respond normally, the client can choose to skip and return a default result while logging the problematic data for subsequent analysis and resolution.
    For example, if the first request fails, the client can choose to retry after waiting for a certain period. It is important to note that the number of retries and intervals should be clearly limited to avoid falling into an infinite loop.
    Note:
    The following pseudocode is for reference only; see your actual business code.
    def handle_response(response, retry_count=3, retry_interval=5):
    if "Error" in response["Response"]:
    error = response["Response"]["Error"]
    code = error["Code"]
    message = error["Message"]
    request_id = response["Response"]["RequestId"]
    
    logging.error(f"Request failed. Error code: {code}, error message: {message}, request ID: {request_id}")
    
    if code == "InternalError":
    # For internal errors, you may need to retry the request
    print("An internal error occurred, retrying the request...")
    for i in range(retry_count):
    print(f"Retry count: {i+1}")
    # Wait for a while
    time.sleep(retry_interval)
    # Code for retrying the request...
    # If the retry is successful, return the result and exit the function
    # If the retry fails, continue the loop
    # If all retries fail, return the default value
    return 'pass' elif code == "other error code":
    # Perform disaster recovery based on the actual situation
    else:
    print("An unknown error occurred")
    return 'pass'
    else:
    # If no error occurs, process the response normally
    # Code to process the response...
    
    
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support