Couchbase
  • Why NoSQL?
  • Couchbase Server
  • Download
  • Resources
  • Careers
Home | Forums | Couchbase | Couchbase Server 2.0

Couchbase .NET Client Library 2.0. - Performance Issues

10 replies [Last post]
  • Login or register to post comments
Tue, 01/03/2012 - 11:24
thoreaupoop
Offline
Joined: 12/22/2011
Groups: None

One thing I have noticed is that the .NET Couchbase Client API does not correctly filter the results in Couchbase, but sends back the entire result set of the views (select * from view). On the client the filter is then applied to the whole set of data. This is horrific in terms of performance.

What is the plan for the client? As of now, the only usable features are the Membase functionality.

*This was originally posted on the SDKs forum: http://www.couchbase.org/forums/thread/couchbase-net-client-query-genera...

Top
  • Login or register to post comments
Thu, 01/05/2012 - 18:35
john
Offline
Joined: 01/05/2012
Groups: None

Hi,

Currently, the focus is to get the Couchbase Client ready for the 1.8 release, which is coming this January. After that, I'll be pushing forward with improvements to the core 1.8 functionality as well as making sure CBS 2.0 support is solid.

In the meantime, something you might want to try in your code is something like the following:

var client = new CouchbaseClient();
var query = client.GetView("content", "articles")
                  .StartKey("clp test")
                  .Select(a => (string) a.GetItem()) 
                  .Select(x => JsonUtility.Deserialize<Article>(x));

Note the addition of .StartKey("clp test") instead of the LINQ Where.

I haven't had a chance to test this code, so my apologies if it's not quite right.

To modify the query before it's sent to the server, you need to use the fluent methods (i.e., StartKey, EndKey, Skip, etc.). These methods are chainable and should properly modify the query as you'd expect. So you could have something like:

client.GetView("content", "articles").StartKey("a").EndKey("f").Limit(10);

There's not actually an IQueryable implementation in the current client, so calling .Where and .Select doesn't modify the query, only the results.

-- John

Top
  • Login or register to post comments
Fri, 01/06/2012 - 13:04
thoreaupoop
Offline
Joined: 12/22/2011
Groups: None

John - Thanks for the tip and the explanation (which make sense).

Top
  • Login or register to post comments
Tue, 01/31/2012 - 11:53
arishlabroo
Offline
Joined: 12/22/2011
Groups: None

CouchbaseNetClient 1.0.1 does not have method GetView(designName, viewName) which is available in 0.9.2
and
CouchbaseNetClient 0.9.2 does not have fluent methods like StartKey(""), EndKey("") etc..

What client library should I/ can I use to try your solution.

Top
  • Login or register to post comments
Tue, 01/31/2012 - 12:40
john
Offline
Joined: 01/05/2012
Groups: None

Yes, the current release that you'll find on Nuget does not have GetView. The reason that method isn't available is that the 1.0 client supports the 1.8 server, which does not have view functionality. The StartKey and EndKey fluent methods are chained off of the view, so they won't be on the client, but the View returned by client.GetView. Are you not seeing those with 0.9.2?

Top
  • Login or register to post comments
Tue, 01/31/2012 - 13:02
arishlabroo
Offline
Joined: 12/22/2011
Groups: None

I was trying with 0.9.1 and it was not available. I see it in the 0.9.2 library. Thanks

You mention that 1.8 server(and i am guessing even 2.0) does not have view functionality. Is there a reason for that, and how would you recommend we change our approach then. Our current approach with Couchbase involves writing a lot of views with different Map functions.

We have just started to look into using Couchbase at our company and would like to target the latest server.If you could point me at some resources, I will really appreciate that.

Top
  • Login or register to post comments
Tue, 01/31/2012 - 13:08
john
Offline
Joined: 01/05/2012
Groups: None

Views are not part of 1.8, but they'll definitely be back in 2.0. Couchbase Server 2.0 Developer Preview 3 is available for download at http://www.couchbase.com/download.

Over the next few weeks, I'll be working to put nightly builds online and that will sooner than later include the 2.0 client functionality.

Top
  • Login or register to post comments
Tue, 01/31/2012 - 13:14
arishlabroo
Offline
Joined: 12/22/2011
Groups: None

Wonderful. Thank you so much for all your help.

Top
  • Login or register to post comments
Wed, 03/14/2012 - 15:39
TomMayer
Offline
Joined: 03/14/2012
Groups: None

Hi John,

using DonNet driver 1.0.0 (downloaded from CB 2 Dev-Preview 3 page). File descriptions says "none 1.0-yet" (GetView method is included). I guess its version 0.9.1.

I try to reproduce your sample with fluent methods.

The rest api call for querying a view

http://x:8092/default/_design/query/_view/muc2?startkey=%2280331%22&endk...

is working well, but the following code response with all keys within the view:

using (CouchbaseClient client = new CouchbaseClient(cconfig))
{

var view = client.GetView("query", "muc2").StartKey("80331").EndKey("80339");

var munich = view.ToList();

foreach (var muc in view)
Console.WriteLine("{0}", muc.ViewKey);
}

Do i miss a link? Has anyone a suggestion for me.. thanks in advance.

Top
  • Login or register to post comments
Fri, 03/16/2012 - 10:21
TomMayer
Offline
Joined: 03/14/2012
Groups: None

Issue closed.

Hi .net guys,

the DotNet driver you can download at www.couchbase.com -> Develop seems to be an outdated version. Downloading the sources from github https://github.com/couchbase/couchbase-net-client and buidling them sloved my issues.

Happy coding;)

Top
  • Login or register to post comments
Tue, 03/20/2012 - 07:12
john
Offline
Joined: 01/05/2012
Groups: None

Hi Tom,

That's correct, the latest code on Github does support our view API. You can also get binaries at http://www.couchbase.com/develop/net/next. I'll be updating the documentation here shortly, so stay tuned for more complete samples and API docs. Also, there will be bug fixes and improvements coming to the client as we prepare for a 2.0 server launch.

-- John

Top
  • Login or register to post comments
  • Login or register to post comments
  • Login
  • Register

Company

  • About Us
  • Leadership
  • Customers
  • Partners
  • Contact Us

Product

  • Couchbase Server
  • Couchbase SDKs
  • Use Cases
  • Documentation
  • Forums

Open Source

  • Couchbase Project
  • Couchbase vs. CouchDB

Commercial

  • Subscriptions & Support
  • Training & Services

News

  • Blog
  • Newsletter
  • Press Releases
  • Buzz

Follow Us

    
  • Customer Login
  • Terms of Service
  • Privacy Policy
  • Trademark Policy
  • Site Map

© 2013 COUCHBASE All rights reserved.

Sign in to Couchbase Community

close
  • Create new account
  • Request new password
You are logging into the Forums, Wiki and Issue Tracker