Search code examples
ibm-cloudload-balancing

Idle connection timeout limitation in IBM Cloud LBaaS causes problems in our applications


We are an IBM team using IBM Cloud LBaaS (load balancer service) for our applications running on IBM Cloud infrastructure. We got some customer complaints about being unable to get expected responses on the front end of our product, which they never met before with the previous deployment of our product on AWS. We investigated the issue and found that the connections of customers' requests got disconnected by the IBM Cloud load balancer because those requests took longer than 50 seconds to get a response from backend (those are some of our use cases with long running tasks).

We found the 50-second limitation of connection timeout here https://cloud.ibm.com/docs/infrastructure/loadbalancer-service?topic=loadbalancer-service-advanced-traffic-management-with-ibm-cloud-load-balancer#connection-timeouts. We are wondering if the idle timeout can be customized for us to cater for our long running tasks? If it's not supported for now, is there any plan to implement that in the future or is it possible to increase that limitation to a reasonable larger value?

FYR, the max idle timeout of AWS load balancer service is 3600 seconds: https://aws.amazon.com/blogs/aws/elb-idle-timeout-control/.

Any suggestions about how to resolve/eliminate this are appreciated. Feel free to email me directly ([email protected]) if you have anything to share. Thanks!

Yang


Solution

  • If you referring to the idle connection timeout, it's mentioned in the same documentation link that you can set server and client timeout up to 7200 seconds (2 hours).

    Server-side & Client-side idle connection timeout value now can be configured using API. User can configure server timeout(ParameterName: serverTimeout) & client timeout(ParameterName: clientTimeout) value in seconds upto 2 hours (Range: 1 to 7200 seconds) using ‘UpdateLoadBalancerProtocols’ method of ‘SoftLayer_Network_LBaaS_Listener’ service. If user does not provide the server or client timeout value, load balancer will use default value (mentioned in table) for the corresponding timeout.

    For an example on how to use the UpdateLoadBalancerProtocols method, check this softlayer-python client example mentioned in the API reference documentation

    import SoftLayer
    from pprint import pprint
    
    # Your load balancer UUID
    uuid = 'set me'
    
    # New protocols to add
    protocolConfigurations = [
        {
            "backendPort": 1350,
            "backendProtocol": "TCP",
            "frontendPort": 1450,
            "frontendProtocol": "TCP",
            "loadBalancingMethod": "WEIGHTED_RR",    # ROUNDROBIN, LEASTCONNECTION, WEIGHTED_RR
            "maxConn": 500,
            "sessionType": "SOURCE_IP"
        },
        {
            "backendPort": 1200,
            "backendProtocol": "HTTP",
            "frontendPort": 1150,
            "frontendProtocol": "HTTP",
            "loadBalancingMethod": "ROUNDROBIN",    # ROUNDROBIN, LEASTCONNECTION, WEIGHTED_RR
            "maxConn": 1000,
            "sessionType": "SOURCE_IP",
            "serverTimeout": 70,
            "clientTimeout": 70
        }
    ]
    
    # Create the api client
    client = SoftLayer.Client()
    listener_service = client['Network_LBaaS_Listener']
    
    _mask = "mask[listeners]"
    
    try:
        response = listener_service.updateLoadBalancerProtocols(uuid, protocolConfigurations, mask=mask)
        pprint(response)
    except SoftLayer.SoftLayerAPIError as e:            
        print("Unable to add protocols: %s, %s" % (e.faultCode, e.faultString))