Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HazelCast(Local Cache) #150

Open
cheonjeongdae opened this issue Oct 30, 2018 · 0 comments
Open

HazelCast(Local Cache) #150

cheonjeongdae opened this issue Oct 30, 2018 · 0 comments

Comments

@cheonjeongdae
Copy link
Contributor

cheonjeongdae commented Oct 30, 2018

[ 손권남 페이스북에서 퍼옴 ]

나는 Java에서 "캐시 목적으로" Redis나 Memcached를 되도록 사용하지 않길 권한다.

  • 일단 서버 추가로 인한 운영부담
  • Network 대역폭 차지, Network 전송에 의한 Latency 증가
  • 캐시 대상 객체 필드가 변경되었을 때직렬화 문제 발생 - 배포하는 도중에 예를들면 꼭 필요한 필드가 존재하지 않는 상황등 발생. 이게 제일 골치아픔.

이에 대한 해결책으로 Java 에는 다양한 Local Cache 솔루션들이 있다. 당연히 In Memory Local Cache이므로 성능은 엄청좋고, 직렬화 과정이 없으므로 객체 변경으로 인한 문제도 발생하지 않는다.

그중에서도 Local Cache를 하되, Update/Delete 시에 다른 Java instance들에게 해당 데이터를 evict 시키라고 신호를 주는 방식으로 정합성을 맞춰줄 수 있다. 물론 다른 서버들은 새로운 객체를 DB에서 다시 읽어야 한다. 하지만 이로인한 손실은 매우 작다. 매번 원격 캐시 Network 호출하는 것에 비하면 새발의 피.
(Infinispan 문서에서는 이런것을 Replication-Invalidation 모드라고 부르는 듯)

아래 글은 바로 HazelCast를 이용해 Update/Delete 동기화된 Local Cache를 구현하는 방법인데 나도 해봐야지~
안그래도 Infinispan으로 해보려고 맘먹고 있었는데.

https://pkgonan.github.io/2018/10/hazelcast-hibernate-second-level-cache?fbclid=IwAR38_W2BETzmg5eZIBZRxvIz_Cgai7_PfM-WdibmzWvVunbJMtAzw7YfimQ

@cheonjeongdae cheonjeongdae changed the title Local Cache HazelCast(Local Cache) Oct 31, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant