Uploaded image for project: 'Couchbase .NET client library'
  1. Couchbase .NET client library
  2. NCBC-149

Delay in view requests when FindServicePoint is called

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.2 Beta
    • Fix Version/s: 1.2 Beta-2
    • Component/s: None
    • Labels:
      None

      Description

      Problem reported with accessing the new view code: the very first request to a view takes about 6-7 seconds. This is not acceptable. I've discovered that majority of this time the client spends looking up for a proxy inside Hammock->GetResponse->HttpWebReques.FindServicePoint. I'm wonder if it is known issue and if there is workaround for it.

      The test code:

      using(var client = new CouchbaseClient("couchbase"))
      {
      var sw = new System.Diagnostics.Stopwatch();
      sw.Start();
      var rows = client.GetView("users", "UserById").Stale(StaleMode.AllowStale).Key(0);
      sw.Stop();
      Console.WriteLine("GetView: " + sw.ElapsedMilliseconds); //about 100ms here
      sw.Reset();
      sw.Start();
      var row = rows.FirstOrDefault(); //6-7 seconds here
      sw.Stop();
      Console.WriteLine("First Enumeration: " + sw.ElapsedMilliseconds);
      sw.Reset();
      sw.Start();
      for(int i = 1; i < 100; i++)

      { rows = client.GetView("users", "UserById").Stale(StaleMode.AllowStale).Key(i); row = rows.FirstOrDefault(); //5-7ms if(i % 10 == 0) Console.WriteLine(i); }

      sw.Stop();
      }
      Console.WriteLine(sw.ElapsedMilliseconds / 99.0);

      The config file:
      <?xml version="1.0" encoding="utf-8" ?>
      <configuration>
      <configSections>
      <section name="couchbase" type="Couchbase.Configuration.CouchbaseClientSection, Couchbase, Version=1.2.0.0, Culture=neutral, PublicKeyToken=05e9c6b5a9ec94c2"/>
      </configSections>
      <couchbase>
      <servers bucket="loginservice">
      <add uri="http://127.0.0.1:8091/pools"/>
      </servers>
      </couchbase>
      </configuration>

      The view:
      function (doc, meta) {
      if (doc.U >= 0)
      {
      emit(doc.U,

      {C:doc.C,G: doc.G, A: doc.A}

      );
      }
      }

      Data sample:

      { "C": 127, "U": 1004214, "G": 100000000000004210, "A": true, "E": [] }
      No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

        Hide
        john John Zablocki (Inactive) added a comment -

        Published and tagged

        Show
        john John Zablocki (Inactive) added a comment - Published and tagged

          People

          • Assignee:
            john John Zablocki (Inactive)
            Reporter:
            john John Zablocki (Inactive)
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Gerrit Reviews

              There are no open Gerrit changes