SlideShare uma empresa Scribd logo
1 de 26
Redisv2.2.12 2011.8.18 김용환 Knight76 at gmail.com Knight76.tistory.com 맛보기
그냥 캐쉬 서버 하지만, 먼가 달라.  TCP
우리가 아는 캐쉬 솔루션 Mysql기반 Memcached기반 * 근데 Redis도 알아야 하나?- 캐쉬가 빠를 필요가 있나? 안정성 확보가 더 중요 ,[object Object]
Mysql의 한계 : (속도,스케일 이슈),[object Object]
사용상 장/단점 장점 Persistence Speed (간단한 데이터 2백만 건을 1.28초에 저장) Data Structure Atomic Operation (tx) Sharding / Replication 의 용이 Pub/sub / notification (message queue 또는 comet)  - real time String(1G), Hash, List, Set, Sorted Set(score필요), intersection, union, difference  In-memory 데이터 TTL, Expire Node.js를 포함하는 클라이언트가 다양한 언어에서구현.  operation cost : O(1) Multiple Instance에 접속해서 item를 수집(select)후 옮길(move) 수 있음(locking지원) 단점 / 이슈 Ram mode에서는 이슈는 없지만, VM mode 를이용해서 메모리 관리할 때 속도가 많이 느려짐  In-memory라 메모리보다 큰 데이터는 적합하지 않을 수 있음(VM 모드를 사용할 때는 메모리 제한이 없음) -> 2.4부터 VM 모드 deprecated Persistence 의 snapshotting 이용시I/O 이슈가 있음 소스컴파일 설치 Sharding을 클라이언트에서 잘 지정할 필요가 있음 Replication시 blocking됨 (2.4부터 non-blocking하면서 속도개선)
왜 Redis를 주목하는가? Vmware의 CloudFoundryStroage엔진으로 사용 (mysql, mongoDB와 함께 선정).  성능은 memcached와 비슷함 (리얼 환경에 따라 달라질 수 있음) Nonblocking IO, Single Threaded epoll, kqueue and select 이용 Libevent (이벤트 처리 오픈 소스) 를 이용하는 대신 자체 구현.  => Dependent가 없음. 심플해지는 코드 Single-thread Server ANSIC 구현 ,[object Object]
Portable 코드!2.4부터는 비동기로Replication 구성이 가능 * Node.js + redis사용하는사례들이 최근에 늘고 있음 * 2011년 안으로 Redis clustering을 구현할 예정    (처음부터 분산 테이블을 목표로 만들어졌기 때문에 이 부분이 구현되면 엄청난 일이 벌어질 듯..)
2.4 Release 내용들 http://antirez.com/post/everything-about-redis-24 Redis Main 개발자 블로그 Small sorted sets now use significantly less memory. RDB Persistence is much much faster for many common data sets. Many write commands now accept multiple arguments, so you can add multiple items into a Set or List with just a single command. This can improve the performance in a pretty impressive way. Our new allocator is jemalloc. Less memory is used by the saving child, as we reduced the amount of copy on write. INFO is more informative. However it is still the old 2.2-alike INFO, not the new one into unstable composed of sub sections. The new OBJECT command can be used to introspect Redis values. The new CLIENT command allows for connected clients introspection. Slaves are now able to connect to the master instance in a non-blocking fashion. Redis-cli was improved in a few ways. Redis-benchmark was improved as well. Make is now colorized ;) VM has been deprecated. In general Redis is now faster than ever. We have a much improved Redis test framework.
Demo (try.redis-db.com) 2.0.2 version 이라서 그 이상의 버전에서 제공하는 API를 활용할 수 없음
설치 / 실행 http://redis.io/download // 설치 $ wget http://redis.googlecode.com/files/redis-2.2.12.tar.gz  $ tar xzf redis-2.2.12.tar.gz  $ cd redis-2.2.12  $ make // 데몬 실행 $ cd src $ cd redis-server (daemon).. Log.. // 클라이언트 실행 $ cd소스설치/src ; redis-cli  redis> set foo bar  OK  redis> get foo  "bar"
Example Code > set foo 0 "OK" > incr foo 1 > incr foo 2 > incr foo 3 > get foo "3“ > decr foo 2 > set hello world "OK" > get hello "world" > exists hello true > type hello "string" > rename hello olleh "OK" > get olleh "world" > del olleh 1 > get olleh null > set a 1 "OK" > set b 2 "OK" > set c 3 "OK" > mget a b c ["1","2","3"] > set hello world "OK" > get hello "world" >  set a 1 ‘1’ > expire a 100 true > get a "`1" > get a "`1“ (100초 뒤) > get a null > sadd seta foo true > sadd seta bar true > saddsetb foo true > sinter seta setb ["foo"]
Example Code > hset user:1 name x true > hset user:1 lastname y true > hset user:2 name aa true > hget user:1 wrong number of arguments (1 for 2) > hget user:1 name "x" > hgetall user:1 {"name":"x","lastname":"y"} > hget user:2 wrong number of arguments (1 for 2) > hget user:2 name "aa" > lpush list a 1 > lpush list b 2 > lpush list c 3 > lpush list d 4 > lrange list 0 2 ["d","c","b"] > lrange list 0 3 ["d","c","b","a"] > lrange list 2 3 ["b","a"] > sadd set 1 true > sadd set 2 true > sadd set 3 true > smembers set ["3","1","2"] > zaddss 1 aa true > zaddss 10 zz true > zaddss 9 yy true > zaddss 2 bb true > zrangess 0 -1 ["aa","bb","yy","zz"] LIST SET Sorted SET Hash
Example Code > multi "OK" > lpushclist a "QUEUED" > lpushclist b "QUEUED" > lpushclist c "QUEUED" > lrangeclist 0 -1 "QUEUED" > exec [1,2,3,["c","b","a"]] > multi "OK" > lpushdlist a "QUEUED" > lpushdlist b "QUEUED" > discard "OK" TX TX Check and Set 도 가능(watch)
Example Code [test /home/www/redis/redis-2.2.12/src]# ./redis-cli redis 127.0.0.1:6379> psubscribenews.article.*; Reading messages... (press Ctrl-C to quit) 1) "psubscribe" 2) "news.*;" 3) (integer) 1 redis 127.0.0.1:6379> multi OK redis 127.0.0.1:6379> set article.tech.1000 "Google" QUEUED redis 127.0.0.1:6379> saddarticle.tech 1000 QUEUED redis 127.0.0.1:6379> publish news.article.tech 1000 QUEUED redis 127.0.0.1:6379> exec 1) OK 2) (integer) 1 3) (integer) 0 1) "pmessage" 2) "news.article.*" 3) "news.article.tech" 4) "1000"
DEMO Redis서버 실행 Command 이용 Java Client (jedis)이용
Java client - Jedis 가장 좋은 java 클라이언트 라이브러리 https://github.com/xetorthio/jedis 자바의 Map, Set 같은 Collection과 연동되어 사용 가능 Sharding이 지원되다고 적혀있지만, 테스트는 해보지 않음 @Controller @RequestMapping("/restful") @ResponseStatus(value = HttpStatus.ACCEPTED) public class RestfulController { @RequestMapping(value = "/set/key/{key}/value/{value}", method = RequestMethod.GET) public String getString(@PathVariable String key, @PathVariable String value, ModelMap model) { System.out.println("key : " + key); System.out.println("value : " + value); Jedis jedis = new Jedis("1.1.1.1"); jedis.set(key, value); String kValue = jedis.get(key); model.addAttribute("key", key); model.addAttribute("value", kValue); return "test"; } }  <dependency> <groupId>redis.clients</groupId> <artifactId>jedis</artifactId> <version>2.0.0</version> <type>jar</type> <scope>compile</scope> </dependency>
운영상 장점 백업은 리얼타임으로 진행 Master – Slave Replication이 수직/수평적으로 scale 가능 (지금 당장은 없지만) 올해 안으로 Clustering 기능 추가 예정 https://github.com/antirez/redis/blob/master/design-documents/REDIS-CLUSTER 대형 데이터 cache용 용도로 생각 memcached는 크기가 큰 데이터에 취약
운영상 편리 Slave 구성시 서버를 내리지 않고 사용가능. Replication 순서 slave asks for SYNC master BGSAVE, slave waits master BGSAVE finished, the initial bulk data (the .rdb file) is transfered to slave master accumulates all the new differences for the slave master finishes sending the whole initial rdb file to slave master start feeding the slave with the accumulated buffer, and with anything new arriving from clients, if they are writes.
운영상 이슈 & 편리 메모리에 있는 데이터들을 File system으로 덤프 Snapshotting  (디폴트) 자식 프로세스 실행(fork)하고 자식프로세스가 임시(new)RDB파일 만들고, 그것을 다 저장하면 예전(old) 파일 이름으로 교체 (copy-on-write) 속도 이슈로 인해서 많이 고민했음 Append-only file (AOF)  - 괜찮은 방법 2.0과 2.2가 절차가 다름. 만약 Snapshotting 하다가 Kill 되거나 비정상적 종료에 대비해서 실행 로그들을 따로 저장(Log Rewriting)하여 만약 재시작시 상태를 유지하기 위해서 AOF 파일을 읽음  자식 프로세스 실행(fork)하고, 자식 프로세스는 임시 AOF 파일을 저장한다. 부모 프로세스는 in-memory buffer에 새로 변경된 내용을 계산한다. 자식 프로세스는 쓰기 작업이 완료후에 부모 프로세스는 in-memory buffer의 내용을 AOF 파일에 저장한다. 새로운 파일로 교체.
운영상 편리 AOF를 이용한다면, 서버 관점에서는 정지시간 없이 Redis재시작/ 업그레이드 가능 (서버 편함) 환경 설정 정보 변경시 재실행 새로운 버전의 redis서버 재실행 포트 변경 필요,  서버의 포트를 변경하기 때문에 client의서버 접속 포트를 수정하고 재시작 필요. (client 불편) => 오히려 이거 불편. 기존 방법 사용 필요
운영상 편리 모니터링 https://scoutapp.com/plugin_urls/271-redis-monitoring
운영상 불편점 consistent hashing 을 지원하는 client를 이용해야 distribute 가능  Sharding을 일일이 클라이언트 API를 이용해서 해줘야 함. API에서 반드시 지원 2011.8.18일현재 2.2Stable (또는 2.4)버전에서는 clustering 지원 안 함 (올해 안으로 release 되기를 기대)
용도 간단한 카운터 캐쉬 용도 (특히 큰 데이터에서 사용 가능) 여러 개의 row를 검색해서 얻어야 하는 결과를 특정 조건에 맞추어 보여주기 (limit) 최근 30개, 순서대로(lpush, ltrim) 랭킹(zadd, zrank) Expire가 될 수 있는 카운트 정보
Arcus개발팀 Redis한계를 지적한 부분 (SDEC 2011.6) Radis 1.2 검토 대비 최신 버전 2.2 비교  Sorted set에는 no (offset, count) option => 최신 버전에서는 offset, count 기능 추가 No capped collection => 용량제한이 있으며, FIFO기능을 갖고 있는 고성능의 테이블을 capped collection이라고 함. 원래 Redis지원 안함. 원래 빠르기 때문. Not enough cache statistics Cannot control memory use => info명령어를 이용해서 간단하게 메모리 사용량 측정 가능
괜찮은 Reference http://redis.io/   , http://redis.io/topics/faq http://simonwillison.net/static/2010/redis-tutorial/ http://www.slideshare.net/tag/redis/ http://blog.mjrusso.com/2010/10/17/redis-from-the-ground-up.html http://www.slideshare.net/Cyworld/004-cto http://pauladamsmith.com/articles/redis-under-the-hood.html http://hi.baidu.com/roger_long/blog/item/611b1d017f57f89de950cd87.html http://redis.io/presentation/Redis_Cluster.pdf http://www.slideshare.net/karmi/redis-the-ak47-of-postrelational-databases http://pauladamsmith.com/blog/2011/03/redis_get_set.html
Cache 서버를 내가 구축한다면 value(field)의 데이터가 큰 경우에 사용하는 경우. (작아도 상관없음) DB 앞단의캐쉬보다는 주기적인 데이터를 저장 메모리를 많이 추가한 서버 구성 클러스터링과Replication을 잘 구축. 관련 admin 개발 Java client를 이용해서 Sharding을 잘 할 수 있도록 admin 구축 Cache 서버 Web App Server Redis Java Client (legacy 지원) (Clustering) Redis Java Client + Cron + Spring Batch (admin) Mysql (백업) Message Queue Redis DB

Mais conteúdo relacionado

Mais procurados

Optimizing MariaDB for maximum performance
Optimizing MariaDB for maximum performanceOptimizing MariaDB for maximum performance
Optimizing MariaDB for maximum performanceMariaDB plc
 
엘라스틱서치 실무 가이드_202204.pdf
엘라스틱서치 실무 가이드_202204.pdf엘라스틱서치 실무 가이드_202204.pdf
엘라스틱서치 실무 가이드_202204.pdf한 경만
 
Mongo DB 완벽가이드 - 4장 쿼리하기
Mongo DB 완벽가이드 - 4장 쿼리하기Mongo DB 완벽가이드 - 4장 쿼리하기
Mongo DB 완벽가이드 - 4장 쿼리하기JangHyuk You
 
[오픈소스컨설팅] EFK Stack 소개와 설치 방법
[오픈소스컨설팅] EFK Stack 소개와 설치 방법[오픈소스컨설팅] EFK Stack 소개와 설치 방법
[오픈소스컨설팅] EFK Stack 소개와 설치 방법Open Source Consulting
 
[수정본] 우아한 객체지향
[수정본] 우아한 객체지향[수정본] 우아한 객체지향
[수정본] 우아한 객체지향Young-Ho Cho
 
Delivering High-Availability Web Services with NGINX Plus on AWS
Delivering High-Availability Web Services with NGINX Plus on AWSDelivering High-Availability Web Services with NGINX Plus on AWS
Delivering High-Availability Web Services with NGINX Plus on AWSNGINX, Inc.
 
REDIS intro and how to use redis
REDIS intro and how to use redisREDIS intro and how to use redis
REDIS intro and how to use redisKris Jeong
 
FIFA 온라인 3의 MongoDB 사용기
FIFA 온라인 3의 MongoDB 사용기FIFA 온라인 3의 MongoDB 사용기
FIFA 온라인 3의 MongoDB 사용기Jongwon Kim
 
MariaDB 마이그레이션 - 네오클로바
MariaDB 마이그레이션 - 네오클로바MariaDB 마이그레이션 - 네오클로바
MariaDB 마이그레이션 - 네오클로바NeoClova
 
わたしを支える技術
わたしを支える技術わたしを支える技術
わたしを支える技術yoku0825
 
MySQL_MariaDB-성능개선-202201.pptx
MySQL_MariaDB-성능개선-202201.pptxMySQL_MariaDB-성능개선-202201.pptx
MySQL_MariaDB-성능개선-202201.pptxNeoClova
 
Everything you always wanted to know about Redis but were afraid to ask
Everything you always wanted to know about Redis but were afraid to askEverything you always wanted to know about Redis but were afraid to ask
Everything you always wanted to know about Redis but were afraid to askCarlos Abalde
 
Elk with Openstack
Elk with OpenstackElk with Openstack
Elk with OpenstackArun prasath
 
NGINX: Basics and Best Practices
NGINX: Basics and Best PracticesNGINX: Basics and Best Practices
NGINX: Basics and Best PracticesNGINX, Inc.
 
Introduction to redis
Introduction to redisIntroduction to redis
Introduction to redisTanu Siwag
 
MySQL Document Store를 활용한 NoSQL 개발
MySQL Document Store를 활용한 NoSQL 개발MySQL Document Store를 활용한 NoSQL 개발
MySQL Document Store를 활용한 NoSQL 개발Oracle Korea
 
MySQL Performance Schema in Action
MySQL Performance Schema in ActionMySQL Performance Schema in Action
MySQL Performance Schema in ActionSveta Smirnova
 
Node.js Меньше сложности, больше надежности Holy.js 2021
Node.js Меньше сложности, больше надежности Holy.js 2021Node.js Меньше сложности, больше надежности Holy.js 2021
Node.js Меньше сложности, больше надежности Holy.js 2021Timur Shemsedinov
 

Mais procurados (20)

Optimizing MariaDB for maximum performance
Optimizing MariaDB for maximum performanceOptimizing MariaDB for maximum performance
Optimizing MariaDB for maximum performance
 
엘라스틱서치 실무 가이드_202204.pdf
엘라스틱서치 실무 가이드_202204.pdf엘라스틱서치 실무 가이드_202204.pdf
엘라스틱서치 실무 가이드_202204.pdf
 
Mongo DB 완벽가이드 - 4장 쿼리하기
Mongo DB 완벽가이드 - 4장 쿼리하기Mongo DB 완벽가이드 - 4장 쿼리하기
Mongo DB 완벽가이드 - 4장 쿼리하기
 
[오픈소스컨설팅] EFK Stack 소개와 설치 방법
[오픈소스컨설팅] EFK Stack 소개와 설치 방법[오픈소스컨설팅] EFK Stack 소개와 설치 방법
[오픈소스컨설팅] EFK Stack 소개와 설치 방법
 
[수정본] 우아한 객체지향
[수정본] 우아한 객체지향[수정본] 우아한 객체지향
[수정본] 우아한 객체지향
 
Delivering High-Availability Web Services with NGINX Plus on AWS
Delivering High-Availability Web Services with NGINX Plus on AWSDelivering High-Availability Web Services with NGINX Plus on AWS
Delivering High-Availability Web Services with NGINX Plus on AWS
 
REDIS intro and how to use redis
REDIS intro and how to use redisREDIS intro and how to use redis
REDIS intro and how to use redis
 
FIFA 온라인 3의 MongoDB 사용기
FIFA 온라인 3의 MongoDB 사용기FIFA 온라인 3의 MongoDB 사용기
FIFA 온라인 3의 MongoDB 사용기
 
MariaDB 마이그레이션 - 네오클로바
MariaDB 마이그레이션 - 네오클로바MariaDB 마이그레이션 - 네오클로바
MariaDB 마이그레이션 - 네오클로바
 
わたしを支える技術
わたしを支える技術わたしを支える技術
わたしを支える技術
 
MySQL_MariaDB-성능개선-202201.pptx
MySQL_MariaDB-성능개선-202201.pptxMySQL_MariaDB-성능개선-202201.pptx
MySQL_MariaDB-성능개선-202201.pptx
 
Everything you always wanted to know about Redis but were afraid to ask
Everything you always wanted to know about Redis but were afraid to askEverything you always wanted to know about Redis but were afraid to ask
Everything you always wanted to know about Redis but were afraid to ask
 
Elk with Openstack
Elk with OpenstackElk with Openstack
Elk with Openstack
 
NGINX: Basics and Best Practices
NGINX: Basics and Best PracticesNGINX: Basics and Best Practices
NGINX: Basics and Best Practices
 
Introduction to redis
Introduction to redisIntroduction to redis
Introduction to redis
 
Sequelize
SequelizeSequelize
Sequelize
 
MySQL Document Store를 활용한 NoSQL 개발
MySQL Document Store를 활용한 NoSQL 개발MySQL Document Store를 활용한 NoSQL 개발
MySQL Document Store를 활용한 NoSQL 개발
 
ansible why ?
ansible why ?ansible why ?
ansible why ?
 
MySQL Performance Schema in Action
MySQL Performance Schema in ActionMySQL Performance Schema in Action
MySQL Performance Schema in Action
 
Node.js Меньше сложности, больше надежности Holy.js 2021
Node.js Меньше сложности, больше надежности Holy.js 2021Node.js Меньше сложности, больше надежности Holy.js 2021
Node.js Меньше сложности, больше надежности Holy.js 2021
 

Destaque

Hancom MDS Conference - KAKAO DEVOPS Practice (카카오 스토리의 Devops 사례)
Hancom MDS Conference - KAKAO DEVOPS Practice (카카오 스토리의 Devops 사례)Hancom MDS Conference - KAKAO DEVOPS Practice (카카오 스토리의 Devops 사례)
Hancom MDS Conference - KAKAO DEVOPS Practice (카카오 스토리의 Devops 사례)knight1128
 
Global platform
Global platformGlobal platform
Global platformTerry Cho
 
대용량 분산 아키텍쳐 설계 #5. rest
대용량 분산 아키텍쳐 설계 #5. rest대용량 분산 아키텍쳐 설계 #5. rest
대용량 분산 아키텍쳐 설계 #5. restTerry Cho
 
대용량 분산 아키텍쳐 설계 #1 아키텍쳐 설계 방법론
대용량 분산 아키텍쳐 설계 #1 아키텍쳐 설계 방법론대용량 분산 아키텍쳐 설계 #1 아키텍쳐 설계 방법론
대용량 분산 아키텍쳐 설계 #1 아키텍쳐 설계 방법론Terry Cho
 
대용량 분산 아키텍쳐 설계 #4. soa 아키텍쳐
대용량 분산 아키텍쳐 설계 #4. soa 아키텍쳐대용량 분산 아키텍쳐 설계 #4. soa 아키텍쳐
대용량 분산 아키텍쳐 설계 #4. soa 아키텍쳐Terry Cho
 
대용량 분산 아키텍쳐 설계 #3 대용량 분산 시스템 아키텍쳐
대용량 분산 아키텍쳐 설계 #3 대용량 분산 시스템 아키텍쳐대용량 분산 아키텍쳐 설계 #3 대용량 분산 시스템 아키텍쳐
대용량 분산 아키텍쳐 설계 #3 대용량 분산 시스템 아키텍쳐Terry Cho
 
대용량 분산 아키텍쳐 설계 #2 대용량 분산 시스템 아키텍쳐 디자인 패턴
대용량 분산 아키텍쳐 설계 #2 대용량 분산 시스템 아키텍쳐 디자인 패턴대용량 분산 아키텍쳐 설계 #2 대용량 분산 시스템 아키텍쳐 디자인 패턴
대용량 분산 아키텍쳐 설계 #2 대용량 분산 시스템 아키텍쳐 디자인 패턴Terry Cho
 

Destaque (9)

Redis acc
Redis accRedis acc
Redis acc
 
속도체크
속도체크속도체크
속도체크
 
Hancom MDS Conference - KAKAO DEVOPS Practice (카카오 스토리의 Devops 사례)
Hancom MDS Conference - KAKAO DEVOPS Practice (카카오 스토리의 Devops 사례)Hancom MDS Conference - KAKAO DEVOPS Practice (카카오 스토리의 Devops 사례)
Hancom MDS Conference - KAKAO DEVOPS Practice (카카오 스토리의 Devops 사례)
 
Global platform
Global platformGlobal platform
Global platform
 
대용량 분산 아키텍쳐 설계 #5. rest
대용량 분산 아키텍쳐 설계 #5. rest대용량 분산 아키텍쳐 설계 #5. rest
대용량 분산 아키텍쳐 설계 #5. rest
 
대용량 분산 아키텍쳐 설계 #1 아키텍쳐 설계 방법론
대용량 분산 아키텍쳐 설계 #1 아키텍쳐 설계 방법론대용량 분산 아키텍쳐 설계 #1 아키텍쳐 설계 방법론
대용량 분산 아키텍쳐 설계 #1 아키텍쳐 설계 방법론
 
대용량 분산 아키텍쳐 설계 #4. soa 아키텍쳐
대용량 분산 아키텍쳐 설계 #4. soa 아키텍쳐대용량 분산 아키텍쳐 설계 #4. soa 아키텍쳐
대용량 분산 아키텍쳐 설계 #4. soa 아키텍쳐
 
대용량 분산 아키텍쳐 설계 #3 대용량 분산 시스템 아키텍쳐
대용량 분산 아키텍쳐 설계 #3 대용량 분산 시스템 아키텍쳐대용량 분산 아키텍쳐 설계 #3 대용량 분산 시스템 아키텍쳐
대용량 분산 아키텍쳐 설계 #3 대용량 분산 시스템 아키텍쳐
 
대용량 분산 아키텍쳐 설계 #2 대용량 분산 시스템 아키텍쳐 디자인 패턴
대용량 분산 아키텍쳐 설계 #2 대용량 분산 시스템 아키텍쳐 디자인 패턴대용량 분산 아키텍쳐 설계 #2 대용량 분산 시스템 아키텍쳐 디자인 패턴
대용량 분산 아키텍쳐 설계 #2 대용량 분산 시스템 아키텍쳐 디자인 패턴
 

Semelhante a Redis

[스마트스터디]모바일 애플리케이션 서비스에서의 로그 수집과 분석
[스마트스터디]모바일 애플리케이션 서비스에서의 로그 수집과 분석[스마트스터디]모바일 애플리케이션 서비스에서의 로그 수집과 분석
[스마트스터디]모바일 애플리케이션 서비스에서의 로그 수집과 분석smartstudy_official
 
7가지 동시성 모델 람다아키텍처
7가지 동시성 모델  람다아키텍처7가지 동시성 모델  람다아키텍처
7가지 동시성 모델 람다아키텍처Sunggon Song
 
Redis Overview
Redis OverviewRedis Overview
Redis Overviewkalzas
 
[OpenInfra Days Korea 2018] Day 2 - E5: Mesos to Kubernetes, Cloud Native 서비스...
[OpenInfra Days Korea 2018] Day 2 - E5: Mesos to Kubernetes, Cloud Native 서비스...[OpenInfra Days Korea 2018] Day 2 - E5: Mesos to Kubernetes, Cloud Native 서비스...
[OpenInfra Days Korea 2018] Day 2 - E5: Mesos to Kubernetes, Cloud Native 서비스...OpenStack Korea Community
 
Vertica New Features - 8.1에서 9.2까지
Vertica New Features - 8.1에서 9.2까지Vertica New Features - 8.1에서 9.2까지
Vertica New Features - 8.1에서 9.2까지Kee Hoon Lee
 
Front-end Development Process - 어디까지 개선할 수 있나
Front-end Development Process - 어디까지 개선할 수 있나Front-end Development Process - 어디까지 개선할 수 있나
Front-end Development Process - 어디까지 개선할 수 있나JeongHun Byeon
 
[2015 07-06-윤석준] Oracle 성능 최적화 및 품질 고도화 4
[2015 07-06-윤석준] Oracle 성능 최적화 및 품질 고도화 4[2015 07-06-윤석준] Oracle 성능 최적화 및 품질 고도화 4
[2015 07-06-윤석준] Oracle 성능 최적화 및 품질 고도화 4Seok-joon Yun
 
Hadoop security DeView 2014
Hadoop security DeView 2014Hadoop security DeView 2014
Hadoop security DeView 2014Gruter
 
Ndc2011 성능 향상을_위한_데이터베이스_아키텍쳐_구축_및_개발_가이드
Ndc2011 성능 향상을_위한_데이터베이스_아키텍쳐_구축_및_개발_가이드Ndc2011 성능 향상을_위한_데이터베이스_아키텍쳐_구축_및_개발_가이드
Ndc2011 성능 향상을_위한_데이터베이스_아키텍쳐_구축_및_개발_가이드cranbe95
 
Node Js와 Redis를 사용한 구조화된 데이터
Node Js와 Redis를 사용한 구조화된 데이터Node Js와 Redis를 사용한 구조화된 데이터
Node Js와 Redis를 사용한 구조화된 데이터jinho park
 
Fluentd with MySQL
Fluentd with MySQLFluentd with MySQL
Fluentd with MySQLI Goo Lee
 
Kubernetes on GCP
Kubernetes on GCPKubernetes on GCP
Kubernetes on GCPDaegeun Kim
 
ARTIK 710 IoT class 02
ARTIK 710 IoT class 02ARTIK 710 IoT class 02
ARTIK 710 IoT class 02정출 김
 
글로벌 게임 플랫폼에서 무정지, 무점검 서버 개발과 운영 사례
글로벌 게임 플랫폼에서 무정지, 무점검 서버 개발과 운영 사례글로벌 게임 플랫폼에서 무정지, 무점검 서버 개발과 운영 사례
글로벌 게임 플랫폼에서 무정지, 무점검 서버 개발과 운영 사례if kakao
 
Pgday bdr gt1000
Pgday bdr gt1000Pgday bdr gt1000
Pgday bdr gt1000정대 천
 
Pgday bdr 천정대
Pgday bdr 천정대Pgday bdr 천정대
Pgday bdr 천정대PgDay.Seoul
 
레일스를 이용한 애자일 웹 개발 가이드
레일스를 이용한 애자일 웹 개발 가이드레일스를 이용한 애자일 웹 개발 가이드
레일스를 이용한 애자일 웹 개발 가이드Sukjoon Kim
 
게임서비스를 위한 ElastiCache 활용 전략 :: 구승모 솔루션즈 아키텍트 :: Gaming on AWS 2016
게임서비스를 위한 ElastiCache 활용 전략 :: 구승모 솔루션즈 아키텍트 :: Gaming on AWS 2016게임서비스를 위한 ElastiCache 활용 전략 :: 구승모 솔루션즈 아키텍트 :: Gaming on AWS 2016
게임서비스를 위한 ElastiCache 활용 전략 :: 구승모 솔루션즈 아키텍트 :: Gaming on AWS 2016Amazon Web Services Korea
 
넥슨 글로벌 플랫폼 구축 이야기 : DB Migration case study (임현수 플랫폼인프라실 Technical Manager, 넥...
넥슨 글로벌 플랫폼 구축 이야기 : DB Migration case study (임현수 플랫폼인프라실 Technical Manager, 넥...넥슨 글로벌 플랫폼 구축 이야기 : DB Migration case study (임현수 플랫폼인프라실 Technical Manager, 넥...
넥슨 글로벌 플랫폼 구축 이야기 : DB Migration case study (임현수 플랫폼인프라실 Technical Manager, 넥...Amazon Web Services Korea
 

Semelhante a Redis (20)

[스마트스터디]모바일 애플리케이션 서비스에서의 로그 수집과 분석
[스마트스터디]모바일 애플리케이션 서비스에서의 로그 수집과 분석[스마트스터디]모바일 애플리케이션 서비스에서의 로그 수집과 분석
[스마트스터디]모바일 애플리케이션 서비스에서의 로그 수집과 분석
 
7가지 동시성 모델 람다아키텍처
7가지 동시성 모델  람다아키텍처7가지 동시성 모델  람다아키텍처
7가지 동시성 모델 람다아키텍처
 
Redis Overview
Redis OverviewRedis Overview
Redis Overview
 
[OpenInfra Days Korea 2018] Day 2 - E5: Mesos to Kubernetes, Cloud Native 서비스...
[OpenInfra Days Korea 2018] Day 2 - E5: Mesos to Kubernetes, Cloud Native 서비스...[OpenInfra Days Korea 2018] Day 2 - E5: Mesos to Kubernetes, Cloud Native 서비스...
[OpenInfra Days Korea 2018] Day 2 - E5: Mesos to Kubernetes, Cloud Native 서비스...
 
Vertica New Features - 8.1에서 9.2까지
Vertica New Features - 8.1에서 9.2까지Vertica New Features - 8.1에서 9.2까지
Vertica New Features - 8.1에서 9.2까지
 
Front-end Development Process - 어디까지 개선할 수 있나
Front-end Development Process - 어디까지 개선할 수 있나Front-end Development Process - 어디까지 개선할 수 있나
Front-end Development Process - 어디까지 개선할 수 있나
 
[2015 07-06-윤석준] Oracle 성능 최적화 및 품질 고도화 4
[2015 07-06-윤석준] Oracle 성능 최적화 및 품질 고도화 4[2015 07-06-윤석준] Oracle 성능 최적화 및 품질 고도화 4
[2015 07-06-윤석준] Oracle 성능 최적화 및 품질 고도화 4
 
Hadoop security DeView 2014
Hadoop security DeView 2014Hadoop security DeView 2014
Hadoop security DeView 2014
 
Ndc2011 성능 향상을_위한_데이터베이스_아키텍쳐_구축_및_개발_가이드
Ndc2011 성능 향상을_위한_데이터베이스_아키텍쳐_구축_및_개발_가이드Ndc2011 성능 향상을_위한_데이터베이스_아키텍쳐_구축_및_개발_가이드
Ndc2011 성능 향상을_위한_데이터베이스_아키텍쳐_구축_및_개발_가이드
 
Node Js와 Redis를 사용한 구조화된 데이터
Node Js와 Redis를 사용한 구조화된 데이터Node Js와 Redis를 사용한 구조화된 데이터
Node Js와 Redis를 사용한 구조화된 데이터
 
Fluentd with MySQL
Fluentd with MySQLFluentd with MySQL
Fluentd with MySQL
 
Kubernetes on GCP
Kubernetes on GCPKubernetes on GCP
Kubernetes on GCP
 
ARTIK 710 IoT class 02
ARTIK 710 IoT class 02ARTIK 710 IoT class 02
ARTIK 710 IoT class 02
 
글로벌 게임 플랫폼에서 무정지, 무점검 서버 개발과 운영 사례
글로벌 게임 플랫폼에서 무정지, 무점검 서버 개발과 운영 사례글로벌 게임 플랫폼에서 무정지, 무점검 서버 개발과 운영 사례
글로벌 게임 플랫폼에서 무정지, 무점검 서버 개발과 운영 사례
 
Pgday bdr gt1000
Pgday bdr gt1000Pgday bdr gt1000
Pgday bdr gt1000
 
Pgday bdr 천정대
Pgday bdr 천정대Pgday bdr 천정대
Pgday bdr 천정대
 
레일스를 이용한 애자일 웹 개발 가이드
레일스를 이용한 애자일 웹 개발 가이드레일스를 이용한 애자일 웹 개발 가이드
레일스를 이용한 애자일 웹 개발 가이드
 
게임서비스를 위한 ElastiCache 활용 전략 :: 구승모 솔루션즈 아키텍트 :: Gaming on AWS 2016
게임서비스를 위한 ElastiCache 활용 전략 :: 구승모 솔루션즈 아키텍트 :: Gaming on AWS 2016게임서비스를 위한 ElastiCache 활용 전략 :: 구승모 솔루션즈 아키텍트 :: Gaming on AWS 2016
게임서비스를 위한 ElastiCache 활용 전략 :: 구승모 솔루션즈 아키텍트 :: Gaming on AWS 2016
 
넥슨 글로벌 플랫폼 구축 이야기 : DB Migration case study (임현수 플랫폼인프라실 Technical Manager, 넥...
넥슨 글로벌 플랫폼 구축 이야기 : DB Migration case study (임현수 플랫폼인프라실 Technical Manager, 넥...넥슨 글로벌 플랫폼 구축 이야기 : DB Migration case study (임현수 플랫폼인프라실 Technical Manager, 넥...
넥슨 글로벌 플랫폼 구축 이야기 : DB Migration case study (임현수 플랫폼인프라실 Technical Manager, 넥...
 
Mongo db 최범균
Mongo db 최범균Mongo db 최범균
Mongo db 최범균
 

Mais de knight1128

Spring MVC 3 Restful
Spring MVC 3 RestfulSpring MVC 3 Restful
Spring MVC 3 Restfulknight1128
 
Jersey framework
Jersey frameworkJersey framework
Jersey frameworkknight1128
 
Google Protocol buffer
Google Protocol bufferGoogle Protocol buffer
Google Protocol bufferknight1128
 
Jdk(java) 7 - 5. invoke-dynamic
Jdk(java) 7 - 5. invoke-dynamicJdk(java) 7 - 5. invoke-dynamic
Jdk(java) 7 - 5. invoke-dynamicknight1128
 
Jdk(java) 7 - 6 기타기능
Jdk(java) 7 - 6 기타기능Jdk(java) 7 - 6 기타기능
Jdk(java) 7 - 6 기타기능knight1128
 
Jdk 7 4-forkjoin
Jdk 7 4-forkjoinJdk 7 4-forkjoin
Jdk 7 4-forkjoinknight1128
 
공유 Jdk 7-2-project coin
공유 Jdk 7-2-project coin공유 Jdk 7-2-project coin
공유 Jdk 7-2-project coinknight1128
 
공유 Jdk 7-1-short introduction
공유 Jdk 7-1-short introduction공유 Jdk 7-1-short introduction
공유 Jdk 7-1-short introductionknight1128
 
아마존 Aws 서비스_연구
아마존 Aws 서비스_연구아마존 Aws 서비스_연구
아마존 Aws 서비스_연구knight1128
 
구글크롬Os
구글크롬Os구글크롬Os
구글크롬Osknight1128
 
하이브리드앱
하이브리드앱하이브리드앱
하이브리드앱knight1128
 
오픈소스를 활용한 Batch_처리_플랫폼_공유
오픈소스를 활용한 Batch_처리_플랫폼_공유오픈소스를 활용한 Batch_처리_플랫폼_공유
오픈소스를 활용한 Batch_처리_플랫폼_공유knight1128
 
Ssl 하드웨어 가속기를 이용한 성능 향상
Ssl 하드웨어 가속기를 이용한 성능 향상Ssl 하드웨어 가속기를 이용한 성능 향상
Ssl 하드웨어 가속기를 이용한 성능 향상knight1128
 

Mais de knight1128 (17)

Comet
CometComet
Comet
 
Apache avro
Apache avroApache avro
Apache avro
 
Apache Thrift
Apache ThriftApache Thrift
Apache Thrift
 
Spring MVC 3 Restful
Spring MVC 3 RestfulSpring MVC 3 Restful
Spring MVC 3 Restful
 
Jersey framework
Jersey frameworkJersey framework
Jersey framework
 
Google Protocol buffer
Google Protocol bufferGoogle Protocol buffer
Google Protocol buffer
 
Jdk(java) 7 - 5. invoke-dynamic
Jdk(java) 7 - 5. invoke-dynamicJdk(java) 7 - 5. invoke-dynamic
Jdk(java) 7 - 5. invoke-dynamic
 
Jdk(java) 7 - 6 기타기능
Jdk(java) 7 - 6 기타기능Jdk(java) 7 - 6 기타기능
Jdk(java) 7 - 6 기타기능
 
Jdk 7 4-forkjoin
Jdk 7 4-forkjoinJdk 7 4-forkjoin
Jdk 7 4-forkjoin
 
Jdk 7 3-nio2
Jdk 7 3-nio2Jdk 7 3-nio2
Jdk 7 3-nio2
 
공유 Jdk 7-2-project coin
공유 Jdk 7-2-project coin공유 Jdk 7-2-project coin
공유 Jdk 7-2-project coin
 
공유 Jdk 7-1-short introduction
공유 Jdk 7-1-short introduction공유 Jdk 7-1-short introduction
공유 Jdk 7-1-short introduction
 
아마존 Aws 서비스_연구
아마존 Aws 서비스_연구아마존 Aws 서비스_연구
아마존 Aws 서비스_연구
 
구글크롬Os
구글크롬Os구글크롬Os
구글크롬Os
 
하이브리드앱
하이브리드앱하이브리드앱
하이브리드앱
 
오픈소스를 활용한 Batch_처리_플랫폼_공유
오픈소스를 활용한 Batch_처리_플랫폼_공유오픈소스를 활용한 Batch_처리_플랫폼_공유
오픈소스를 활용한 Batch_처리_플랫폼_공유
 
Ssl 하드웨어 가속기를 이용한 성능 향상
Ssl 하드웨어 가속기를 이용한 성능 향상Ssl 하드웨어 가속기를 이용한 성능 향상
Ssl 하드웨어 가속기를 이용한 성능 향상
 

Último

Console API (Kitworks Team Study 백혜인 발표자료)
Console API (Kitworks Team Study 백혜인 발표자료)Console API (Kitworks Team Study 백혜인 발표자료)
Console API (Kitworks Team Study 백혜인 발표자료)Wonjun Hwang
 
Continual Active Learning for Efficient Adaptation of Machine LearningModels ...
Continual Active Learning for Efficient Adaptation of Machine LearningModels ...Continual Active Learning for Efficient Adaptation of Machine LearningModels ...
Continual Active Learning for Efficient Adaptation of Machine LearningModels ...Kim Daeun
 
MOODv2 : Masked Image Modeling for Out-of-Distribution Detection
MOODv2 : Masked Image Modeling for Out-of-Distribution DetectionMOODv2 : Masked Image Modeling for Out-of-Distribution Detection
MOODv2 : Masked Image Modeling for Out-of-Distribution DetectionKim Daeun
 
A future that integrates LLMs and LAMs (Symposium)
A future that integrates LLMs and LAMs (Symposium)A future that integrates LLMs and LAMs (Symposium)
A future that integrates LLMs and LAMs (Symposium)Tae Young Lee
 
Merge (Kitworks Team Study 이성수 발표자료 240426)
Merge (Kitworks Team Study 이성수 발표자료 240426)Merge (Kitworks Team Study 이성수 발표자료 240426)
Merge (Kitworks Team Study 이성수 발표자료 240426)Wonjun Hwang
 
캐드앤그래픽스 2024년 5월호 목차
캐드앤그래픽스 2024년 5월호 목차캐드앤그래픽스 2024년 5월호 목차
캐드앤그래픽스 2024년 5월호 목차캐드앤그래픽스
 

Último (6)

Console API (Kitworks Team Study 백혜인 발표자료)
Console API (Kitworks Team Study 백혜인 발표자료)Console API (Kitworks Team Study 백혜인 발표자료)
Console API (Kitworks Team Study 백혜인 발표자료)
 
Continual Active Learning for Efficient Adaptation of Machine LearningModels ...
Continual Active Learning for Efficient Adaptation of Machine LearningModels ...Continual Active Learning for Efficient Adaptation of Machine LearningModels ...
Continual Active Learning for Efficient Adaptation of Machine LearningModels ...
 
MOODv2 : Masked Image Modeling for Out-of-Distribution Detection
MOODv2 : Masked Image Modeling for Out-of-Distribution DetectionMOODv2 : Masked Image Modeling for Out-of-Distribution Detection
MOODv2 : Masked Image Modeling for Out-of-Distribution Detection
 
A future that integrates LLMs and LAMs (Symposium)
A future that integrates LLMs and LAMs (Symposium)A future that integrates LLMs and LAMs (Symposium)
A future that integrates LLMs and LAMs (Symposium)
 
Merge (Kitworks Team Study 이성수 발표자료 240426)
Merge (Kitworks Team Study 이성수 발표자료 240426)Merge (Kitworks Team Study 이성수 발표자료 240426)
Merge (Kitworks Team Study 이성수 발표자료 240426)
 
캐드앤그래픽스 2024년 5월호 목차
캐드앤그래픽스 2024년 5월호 목차캐드앤그래픽스 2024년 5월호 목차
캐드앤그래픽스 2024년 5월호 목차
 

Redis

  • 1. Redisv2.2.12 2011.8.18 김용환 Knight76 at gmail.com Knight76.tistory.com 맛보기
  • 2. 그냥 캐쉬 서버 하지만, 먼가 달라.  TCP
  • 3.
  • 4.
  • 5. 사용상 장/단점 장점 Persistence Speed (간단한 데이터 2백만 건을 1.28초에 저장) Data Structure Atomic Operation (tx) Sharding / Replication 의 용이 Pub/sub / notification (message queue 또는 comet) - real time String(1G), Hash, List, Set, Sorted Set(score필요), intersection, union, difference In-memory 데이터 TTL, Expire Node.js를 포함하는 클라이언트가 다양한 언어에서구현. operation cost : O(1) Multiple Instance에 접속해서 item를 수집(select)후 옮길(move) 수 있음(locking지원) 단점 / 이슈 Ram mode에서는 이슈는 없지만, VM mode 를이용해서 메모리 관리할 때 속도가 많이 느려짐 In-memory라 메모리보다 큰 데이터는 적합하지 않을 수 있음(VM 모드를 사용할 때는 메모리 제한이 없음) -> 2.4부터 VM 모드 deprecated Persistence 의 snapshotting 이용시I/O 이슈가 있음 소스컴파일 설치 Sharding을 클라이언트에서 잘 지정할 필요가 있음 Replication시 blocking됨 (2.4부터 non-blocking하면서 속도개선)
  • 6.
  • 7. Portable 코드!2.4부터는 비동기로Replication 구성이 가능 * Node.js + redis사용하는사례들이 최근에 늘고 있음 * 2011년 안으로 Redis clustering을 구현할 예정 (처음부터 분산 테이블을 목표로 만들어졌기 때문에 이 부분이 구현되면 엄청난 일이 벌어질 듯..)
  • 8. 2.4 Release 내용들 http://antirez.com/post/everything-about-redis-24 Redis Main 개발자 블로그 Small sorted sets now use significantly less memory. RDB Persistence is much much faster for many common data sets. Many write commands now accept multiple arguments, so you can add multiple items into a Set or List with just a single command. This can improve the performance in a pretty impressive way. Our new allocator is jemalloc. Less memory is used by the saving child, as we reduced the amount of copy on write. INFO is more informative. However it is still the old 2.2-alike INFO, not the new one into unstable composed of sub sections. The new OBJECT command can be used to introspect Redis values. The new CLIENT command allows for connected clients introspection. Slaves are now able to connect to the master instance in a non-blocking fashion. Redis-cli was improved in a few ways. Redis-benchmark was improved as well. Make is now colorized ;) VM has been deprecated. In general Redis is now faster than ever. We have a much improved Redis test framework.
  • 9. Demo (try.redis-db.com) 2.0.2 version 이라서 그 이상의 버전에서 제공하는 API를 활용할 수 없음
  • 10. 설치 / 실행 http://redis.io/download // 설치 $ wget http://redis.googlecode.com/files/redis-2.2.12.tar.gz $ tar xzf redis-2.2.12.tar.gz $ cd redis-2.2.12 $ make // 데몬 실행 $ cd src $ cd redis-server (daemon).. Log.. // 클라이언트 실행 $ cd소스설치/src ; redis-cli redis> set foo bar OK redis> get foo "bar"
  • 11. Example Code > set foo 0 "OK" > incr foo 1 > incr foo 2 > incr foo 3 > get foo "3“ > decr foo 2 > set hello world "OK" > get hello "world" > exists hello true > type hello "string" > rename hello olleh "OK" > get olleh "world" > del olleh 1 > get olleh null > set a 1 "OK" > set b 2 "OK" > set c 3 "OK" > mget a b c ["1","2","3"] > set hello world "OK" > get hello "world" >  set a 1 ‘1’ > expire a 100 true > get a "`1" > get a "`1“ (100초 뒤) > get a null > sadd seta foo true > sadd seta bar true > saddsetb foo true > sinter seta setb ["foo"]
  • 12. Example Code > hset user:1 name x true > hset user:1 lastname y true > hset user:2 name aa true > hget user:1 wrong number of arguments (1 for 2) > hget user:1 name "x" > hgetall user:1 {"name":"x","lastname":"y"} > hget user:2 wrong number of arguments (1 for 2) > hget user:2 name "aa" > lpush list a 1 > lpush list b 2 > lpush list c 3 > lpush list d 4 > lrange list 0 2 ["d","c","b"] > lrange list 0 3 ["d","c","b","a"] > lrange list 2 3 ["b","a"] > sadd set 1 true > sadd set 2 true > sadd set 3 true > smembers set ["3","1","2"] > zaddss 1 aa true > zaddss 10 zz true > zaddss 9 yy true > zaddss 2 bb true > zrangess 0 -1 ["aa","bb","yy","zz"] LIST SET Sorted SET Hash
  • 13. Example Code > multi "OK" > lpushclist a "QUEUED" > lpushclist b "QUEUED" > lpushclist c "QUEUED" > lrangeclist 0 -1 "QUEUED" > exec [1,2,3,["c","b","a"]] > multi "OK" > lpushdlist a "QUEUED" > lpushdlist b "QUEUED" > discard "OK" TX TX Check and Set 도 가능(watch)
  • 14. Example Code [test /home/www/redis/redis-2.2.12/src]# ./redis-cli redis 127.0.0.1:6379> psubscribenews.article.*; Reading messages... (press Ctrl-C to quit) 1) "psubscribe" 2) "news.*;" 3) (integer) 1 redis 127.0.0.1:6379> multi OK redis 127.0.0.1:6379> set article.tech.1000 "Google" QUEUED redis 127.0.0.1:6379> saddarticle.tech 1000 QUEUED redis 127.0.0.1:6379> publish news.article.tech 1000 QUEUED redis 127.0.0.1:6379> exec 1) OK 2) (integer) 1 3) (integer) 0 1) "pmessage" 2) "news.article.*" 3) "news.article.tech" 4) "1000"
  • 15. DEMO Redis서버 실행 Command 이용 Java Client (jedis)이용
  • 16. Java client - Jedis 가장 좋은 java 클라이언트 라이브러리 https://github.com/xetorthio/jedis 자바의 Map, Set 같은 Collection과 연동되어 사용 가능 Sharding이 지원되다고 적혀있지만, 테스트는 해보지 않음 @Controller @RequestMapping("/restful") @ResponseStatus(value = HttpStatus.ACCEPTED) public class RestfulController { @RequestMapping(value = "/set/key/{key}/value/{value}", method = RequestMethod.GET) public String getString(@PathVariable String key, @PathVariable String value, ModelMap model) { System.out.println("key : " + key); System.out.println("value : " + value); Jedis jedis = new Jedis("1.1.1.1"); jedis.set(key, value); String kValue = jedis.get(key); model.addAttribute("key", key); model.addAttribute("value", kValue); return "test"; } } <dependency> <groupId>redis.clients</groupId> <artifactId>jedis</artifactId> <version>2.0.0</version> <type>jar</type> <scope>compile</scope> </dependency>
  • 17. 운영상 장점 백업은 리얼타임으로 진행 Master – Slave Replication이 수직/수평적으로 scale 가능 (지금 당장은 없지만) 올해 안으로 Clustering 기능 추가 예정 https://github.com/antirez/redis/blob/master/design-documents/REDIS-CLUSTER 대형 데이터 cache용 용도로 생각 memcached는 크기가 큰 데이터에 취약
  • 18. 운영상 편리 Slave 구성시 서버를 내리지 않고 사용가능. Replication 순서 slave asks for SYNC master BGSAVE, slave waits master BGSAVE finished, the initial bulk data (the .rdb file) is transfered to slave master accumulates all the new differences for the slave master finishes sending the whole initial rdb file to slave master start feeding the slave with the accumulated buffer, and with anything new arriving from clients, if they are writes.
  • 19. 운영상 이슈 & 편리 메모리에 있는 데이터들을 File system으로 덤프 Snapshotting (디폴트) 자식 프로세스 실행(fork)하고 자식프로세스가 임시(new)RDB파일 만들고, 그것을 다 저장하면 예전(old) 파일 이름으로 교체 (copy-on-write) 속도 이슈로 인해서 많이 고민했음 Append-only file (AOF) - 괜찮은 방법 2.0과 2.2가 절차가 다름. 만약 Snapshotting 하다가 Kill 되거나 비정상적 종료에 대비해서 실행 로그들을 따로 저장(Log Rewriting)하여 만약 재시작시 상태를 유지하기 위해서 AOF 파일을 읽음 자식 프로세스 실행(fork)하고, 자식 프로세스는 임시 AOF 파일을 저장한다. 부모 프로세스는 in-memory buffer에 새로 변경된 내용을 계산한다. 자식 프로세스는 쓰기 작업이 완료후에 부모 프로세스는 in-memory buffer의 내용을 AOF 파일에 저장한다. 새로운 파일로 교체.
  • 20. 운영상 편리 AOF를 이용한다면, 서버 관점에서는 정지시간 없이 Redis재시작/ 업그레이드 가능 (서버 편함) 환경 설정 정보 변경시 재실행 새로운 버전의 redis서버 재실행 포트 변경 필요, 서버의 포트를 변경하기 때문에 client의서버 접속 포트를 수정하고 재시작 필요. (client 불편) => 오히려 이거 불편. 기존 방법 사용 필요
  • 21. 운영상 편리 모니터링 https://scoutapp.com/plugin_urls/271-redis-monitoring
  • 22. 운영상 불편점 consistent hashing 을 지원하는 client를 이용해야 distribute 가능 Sharding을 일일이 클라이언트 API를 이용해서 해줘야 함. API에서 반드시 지원 2011.8.18일현재 2.2Stable (또는 2.4)버전에서는 clustering 지원 안 함 (올해 안으로 release 되기를 기대)
  • 23. 용도 간단한 카운터 캐쉬 용도 (특히 큰 데이터에서 사용 가능) 여러 개의 row를 검색해서 얻어야 하는 결과를 특정 조건에 맞추어 보여주기 (limit) 최근 30개, 순서대로(lpush, ltrim) 랭킹(zadd, zrank) Expire가 될 수 있는 카운트 정보
  • 24. Arcus개발팀 Redis한계를 지적한 부분 (SDEC 2011.6) Radis 1.2 검토 대비 최신 버전 2.2 비교 Sorted set에는 no (offset, count) option => 최신 버전에서는 offset, count 기능 추가 No capped collection => 용량제한이 있으며, FIFO기능을 갖고 있는 고성능의 테이블을 capped collection이라고 함. 원래 Redis지원 안함. 원래 빠르기 때문. Not enough cache statistics Cannot control memory use => info명령어를 이용해서 간단하게 메모리 사용량 측정 가능
  • 25. 괜찮은 Reference http://redis.io/ , http://redis.io/topics/faq http://simonwillison.net/static/2010/redis-tutorial/ http://www.slideshare.net/tag/redis/ http://blog.mjrusso.com/2010/10/17/redis-from-the-ground-up.html http://www.slideshare.net/Cyworld/004-cto http://pauladamsmith.com/articles/redis-under-the-hood.html http://hi.baidu.com/roger_long/blog/item/611b1d017f57f89de950cd87.html http://redis.io/presentation/Redis_Cluster.pdf http://www.slideshare.net/karmi/redis-the-ak47-of-postrelational-databases http://pauladamsmith.com/blog/2011/03/redis_get_set.html
  • 26. Cache 서버를 내가 구축한다면 value(field)의 데이터가 큰 경우에 사용하는 경우. (작아도 상관없음) DB 앞단의캐쉬보다는 주기적인 데이터를 저장 메모리를 많이 추가한 서버 구성 클러스터링과Replication을 잘 구축. 관련 admin 개발 Java client를 이용해서 Sharding을 잘 할 수 있도록 admin 구축 Cache 서버 Web App Server Redis Java Client (legacy 지원) (Clustering) Redis Java Client + Cron + Spring Batch (admin) Mysql (백업) Message Queue Redis DB