๋„์ „ ๊ณผ์ œ

Redis/MongoDB์˜ ์ž์ฃผ ๋ฐœ์ƒํ•˜๋Š” 7๊ฐ€์ง€ ๋ฌธ์ œ

MongoDBโ„ข๋ฅผ Redis์™€ ํ•จ๊ป˜ ์‚ฌ์šฉํ•˜๋ฉด ์„ฑ๋Šฅ์„ ํ–ฅ์ƒ์‹œํ‚ฌ ์ˆ˜ ์žˆ์ง€๋งŒ, ์ด ์กฐํ•ฉ์€ ์ƒ๋‹นํ•œ ๋ณต์žก์„ฑ์„ ์ถ”๊ฐ€ํ•˜๊ณ  ๋” ๋งŽ์€ ๋ฌธ์ œ๋ฅผ ์•ผ๊ธฐํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. Redis์—๋Š” ์ผ๋ถ€ ๊ธฐ๋Šฅ์ด ๋ถ€์กฑํ•˜๊ธฐ ๋•Œ๋ฌธ์— ์„ค์ •์„ ๋”์šฑ ๋ณต์žกํ•˜๊ฒŒ ๋งŒ๋“œ๋Š” ์ถ”๊ฐ€ ๋ชจ๋“ˆ์ด ํ•„์š”ํ•œ ๊ฒฝ์šฐ๊ฐ€ ๋งŽ์Šต๋‹ˆ๋‹ค.

๊ธฐ๋Šฅ

์นด์šฐ์น˜๋ฒ ์ด์Šค์™€ Redis + ๋ชฝ๊ณ DB์˜ ์ฃผ์š” ๊ธฐ๋Šฅ ๋น„๊ต

  • ํฌํ•จ๋œ ๋‚ด์šฉ
  • ๋‚ด์žฅ ์บ์‹œ
  • JSON ์œ ์—ฐ์„ฑ
  • ์ž๋™ ๋ชจ๋ฐ”์ผ ๋™๊ธฐํ™” ๋ฐ ํ”ผ์–ด ํˆฌ ํ”ผ์–ด ๋™๊ธฐํ™”
  • ๋งˆ์Šคํ„ฐ๋ฆฌ์Šค ์•„ํ‚คํ…์ฒ˜
  • ์ „์ฒด SQL ์ฟผ๋ฆฌ
  • ๋‹ค์ค‘ ๋งˆ์Šคํ„ฐ ์ง€๋ฆฌ์  ๋ณต์ œ
  • ๋ถ„์„
  • ์ž๋™ ์ƒค๋”ฉ/ํŒŒํ‹ฐ์…”๋‹
  • ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ๋กœ์ง
  • ๋‚ด์žฅ๋œ ์ „์ฒด ํ…์ŠคํŠธ ๊ฒ€์ƒ‰
  • ๋ฐ์ดํ„ฐ ๊ตฌ์กฐ(๋Œ€๊ธฐ์—ด, ์ง‘ํ•ฉ ๋“ฑ)
  • ๋‹ค์ฐจ์› ์Šค์ผ€์ผ๋ง
  • ์นด์šฐ์น˜๋ฒ ์ด์Šค
  • ์ด๋ฒคํŠธ, UDF
  • Redis + ๋ชฝ๊ณ DB
  • Redis ์ „์šฉ
  • RedisJSON ๋ชจ๋“ˆ์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.
  • MongoDB๋งŒ ํ•ด๋‹น
  • Redis๋Š” Lua ์ „์šฉ
๊ณ ๊ฐ

์„ฑ๊ณต ์‚ฌ๋ก€: MongoDB ๋ฐ Redis๋ฅผ ํ†ตํ•œ Couchbase

  • "์„œ๋ฒ„๋ฅผ ์ ˆ๋ฐ˜ ์ดํ•˜๋กœ ์ค„์ž„์œผ๋กœ์จ ์„ฑ๋Šฅ์„ ํ–ฅ์ƒํ•˜๊ณ  ํ›จ์”ฌ ๋” ํ™•์žฅ ๊ฐ€๋Šฅํ•œ ์•„ํ‚คํ…์ฒ˜๋ฅผ ํ™•๋ณดํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค."
    ์•„๋ฏธ๋ฅด ์ด์‰ฌ ์ƒฌ๋กฌ, ์šด์˜ ๋‹ด๋‹น ์ˆ˜์„ ์ด์‚ฌ, Viber
    15 ํ•˜๋ฃจ 10์–ต ๊ฑด์˜ ํ†ตํ™” ๋ฐ ๋ฉ”์‹œ์ง€ ์ด๋ฒคํŠธ
    60% ์ด ์„œ๋ฒ„ ์ˆ˜ ๊ฐ์†Œ
  • "๊ฐ€์žฅ ์ค‘์š”ํ•œ ๊ฒƒ์€ ๋‹ค์ฐจ์›์  ํ™•์žฅ์ž…๋‹ˆ๋‹ค. ํŠน์ • ์‚ฌ์šฉ ์‚ฌ๋ก€๋ฅผ ์œ„ํ•œ ๋ช‡ ๊ฐœ์˜ ๋…ธ๋“œ๋ฅผ ํ™•๋ณดํ•˜๋Š” ๊ฒƒ์€ ๋งค์šฐ ๊ฐ•๋ ฅํ•ฉ๋‹ˆ๋‹ค."
    ์ œ์ด ๋“€๋ผ์ด์‚ฌ๋ฏธ, ์ˆ˜์„ ๋ถ€์‚ฌ์žฅ, USIS ์—”์ง€๋‹ˆ์–ด๋ง ๋ฆฌ๋”, Equifax
    300+ 40๋ถ„ ์•ˆ์— ๋ฐฑ๋งŒ ๊ฐœ์˜ ๋ฌธ์„œ
    1.5 ์ˆ˜์‹ญ์–ต ๊ฐœ์˜ ๋Š์ž„์—†์ด ๋ณ€ํ™”ํ•˜๋Š” ๊ธฐ๋ก
  • "๋‹ค๋ฅธ ์–ด๋–ค ์†”๋ฃจ์…˜๋„ Couchbase์˜ ๊ด‘๋ฒ”์œ„ํ•œ ์—”ํ„ฐํ”„๋ผ์ด์ฆˆ ๊ธฐ๋Šฅ์— ๊ทผ์ ‘ํ•˜์ง€ ๋ชปํ–ˆ์Šต๋‹ˆ๋‹ค."
    ์•„๋น„๋žŒ ์•„๊ทธ๋ชฌ, ๋งฅ์นด๋น„ ํ—ฌ์Šค์ผ€์–ด, CTO
    2.3 ๋‹จ์ผ ์•ฑ์œผ๋กœ 230๋งŒ ๋ช…์˜ ๊ณ ๊ฐ ํ™•๋ณด
    0 ๋งค์ผ ์ˆ˜์ฒœ ๊ฑด์˜ ์—ฐ๊ฒฐ๋กœ ์ธํ•œ ๋‹ค์šดํƒ€์ž„
์ฝ”๋“œ ์Šค๋‹ˆํŽซ

Couchbase์˜ SQL++ ๋ฐ ๋‹จ์ผ API๋Š” Redis/MongoDB๋ณด๋‹ค ๋›ฐ์–ด๋‚ฉ๋‹ˆ๋‹ค.


// 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


DBaaS ์„ฑ๋Šฅ ๋ณด๊ณ ์„œ

Redis์™€ ๋ชฝ๊ณ DB Atlas๊ฐ€ Couchbase Capellaโ„ข์™€ ์–ด๋–ป๊ฒŒ ๋น„๊ต๋˜๋Š”์ง€ ์•Œ์•„๋ณด์„ธ์š”.

๊ตฌ์ถ• ์‹œ์ž‘

๊ฐœ๋ฐœ์ž ํฌํ„ธ์—์„œ NoSQL์„ ์‚ดํŽด๋ณด๊ณ , ๋ฆฌ์†Œ์Šค๋ฅผ ์ฐพ์•„๋ณด๊ณ , ํŠœํ† ๋ฆฌ์–ผ์„ ์‹œ์ž‘ํ•˜์„ธ์š”.

์ง€๊ธˆ ๊ฐœ๋ฐœํ•˜๊ธฐ
์นดํŽ ๋ผ ์ฒดํ—˜ํ•˜๊ธฐ

ํด๋ฆญ ๋ช‡ ๋ฒˆ์œผ๋กœ Couchbase๋ฅผ ์ง์ ‘ ์ฒดํ—˜ํ•ด ๋ณด์„ธ์š”. Capella DBaaS๋Š” ๊ฐ€์žฅ ์‰ฝ๊ณ  ๋น ๋ฅด๊ฒŒ ์‹œ์ž‘ํ•  ์ˆ˜ ์žˆ๋Š” ๋ฐฉ๋ฒ•์ž…๋‹ˆ๋‹ค.

๋ฌด๋ฃŒ ์ฒดํ—˜
๋ฌด๋ฃŒ ์•„์นดํŽ ๋ผ ํ…Œ์ŠคํŠธ ๋“œ๋ผ์ด๋ธŒ์— ์ฐธ์—ฌํ•˜์„ธ์š”

์ „๋‹ด ๊ฐ•์‚ฌ์™€ ํ•จ๊ป˜ 90๋ถ„ ์•ˆ์— ์นด์šฐ์น˜๋ฒ ์ด์Šค ์ž๊ฒฉ์ฆ ์ทจ๋“ ์—ฌ์ •์„ ์‹œ์ž‘ํ•˜์„ธ์š”.

์‹œ์ž‘ํ•˜๊ธฐ