Redis + MongoDB vs. Couchbase: Performance Benchmark Comparison
Superior performance and manageability, discover the advantages.
CHALLENGES
7 frequent challenges with Redis+MongoDB
Using MongoDB™ with Redis can enhance performance, but the combination adds significant complexity and might introduce more challenges. Because Redis lacks some features, it often needs additional modules that further complicate the setup.
チャレンジ#1
Architecture
Redis+MongoDB is very difficult to scale from a single replica set to a fully sharded environment.
チャレンジ #2
コスト
MongoDB’s inability to scale increases operational costs.
チャレンジ #3
Replication and failover
MongoDB is highly susceptible to data loss and inconsistency.
CHALLENGE #4
Operational overhead
Redis+MongoDB deployments require operations teams with mastery of disparate skill sets.
CHALLENGE #5
Multi-data center deployment
When deployed in multiple geographies, MongoDB can’t perform all writes locally.
CHALLENGE #6
モバイル
Redis lacks a mobile solution, and MongoDB’s mobile solution has significant shortcomings.
CHALLENGE #7
Time
Redis+MongoDB is time-consuming to develop, manage, and maintain.
FEATURES
Key features of Couchbase vs. Redis + MongoDB
Code Snippet
Couchbase’s SQL++ and single API excels over Redis+MongoDB
- Couchbase key-value
- Redis key-value
- Couchbase SQL++ query
- MongoDB query language
- Redis
// scope/collection allow for more flexible data organization
const bucket = cluster.bucket('accounts-receivable');
const scope = bucket.scope('tenant1');
const collection = scope.collection('invoices');
const result = await collection.get('key');
// Redis lacks scope and collection capability
const redisClient = redis.createClient({ ... });
redisClient.connect();
const value = await redisClient.get('key');
/* equivalent to the Mongo example */
SELECT SUM(value * volume) AS val, symbol
FROM db.stocks
WHERE symbol IN ( "AAPL", "GOOG" ) AND value > 0
GROUP BY symbol
ORDER BY val DESC, symbol ASC
// equivalent to the SQL++ example
db.stocks.aggregate([
{ "$match": {
"$and": [
{"symbol": {
"$in": [
"AAPL",
"GOOG"]}},
{ "value": {
"$gt": 0 }}]}},
{ "$group": {
"_id": {
"symbol": "$symbol" },
"sum(value * volume)": {
"$sum": {
"$multiply": [
"$value",
"$volume"]}}}},
{ "$project": {
"_id": 0,
"sum(value * volume)": "$sum(value * volume)",
"symbol": "$_id.symbol"}}
{ "$sort": {
"sum(value * volume)": -1,
"symbol": 1 }}]})
// Redis lacks a complex query language like SQL
お客様






