Couchbase
  • Why NoSQL?
  • Couchbase Server
  • Download
  • Resources
  • Careers
Home | Forums | Membase | Membase Server 1.6.x

False negatives after server restart

5 replies [Last post]
  • Login or register to post comments
Sat, 04/09/2011 - 01:48
wisskid
Offline
Joined: 04/09/2011
Groups: None

I installed membase on my Samsung netbook, which, presumably, has a slow disk. As suggested in de Getting Started guide on the Couchbase wiki, I opened telnet, ran stats and then set value "a" with key "test_key". "get test_key" properly returned "a".

Then, to test the durability of the data, I logged out of telnet, restarted membase (sudo /etc/init.d/membase-server restart) and immediately logged back in to telnet when the server came up. Much to my surprise, "get test_key" now returned an empty line. After waiting a second or so, or running an arbitrary command like "stats", "get test_key" would properly return "a" again.

Is this behaviour by design? Is this just related to server start-up or are there other circumstances where a false negative is to be expected?

Top
  • Login or register to post comments
Mon, 04/11/2011 - 14:28
perry
Offline
Joined: 10/11/2010
Groups:

That is the basic idea by design. When a server is loading its data from disk, the data is unavailable until it has finished building up its index of all the data available.

You can "watch" this warmup happen: http://techzone.couchbase.com/wiki/display/membase/Monitoring+Membase#Mo...

Perry

__________________

Forum support is great for free but sometimes you need a guaranteed response time and dedicated resources for your questions or issues.
Consider purchasing enterprise-level support from Couchbase: http://www.couchbase.com/products-and-services/overview
Call or email "sales -at- couchbase-dot- com" today!

Top
  • Login or register to post comments
Thu, 04/14/2011 - 12:04
wisskid
Offline
Joined: 04/09/2011
Groups: None

Thank you for pointing that out.

Do you happen to know what the best practice is for handling this situation when membase is not used as a cache, but rather as the only source for the data?

Say, for example, I'm tracking pageviews per page for a php-website using membase. When the php-script is called for page 'foo', it tries to increment the current number of pageviews for the page from membase [http://nl3.php.net/manual/en/memcache.increment.php] by querying the key 'pageviews-foo'. If it recevies false, it will write 1. In this case, if a membase node would temporarily return null/false after a server restart for certain keys, previosly recorded pageviews would be lost

Would I run the 'stats' command before every read? I'm not sure that would work in a multi-server set-up.

Top
  • Login or register to post comments
Tue, 04/19/2011 - 18:16
perry
Offline
Joined: 10/11/2010
Groups:

Unfortunately the ASCII protocol doesn't have a way to indentify the difference between a "missing" key and an "unavailable" key.

However, if I understand correctly, you're incremementing the same key that you're reading, correct? In this case, the increment itself will fail so you won't end up with a '1', but you will have to handle the error.

Does that make sense?

Perry

__________________

Forum support is great for free but sometimes you need a guaranteed response time and dedicated resources for your questions or issues.
Consider purchasing enterprise-level support from Couchbase: http://www.couchbase.com/products-and-services/overview
Call or email "sales -at- couchbase-dot- com" today!

Top
  • Login or register to post comments
Wed, 04/20/2011 - 03:05
wisskid
Offline
Joined: 04/09/2011
Groups: None

Thank you Perry, that makes perfect sense.

The pageview example however, was just the first example that came to my mind. One can think of many other examples.

Take, for example, a log file stored in membase, as a multiline text value stored with a single key. When our imaginary program wants to log something, it retrieves the value, adds a new log line, and stores the resulting value back into membase. Now, if I try to log something right after a server restart, I will lose my entire log file.

My main question is: can membase be used as a reliable storage tool given this "feature"?

Top
  • Login or register to post comments
Wed, 04/20/2011 - 15:00
perry
Offline
Joined: 10/11/2010
Groups:

You won't actually lose the entire log file since your application will be unable to write that key until it is available again. In this particular case, you would want to attempt to re-read the value if you have a failure when writing it.

Membase can definitely be used as a reliable storage tool (we have a number of customers in production with a variety of use cases). It's really a matter of understanding the behavior of the system and architecting your app accordingly.

Take for example a system that does not do this...in the event of a server failure, you would end up writing multiple entries for the same value and would have to reconcile the differences in your application. Maybe in your case that's desirable, other apps it would not be. Hence finding the right tool for the job ;-)

Does that help?

Perry

__________________

Forum support is great for free but sometimes you need a guaranteed response time and dedicated resources for your questions or issues.
Consider purchasing enterprise-level support from Couchbase: http://www.couchbase.com/products-and-services/overview
Call or email "sales -at- couchbase-dot- com" today!

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