39
DISTRIBUTED COMPUTING WITH HAZELCAST www.hazelcast.com

Distributed computing with Hazelcast - JavaOne 2014

Embed Size (px)

Citation preview

Page 1: Distributed computing with Hazelcast - JavaOne 2014

DISTRIBUTED COMPUTINGWITH HAZELCAST

www.hazelcast.com

Page 2: Distributed computing with Hazelcast - JavaOne 2014

DISCLAIMERThis presentation may include certain forward-looking statements and projections provided bythe Company. Any such statements and projections reflect various estimates and assumptionsby the Company concerning anticipated results. These statements involve risks, uncertainties

and assumptions and are based on the current estimates and assumptions of the managementof the Company as of the date of this presentation and are subject to uncertainty and changes.

No representations or warranties are made by the Company as to the accuracy of any suchstatements or projections. Whether or not any such forward-looking statements or projectionsare in fact achieved will depend upon future events some of which are not within the control of

the Company. Accordingly, actual results may vary from the projected results and suchvariations may be material. Statements contained herein describing documents and

agreements are summaries only and such summaries are qualified in their entirety by referenceto such documents and agreements.

www.hazelcast.com

Page 3: Distributed computing with Hazelcast - JavaOne 2014

THAT'S MEChris(toph) EngelbertTwitter: @noctarius2k8+ years of Java WeirdonessPerformance, GC, traffic topicsApache CommitterGaming, Travel Management, ...

www.hazelcast.com

Page 4: Distributed computing with Hazelcast - JavaOne 2014

OUR SPACE TRIP ROADMAPHazelcastDistributed ComputingDistributed ExecutorServiceEntryProcessorMap & ReduceQuestions

www.hazelcast.com

Page 5: Distributed computing with Hazelcast - JavaOne 2014

HAZELCASTPICKIN' DIAMONDS

www.hazelcast.com

Page 6: Distributed computing with Hazelcast - JavaOne 2014

WHAT IS HAZELCAST?In-Memory Data-GridData Partioning (Sharding)Java Collections ImplementationDistributed Computing Platform

www.hazelcast.com

Page 7: Distributed computing with Hazelcast - JavaOne 2014

WHY HAZELCAST?Automatic PartitioningFault ToleranceSync / Async BackupsFully DistributedIn-Memory for Highest Speed

www.hazelcast.com

Page 8: Distributed computing with Hazelcast - JavaOne 2014

WHY HAZELCAST?

www.hazelcast.com

Page 9: Distributed computing with Hazelcast - JavaOne 2014

www.hazelcast.com

Page 10: Distributed computing with Hazelcast - JavaOne 2014

WHY IN-MEMORYCOMPUTING?

www.hazelcast.com

Page 11: Distributed computing with Hazelcast - JavaOne 2014

TREND OF PRICES

Data Source: http://www.jcmit.com/memoryprice.htm

www.hazelcast.com

Page 12: Distributed computing with Hazelcast - JavaOne 2014

SPEED DIFFERENCE

Data Source: http://i.imgur.com/ykOjTVw.png

www.hazelcast.com

Page 13: Distributed computing with Hazelcast - JavaOne 2014

DISTRIBUTEDCOMPUTING

OR

MULTICORE CPU ON STEROIDS

www.hazelcast.com

Page 14: Distributed computing with Hazelcast - JavaOne 2014

THE IDEA OF DISTRIBUTED COMPUTING

Source: https://www.flickr.com/photos/stefan_ledwina/1853508040

www.hazelcast.com

Page 15: Distributed computing with Hazelcast - JavaOne 2014

THE BEGINNING

Source: http://en.wikipedia.org/wiki/File:KL_Advanced_Micro_Devices_AM9080.jpg

www.hazelcast.com

Page 16: Distributed computing with Hazelcast - JavaOne 2014

MULTICORE IS NOT NEW

Source: http://en.wikipedia.org/wiki/File:80386with387.JPG

www.hazelcast.com

Page 17: Distributed computing with Hazelcast - JavaOne 2014

CLUSTER IT

Source: http://rarecpus.com/images2/cpu_cluster.jpg

www.hazelcast.com

Page 18: Distributed computing with Hazelcast - JavaOne 2014

SUPER COMPUTER

Source: http://www.dkrz.de/about/aufgaben/dkrz-geschichte/rechnerhistorie-1

www.hazelcast.com

Page 19: Distributed computing with Hazelcast - JavaOne 2014

CLOUD COMPUTING

Source: https://farm6.staticflickr.com/5523/11407118963_e0e0870846_b_d.jpg

www.hazelcast.com

Page 20: Distributed computing with Hazelcast - JavaOne 2014

DISTRIBUTEDEXECUTORSERVICE

THE WHOLE CLUSTER IN YOUR HANDS

www.hazelcast.com

Page 21: Distributed computing with Hazelcast - JavaOne 2014

WHY A DISTRIBUTED EXECUTORSERVICE?j.l.Runnable / j.u.c.CallableOnly needs to be serializableSame Task all / multiple NodesShould not work on Data

www.hazelcast.com

Page 22: Distributed computing with Hazelcast - JavaOne 2014

Talk to me from all nodes

QUICK EXAMPLE

Runnable runnable = () -> println( "Hello from my Cluster-World" );IExecutorService es = hzInstance.getExecutorService( "default" );es.executeOnAllMembers( runnable );

www.hazelcast.com

Page 23: Distributed computing with Hazelcast - JavaOne 2014

DEMONSTRATION

www.hazelcast.com

Page 24: Distributed computing with Hazelcast - JavaOne 2014

ENTRYPROCESSORLOCKFREE DATA OPERATIONS

www.hazelcast.com

Page 25: Distributed computing with Hazelcast - JavaOne 2014

WHY ENTRYPROCESSOR?Prevents external LockingGuarantees AtomicityKind of a "Cluster-wide Thread-Safe"

www.hazelcast.com

Page 26: Distributed computing with Hazelcast - JavaOne 2014

Incrementing a counter atomically

QUICK EXAMPLE

private int increment( Map.Entry entry ) { val newValue = entry.getValue() + 1; entry.setValue( newValue ); return newValue;}

IMap map = hazelcastInstance.getMap( "default" );int newId = map.executeOnKey( "idgen", this::increment );

www.hazelcast.com

Page 27: Distributed computing with Hazelcast - JavaOne 2014

DEMONSTRATION

www.hazelcast.com

Page 28: Distributed computing with Hazelcast - JavaOne 2014

MAP & REDUCETHE BLACK MAGIC FROM PLANET GOOGLE

www.hazelcast.com

Page 29: Distributed computing with Hazelcast - JavaOne 2014

USE CASESLog AnalysisData QueryingAggregation and summingDistributed SortETL (Extract Transform Load)and more...

www.hazelcast.com

Page 30: Distributed computing with Hazelcast - JavaOne 2014

SIMPLE STEPSReadMap / TransformReduce

www.hazelcast.com

Page 31: Distributed computing with Hazelcast - JavaOne 2014

FULL STEPSReadMap / TransformCombiningGrouping / ShufflingReduceCollating

www.hazelcast.com

Page 32: Distributed computing with Hazelcast - JavaOne 2014

MAPREDUCE WORKFLOW

www.hazelcast.com

Page 33: Distributed computing with Hazelcast - JavaOne 2014

Data are mapped / transformed in a set of key-value pairs

SOME PSEUDO CODE (1/3)

MAPPING

map( key:String, document:String ):Void -> for each w:Word in document: emit( w, 1 )

www.hazelcast.com

Page 34: Distributed computing with Hazelcast - JavaOne 2014

Multiple values are combined to an intermediate result to preserve traffic

SOME PSEUDO CODE (2/3)

COMBINING

combine( word:Word, counts:List[Int] ):Void -> emit( word, sum( counts ) )

www.hazelcast.com

Page 35: Distributed computing with Hazelcast - JavaOne 2014

Values are reduced / aggregated to the requested result

SOME PSEUDO CODE (3/3)

REDUCING

reduce( word:String, counts:List[Int] ):Int -> return sum( counts )

www.hazelcast.com

Page 36: Distributed computing with Hazelcast - JavaOne 2014

FOR MATHEMATICIANSProcess: (K x V)* → (L x W)* ⇒ [(l1, w1), …, (lm, wm)]

Mapping: (K x V) → (L x W)* ⇒ (k, v) → [(l1, w1), …, (ln, wn)]

Reducing: L x W* → X* ⇒ (l, [w1, …, wn]) → [x1, …,xn]

www.hazelcast.com

Page 37: Distributed computing with Hazelcast - JavaOne 2014

MAPREDUCE PROGRAMS INGOOGLE SOURCE TREE

Source: http://research.google.com/archive/mapreduce-osdi04-slides/index-auto-0005.html

www.hazelcast.com

Page 38: Distributed computing with Hazelcast - JavaOne 2014

DEMONSTRATION

www.hazelcast.com

Page 39: Distributed computing with Hazelcast - JavaOne 2014

@noctarius2k@hazelcast

http://www.sourceprojects.comhttp://github.com/noctarius

THANK YOU!ANY QUESTIONS?

www.hazelcast.com