Membase is a generalized database management system, but looking across Membase deployments, it is clear that there are some patterns of use. These patterns tend to rely Membase's unique combination of linear, horizontal scalability; sustained low latency and high throughput performance; and the extensibility of the system facilitated through Tap and NodeCode. This page highlights these use cases.
User sessions are easily stored in Membase, such as by using a key naming scheme like "user:USERID". The item expiration feature of Membase can be optionally used to have Membase automatically delete old sessions. (Note that expiration algorithm is lazy and will consume resources until the item is actually retrieved, at which point the expiration timestamps are checked.)
Besides the usual SET operation, CAS identifiers can be used to ensure concurrent web requests from a single user do not lose data.
Many web application frameworks such as Ruby on Rails and various PHP and Python web frameworks also provide pre-integrated support for storing session data using Memcached protocol. These are supported automatically by Membase.
Game state, property state, timelines, conversations & chats can also be modeled in Membase. The asynchronous persistence algorithms of Membase were designed, built and deployed to support some of the highest scale social games on the planet. In particular, the heavy dual read & write storage access patterns of social games (nearly every user gesture mutates game state) is serviced by Membase by asynchronously queueing mutations for disk storage and also by collapsing mutations into the most recently queued mutation. For example, a player making 10 game state mutations in 5 seconds (e.g., planting 10 flowers in 5 seconds) will likely be collapsed by Membase automatically into just one queued disk mutation. Membase also will force-save mutated item data to disk, even if an item is heavily changed (the user keeps on clicking and clicking). Additionally, game state for that player remains instantly readable as long as it is in the memory working set of Membase.
The same underpinnings that power social games is well suited to real-time ad and content targeting. For example, Membase provides a fast storage capability for counters. Counters are useful for tracking visits, associating users with various targeting profiles (eg, user-1234 is visited a page about "automobiles" and "travel") and in tracking ad-offers and ad-inventory.
Multi-GET operations in Membase allow ad applications to concurrently "scatter-gather" against profiles, counters, or other items in order to allow for ad computation and serving decisions under a limited response latency budget.
Other features of Membase, such as the ability to PREPEND and APPEND values onto existing items, allow for high performance event tracking. Membase is also well suited as a aggregation backend, where events need to be consolidated for fast, real-time analysis.
For example, if your application needs to process the "firehose" of events from high-scale conversation services such as Twitter, such as by matching user interest in terms (eg, user-1234 is interested in conversations about "worldcup" and "harrypotter"), Membase can be used as the database for fast topic to subscriber matching, allowing your application to quickly answer, "who is interested in event X?"