Instroduce Hazelcast

4,715 views

Published on

Published in: Technology, Education
0 Comments
4 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
4,715
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
55
Comments
0
Likes
4
Embeds 0
No embeds

No notes for slide

Instroduce Hazelcast

  1. 1. Hazelcast[ˈheizəlkɑ:st]jushi@taobao.com
  2. 2. Hazelcast is an open sourceclustering and highly scalable datadistribution platform for Java -- www.hazelcast.com
  3. 3. Get started from code example从代码入手
  4. 4. Map.put(key, value) => partitions[hash&mod(key)] .addEntry(key, value)
  5. 5. Map.put(key, value) => partitions[hash&mod(key)] .getOwner() .addEntry(key, value)
  6. 6. Blocks (Partitions) 0 1 2 … 270Hazelcast Instance (Node)
  7. 7. Map is everything有了MAP, 就有了一切
  8. 8. Set.add(value) => Map.put(value, true)
  9. 9. Queue.offer(value) => key = Master.genKeyBy(qName) index = Integer.MAX_VALUE Map.put(key, value) Master.add(key, index)
  10. 10. Queue.poll() => key = Master.takeKeyBy(qName) Map.get(key)
  11. 11. http://hazelcast.googlecode.com/svn/trunk/
  12. 12. Eviction & Persistence逐出与存储
  13. 13. enum EvictionPolicy { LRU, LFU, NONE}interface MapMaxSizePolicy { boolean overCapacity()}
  14. 14. periodRun() => Records.foreach { case isDirty(record) => store(record) case isEvictable(record) => evict(record) case isPurgeable(record) => purge(record) }
  15. 15. interface MapStore<K, V> {...} ???
  16. 16. Cluster集群
  17. 17. Member / Super ClientMap map = Hazelcast.getMap(“default”); Java ClientMap map = HazelcastClient .newHazelcastClient(“dev”, “pass”, ...) .getMap(“default”);
  18. 18. Super Clients are members with no storage.
  19. 19. <<Master>> Node 1 Node 2
  20. 20. Split Brain<<Master>> <<Master>>
  21. 21. backup, migration备份与迁移
  22. 22. (key, value) Node 2<<Master>> Node 1 Node 3 Node 4
  23. 23. <<Master>> Node 1 Node 2
  24. 24. Summary总结
  25. 25. 应用模式 Application Hazelcast Client Application ClientHazelcast Instance Application Hazelcast Instance
  26. 26. 优点 缺点• 接口丰富 • 无存储实现• 使用简单 • 代码复杂• 监控完善 • 测试覆盖较低
  27. 27. In-Memory Data Grid
  28. 28. Q&A
  29. 29. References参考
  30. 30. http://www.hazelcast.com/files/hazelcast-presentation.pdfhttp://hazelcast.com/docs/1.9.4/manual/single_html/http://www.hazelcast.com/screencast.jsp
  31. 31. Code review guide源码导读
  32. 32. Hazelcast FactoryImpl Node BaseManager ClusterService ConcurrentMapManager CMap BlockQueueManager BQ PartitionManager ClusterManager Joiner
  33. 33. EOF

×