Uploaded image for project: 'Couchbase Documentation'
  1. Couchbase Documentation
  2. DOC-1684

SDK Client Settings page needs recommendations on environment and lifecycle

    XMLWordPrintable

Details

    Description

      Customer feedback from Couchbase Community Slack. The question arose on SDK settings page - I'm pretty sure it would be fine to add a link to another page there, too, if it's more efficient to explain all those settings values in more detail on a single page that's not language specific.

      The gist of it is this:

      Not only does that doc not cover what's appropriate when using different environments, it also doesn't cover the order that you need to close/shutdown the environment and cluster or if it matters.

      The longer sample of the chat is below, might help recreate some of the context.

      In the docs for the Java SDK, I see a lot of warnings about re-using the cluster environment or bad things will happen. Here's an example from the docs:
      ```CouchbaseEnvironment env = DefaultCouchbaseEnvironment.create();
      CouchbaseCluster cluster1 = CouchbaseCluster.create(env, "192.168.56.1");
      CouchbaseCluster cluster2 = CouchbaseCluster.create(env, "192.168.57.10");```
      Does that assume that all clusters will use the same settings? What if I want to connect to two clusters and use a different environment (settings) for each one?  Will horrible things still happen if I create two `CouchbaseEnvironment`'s  or is that a valid use case? (edited)

      bdw429s [2:34 PM]
      Also, does anyone know if there comprehensive docs on all the settings you can put in `CouchbaseEnvironment`?  All the guides I can find just cover a few basic examples, and the javadocs are sparse. (edited)

      [2:39]
      And here's the links I'm looking at when I say that:
      http://developer.couchbase.com/documentation/server/4.5/sdk/java/start-using-sdk.html
      http://docs.couchbase.com/sdk-api/couchbase-java-client-2.3.1/com/couchbase/client/java/env/CouchbaseEnvironment.html (edited)

      [2:41]
      Example:
      ```long kvTimeout()
      The default timeout for binary (key/value) operations, set to DefaultCouchbaseEnvironment.KV_TIMEOUT.```
      Timeout in what? miliseconds? seconds? minutes? What is `KV_TIMEOUT`? The link seems to go nowhere. (edited)

      protomike [3:55 PM]
      I am just looking it up. KV_TIMEOUT is Key Value Time Out which can be set to how long you would like so you don't get an exception.

      protomike [4:03 PM]
      You should be able to set it like KV_TIMEOUT(1000) for a second and or as long as you like.

      bdw429s [7:03 PM]
      @protomike: Thanks for that, it was just an example though.  I'm looking for a comprehensive doc that covers all the options.

      [7:04]
      I did find this, but it's for an older version and I can't seem to find a current version of the same doc for the latest SDK/Couchbase release
      http://developer.couchbase.com/documentation/server/4.0/sdks/java-2.2/env-config.html (edited)

      bdw429s [7:41 PM]
      I think I finally found the current version: http://developer.couchbase.com/documentation/server/current/sdk/java/client-settings.html (edited)

      [7:41]
      My initial question still stands about re-using environments.

      protomike [9:07 PM]
      Has a piece talking about reusing environments http://developer.couchbase.com/documentation/server/current/sdk/java/managing-connections.html
      developer.couchbase.com
      Managing Connections using the Java SDK with Couchbase Server
      This section describes how to connect the Java SDK to a Couchbase cluster and bucket. It contains best practices as well as information on SSL and other advanced connection options.

      bdw429s [9:10 PM]
      @protomike: Yes. that's the doc I was quoting with my above code sample. (edited)

      [9:11]
      Not only does that doc not cover what's appropriate when using different environments, it also doesn't cover the order that you need to close/shutdown the environment and cluster or if it matters. (edited)

      protomike [9:24 PM]
      Sorry, I am skimming through the docs along with you. Maybe this has some outlook https://forums.couchbase.com/t/will-couchbase-client-connection-become-stale/8332
      Couchbase Forums
      Will Couchbase client connection become stale?
      I have a long-running server using the couchbase client 2.2.3 to talk to a couchbase cluster. I wonder if the connection will become stale eventually or it can refresh itself automatically. Do I need to periodically disconnect the connection and manually create a new connection through CouchbaseCluster.create() periodically? Thanks.

      Attachments

        Issue Links

          Activity

            People

              richard.smedley Richard Smedley
              will.gardella Will Gardella (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                PagerDuty