Upload
gilwon-oh
View
208
Download
9
Embed Size (px)
Citation preview
Gilwon Oh
2015.04.17 v1.0
Guess? (For Fun)
Cache
API Gateway
Cache In API Gateway
Conclusion & Useful Links
Guess? (For Fun) Cache
API Gateway
Cache In API Gateway
Conclusion & Useful Links
서울~부산(뉴욕) 까지 걸어서몇 시간 걸릴까요?
서울 에서 뉴욕 PC의 사진을1,000장 다운로드 하는데
얼마나 걸릴까요?
AWS EC2 JP Tokyo에 설치를하면 미국 West, East
어느 Zone에 설치하는 것이
더 빠를까요?
AWS EC2의 JP <-> JP,
JP <-> Singapore, JP <-> US
각각의 경우에 Delay는 얼마정도 생길까요?
우리 나라에서 해외로 연결된해저 광 케이블 망이 있는 곳은?
나의 Local Disk에서 데이터를읽는것과 vs 내 PC에서 일본 PC Memory 안에있는데이터를읽으면 대략 속도차이가얼마정도 날까요?
도로원표: 도시간의거리를측정할때는사용
천문단위(AU): 지구에서 태양까지의 거리 (약 150,000,000 Km)
지구 한 바퀴: 약 40,000 km (반지름: 6,400km)
지구에서 달: 약 384,400 km
광속 : 진공상태에서 빛이나아가는속도 (약 300,000 km/s)
음속: 시속 1,224km 음속이초당 340미터(섭씨 15도)
마하: 소리의 속도에비해서 얼마나빠른지http://study.zum.com/book/13481
http://www.cablemap.info http://ora24.cafe24.com/Science/E_Signal.htm
전기전달되는속도 = 빛의속도
태안거제부산
http://www.turnkeylinux.org/blog/aws-datacenters
https://twitter.com/rzezeski/status/398306728263315456
(*1 ms: 10−3 1 μs: 10−6 1 ns: 10⁻⁹Millennia(Millennium): 1000 years )
Guess? (For Fun)
Cache API Gateway
Cache In API Gateway
Conclusion & Useful Links
DBWASClient WEB
HTTP Cache
. Browser caches
. Proxy caches
. Gateway caches(reverse proxy cache)
DNS Cache
…
CPU Cache
Page Cache
Disk Cache
...
DB Internal Cache
Focus on
WebService Cache
Especially API Gateway
*Java Cache 표준 (Jboss inifinispan 주도)
JSR 107 : JCACHE - Java Temporary Caching API
JSR 347 : Data Grids for the Java platform (2015.1 withdrawal OTL)
Replication
Cache
Invalidation
Cache
Distribution
+L1 Cache
Distribution
Cache
Local
Cache
http://www.slideshare.net/opennaru/in-memory-data-grid-infinispanjboss-data-grid
Focus on
Distribution +
Local Cache 유지
Local Cache+
데이터변경시다른서버동일키삭제
Cache 공유 X 모든 Cache 동일복제Cache 1/n으로 분산,
Cache 없으면다른 Node에물어봄
General Hash
(ex: Elasticsearch shards)
vs Consistent Hashing
(ex: infinspan, memcache)
Cache Aside Pattern
Client가 R/W Storage
책임
Storage
Client
Cache
Write-behind Pattern
비동기적으로 Storage
Write (보통 delay 세팅시간 후)
Storage
Client
Cache
Read Through/
Write Through
Cache가 R/W
Storage 책임
Storage
Client
Cache
Refresh-Ahead Pattern
주기적으로 최근에 접근한 cache Data를 Reload
Storage
Client
Cache
http://www.slideshare.net/tmatyashovsky/from-cache-to-in-memory-data-grid-introduction-to-hazelcast
http://docs.oracle.com/cd/E15357_01/coh.360/e15723/cache_rtwtwbra.htm#COHDG5181
Guess? (For Fun)
Cache
API Gateway Cache In API Gateway
Conclusion & Useful Links
API-G #1
API-G #2
4. Check
Throttling &
API Burst
1. API Call 2. API Validation
3. 2 Auth.
5. Mediation
Service #1
Service #2
Service #3
……
6. Target Service CallStorage
#1Storage
#2
Interface
WAS #1
API-G
WAS #1
API-G
WAS #2
Interface
WAS #2Use Remote Cache
4. Check
Throttling &
API Burst
1. API Call 2. API Validation
3. 2 Auth.
5. Mediation
Service #1
Service #2
Service #3
……
6. Target Service Call
Management
Center #1,2
Internal Interface
API Use Flow
CRUD: API Infra Data
How To use cache?
DB DB
Storage
#1Storage
#2
Guess? (For Fun)
Cache
API Gateway
Cache In API Gateway Conclusion & Useful Links
Interface
WAS #1
Cache
Interface
WAS #2
Cache
Cache Replication
Use Remote Cache
Management
Center #1,2
Internal Interface
API Use Flow
CRUD: API Infra Data
DB DB
API-G
WAS #1Cache
API-G
WAS #2Cache
Redis(Slave)
Redis(Master)
4. Check
Throttling &
API Burst
1. API Call 2. API Validation
3. 2 Auth.
5. Mediation
Service #1
Service #2
Service #3
……
6. Target Service Call
Use Ehcache-RMI P2P
Use Redis-Sentinel
JPN USA
Use Replication Cache?
Infinispan vs Hazlecast vs Ehcache-jGroups
Gossip
Router #1Gossip
Router #2
JPN USA
Use Ehcache-JGroups
Ehcache-JGroups
Maybe almost same as
Infinispan library mode
Cache in API Gateway
|- Infra Data(Replication Cache)
|- Ehcache-RMI
|- Ehcache-JGroups (*Infinspan)
|- API Burst & Throttling
|- Redis, Redis-Sentinel(*Redis-Cluster)
|- Http Cache (SKIP)
https://tedwon.atlassian.net/wiki/display/SE/Ehcache+Replicated+Cache
http://www.slideshare.net/HyeonSeokChoi/overview-of-the-ehcache
http://www.nextree.co.kr/p3151/ (아키텍처설계: 분산캐시-EhCache+TerracottaServer Array)
http://www.slideshare.net/alexmiller/scaling-your-cache
http://ehcache.org/documentation/2.8/get-started/getting-started
http://www.slideshare.net/charsyam2/webservice-cache-strategyhttp://www.slideshare.net/charsyam2/cache-governancepubhttp://www.slideshare.net/charsyam2/redis-edu-1http://www.slideshare.net/charsyam2/redis-edu-2http://www.slideshare.net/charsyam2/redis-edu-3http://www.slideshare.net/charsyam2/redis-edu-4http://www.slideshare.net/charsyam2/redis-edu-5
http://www.slideshare.net/krisjeong/this-is-redis-kor-slidesharehttp://www.slideshare.net/krisjeong/redis-data-design-by
http://www.joinc.co.kr/modules/moniwiki/wiki.php/man/12/REDIS/DataModelinghttp://www.slideshare.net/Byungwook/redis-data-modeling-examples
http://www.mimul.com/pebble/default/2012/09/28/1348812530141.html
http://www.slideshare.net/opennaru/in-memory-data-grid-infinispanjboss-data-gridhttp://bcho.tistory.com/m/post/883
http://www.slideshare.net/jaehongc/jco-2014?related=1 (인피니스팬데이터그리드따라잡기 (@JCO 2014) )
이제필요한것은 In Memory Data Gridhttp://helloworld.naver.com/helloworld/106824
in memory computinghttp://blog.lgcns.com/176
https://labs.consol.de/java-caches (Ehcache vs Hazelcast vs Infinispan)
http://www.slideshare.net/tmatyashovsky/from-cache-to-in-memory-data-grid-introduction-to-hazelcast
http://www.slideshare.net/tmatyashovsky/distributed-applications-using-hazelcast?from_m_app=android
http://blog.ragozin.info/2009/04/caches-are-everywhere.html
http://cutajar.weebly.com/not-a-blog/caching-techniques
확장성 있는 웹 아키텍처와 분산 시스템http://helloworld.naver.com/helloworld/textyle/206816
확장 가능한 분산 인 메모리 캐시를 제공하는 ElastiCachehttp://pyrasis.com/book/TheArtOfAmazonWebServices/Chapter15
분산 메모리기반 플랫폼 Plandas # Cache Cloud http://readme.skplanet.com/?p=8884
http://knowledgecloud.tistory.com/entry/EC2-에서-클러스터링-시-유연한-설정-가져가기
한글자료가 거의 없어요
(Y.Y)(T.T)
네트웍 기초가
튼튼해야함
-맛보기로 살짝 소개-
GROUP (within the same LAN, or across a WAN)
Process
Process
Process
message
Process
join
leave or crash
message
It consists of 3 parts:
(1) Channel
used by application programmers to build
reliable group communication applications
(2) Building blocks
layered on top of the channel and
provide a higher abstraction level
(3) Protocol stack
protocols implements the properties specified
for a given channel.
Application
Building blocks
JChannel
GMS
MERGE
FRAG
UDP/TCP
Network
Figure 1.1 the architecture of JGroups
Application
Building blocks
JChannel
GMS
MERGE
FRAG
UDP/TCP
Network
Figure 1.1 the architecture of JGroups
send()
Message delivery
receive() callback
Network listenTransport
protocol
Topmost
protocol
connect
/disconn.
start
/stop
close
destory
(release)
Message delivery
Protocol List
Transport UDP, TCP, Tunnnel
Initial membership
discovery
PING, TCPPING, TCPGOSSIP, MPING, FILE_PING, JDBC_PING, BPING, RACKSPACE_PING, S3_PING,
SWIFT_PING, AWS_PING, PDC(Persistent Discovery Cache)
Merging after a network
partition
MERGE2, MERGE3
Failure Detection FD, FD_ALL, FD_SOCK, FD_PING, VERIFY_SUSPECT
Reliable Message
Transmission
Pbcast.NAKACK, NAKACK2, UNICAST, UNICAST2, UNICAST3, RSVP
Message stability STABLE
Group Membership Pbcast.GMS
Flow control FC, MFC, UFC
Fragmentation FRAG, FRAG2
Ordering SEQUENCE, Total Order Anycast(TOA)
State Transfer Pbcast.STATE_TRANSFER, StreamingStateTransfer, pbcast.STATE, STATE_SOCK, BARRIER
Pbcast.FLUSH
Misc Statistics, Security, COMPRESS, SCOPE, RELAY, RELAY2, STOMP, DAISYCHAIN, RATE_LIMITER, Locking
protocols, CENTRAL_EXECUTOR, COUNTER, SUPERVISOR
GROUP Viewapi-g1-9235(coordinator)
api-g2-32349
api-g3-23412Channel
(api-g1-29235)Channel
(api-g2-32349)
Channel
(api-g3-23412)
FD_SOCK
FD
VERIFY_SUSPECT
GMS
GMS
VERIFY_SUSPECT
FD
FD_SOCK
FD_SOCK
FD
VERIFY_SUSPECT
GMS
FD HeartBeat
FD HeartBeat FD HeartBeat
FD Sock Connection
FD Sock Connection FailFD Sock Connection
SUSPECT
ping
1
2
34 view changing
Thank You!