Uploaded image for project: 'Couchbase Server'
  1. Couchbase Server
  2. MB-26004

go-couchbase should support keep-alive for HTTP requests

    XMLWordPrintable

Details

    • Bug
    • Resolution: Won't Fix
    • Critical
    • None
    • master
    • go-couchbase
    • Untriaged
    • Unknown

    Description

      When Sync Gateway is deployed in an Azure environment, view queries made through go-couchbase are periodically hanging/timing out. The Azure VM idle timeout appears to be killing connections that do not have a keep-alive configured.

      go-couchbase supports enabling TCP keep-alive for memcached communication, but doesn't enable keep-alive for HTTP requests. Specifically, the HTTP Transport used by go-couchbase's default HTTPClient doesn't enable keep-alive in the DialContext:
      https://github.com/couchbase/go-couchbase/blob/master/pools.go#L29

      It would be preferable for go-couchbase to initialize HTTPTransport using the golang DefaultTransport, before customizing properties like MaxIdleConnsFromHost. This will pick up the DefaultTransport's settings for keep-alive, among others:
      https://golang.org/pkg/net/http/#RoundTripper

      Support has sanity tested this change in an Azure environment that reproduced the issue, and it was proven to avoid the keep-alive issues.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            adamf Adam Fraser
            adamf Adam Fraser
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There is 1 open Gerrit change

                PagerDuty