jaxlondon - squeezing performance of imdgs

48
© 2014 Hazelcast Inc. Squeezing Performance out of In-Memory Data Grids FUAD MALIKOV HAZELCAST CO-FOUNDER

Upload: hazelcast

Post on 27-Jun-2015

175 views

Category:

Software


1 download

TRANSCRIPT

Page 1: JAXLondon - Squeezing Performance of IMDGs

© 2014 Hazelcast Inc.

Squeezing Performance !out of In-Memory Data Grids

FUAD MALIKOVHAZELCAST CO-FOUNDER

Page 2: JAXLondon - Squeezing Performance of IMDGs

© 2014 Hazelcast Inc.

About me

2

Follow  me  @fuadm

Hazelcast co-founder!

Java Developer since 2005!

Worked at Financials and Telco’s. !

Leading Hazelcast Technical Operations.

Page 3: JAXLondon - Squeezing Performance of IMDGs

© 2014 Hazelcast Inc.

Agenda - 50 Minutes + Q&A

3

Overview to IMDG’s!Hazelcast Partitioning Basics!A Shopping Cart Use – Case!8 possible solutions!Q&A

Page 4: JAXLondon - Squeezing Performance of IMDGs

© 2014 Hazelcast Inc.

What is an IMDG?

4

Data Structures(s) in memory!Distributed across servers !Highly Available and Resilient!Horizontal Scalability!Object based Data Model

Page 5: JAXLondon - Squeezing Performance of IMDGs

© 2014 Hazelcast Inc.

Why an IMDG?

Performance - RAM is faster than Disk!

Data Structure - linked data model and application code !

Scalability - add servers to scale out RAM and CPU!

Resiliency - seamless recovery from node failures!

API - native, flexible and rich functionality

5

Page 6: JAXLondon - Squeezing Performance of IMDGs

© 2014 Hazelcast Inc.

Popular In-Memory Data Grids

Oracle Coherence !Gigaspaces!Gemfire!IBM ExtremeScale!

Infinispan!GridGain!Hazelcast!Terracotta*

6

Page 7: JAXLondon - Squeezing Performance of IMDGs

© 2014 Hazelcast Inc.

Hazelcast

7

Page 8: JAXLondon - Squeezing Performance of IMDGs

© 2014 Hazelcast Inc.

Data Distribution

8

Page 9: JAXLondon - Squeezing Performance of IMDGs

© 2014 Hazelcast Inc.

Partitioning (1 node)

9

P_1

P_2

P_271

PARTITION_COUNT  =  271  partition_id  =  hash(serialize(key))%PARTITION_COUNT

Page 10: JAXLondon - Squeezing Performance of IMDGs

© 2014 Hazelcast Inc.

Partitioning (2 nodes)

10

P_1

P_2

P_135

P_136

P_137

P_271

P_136

P_137

P_271

P_1

P_2

P_135

Page 11: JAXLondon - Squeezing Performance of IMDGs

© 2014 Hazelcast Inc.

Partitioning (4 nodes)

11

P_1

P_2

P_67

P_68

P_69

P_136

P_68

P_137

P_271

P_1

P_138

P_205

P_137

P_138

P_204

P_205

P_206

P_271

P_2

P_69

P_206

P_67

P_136

P_204

Page 12: JAXLondon - Squeezing Performance of IMDGs

© 2014 Hazelcast Inc.

Example

12

P_1

P_2

P_67

P_68

P_69

P_136

P_68

P_137

P_271

P_1

P_138

P_205

P_137

P_138

P_204

P_205

P_206

P_271

P_2

P_69

P_206

P_67

P_136

P_204

map.put(“LHR”,  “London  Heathrow  Airport”)?

Page 13: JAXLondon - Squeezing Performance of IMDGs

© 2014 Hazelcast Inc.

Hashing

13

P_1

P_2

P_67

P_68

P_69

P_136

P_68

P_137

P_271

P_1

P_138

P_205

P_137

P_138

P_204

P_205

P_206

P_271

P_2

P_69

P_206

P_67

P_136

P_204

P_200Hash(“LHR”)-­‐  >  

map.put(“LHR”,  “London  Heathrow  Airport”)?

Page 14: JAXLondon - Squeezing Performance of IMDGs

© 2014 Hazelcast Inc.

Hashing

14

P_1

P_2

P_67

P_68

P_69

P_136

P_68

P_137

P_271

P_1

P_138

P_205

P_137

P_138

P_204

P_205

P_206

P_271

P_2

P_69

P_206

P_67

P_136

P_204

1

map.put(“LHR”,  “London  Heathrow  Airport”)?

Page 15: JAXLondon - Squeezing Performance of IMDGs

© 2014 Hazelcast Inc.

Hashing

15

P_1

P_2

P_67

P_68

P_69

P_136

P_68

P_137

P_271

P_1

P_138

P_205

P_137

P_138

P_204

P_205

P_206

P_271

P_2

P_69

P_206

P_67

P_136

P_204

2

1

map.put(“LHR”,  “London  Heathrow  Airport”)?

Page 16: JAXLondon - Squeezing Performance of IMDGs

© 2014 Hazelcast Inc.

Hashing

16

P_1

P_2

P_67

P_68

P_69

P_136

P_68

P_137

P_271

P_1

P_138

P_205

P_137

P_138

P_204

P_205

P_206

P_271

P_2

P_69

P_206

P_67

P_136

P_204

2

13

map.put(“LHR”,  “London  Heathrow  Airport”)?

Page 17: JAXLondon - Squeezing Performance of IMDGs

© 2014 Hazelcast Inc.

Hashing

17

P_1

P_2

P_67

P_68

P_69

P_136

P_68

P_137

P_271

P_1

P_138

P_205

P_137

P_138

P_204

P_205

P_206

P_271

P_2

P_69

P_206

P_67

P_136

P_204

2

4

13

map.put(“LHR”,  “London  Heathrow  Airport”)?

Page 18: JAXLondon - Squeezing Performance of IMDGs

© 2014 Hazelcast Inc.

Hashing

18

P_1

P_2

P_67

P_68

P_69

P_136

P_68

P_137

P_271

P_1

P_138

P_205

P_137

P_138

P_204

P_205

P_206

P_271

P_2

P_69

P_206

P_67

P_136

P_204

map.get(“LHR”)?

Page 19: JAXLondon - Squeezing Performance of IMDGs

© 2014 Hazelcast Inc.

Hashing

19

P_1

P_2

P_67

P_68

P_69

P_136

P_68

P_137

P_271

P_1

P_138

P_205

P_137

P_138

P_204

P_205

P_206

P_271

P_2

P_69

P_206

P_67

P_136

P_204

map.get(“LHR”)?

1

Page 20: JAXLondon - Squeezing Performance of IMDGs

© 2014 Hazelcast Inc.

Hashing

20

P_1

P_2

P_67

P_68

P_69

P_136

P_68

P_137

P_271

P_1

P_138

P_205

P_137

P_138

P_204

P_205

P_206

P_271

P_2

P_69

P_206

P_67

P_136

P_204

map.get(“LHR”)?

12

Page 21: JAXLondon - Squeezing Performance of IMDGs

© 2014 Hazelcast Inc.

Use - Case

21

Page 22: JAXLondon - Squeezing Performance of IMDGs

© 2014 Hazelcast Inc.

Shopping card example

22

Page 23: JAXLondon - Squeezing Performance of IMDGs

© 2014 Hazelcast Inc.

Shopping Cart Item

23

Page 24: JAXLondon - Squeezing Performance of IMDGs

© 2014 Hazelcast Inc.

Shopping Cart

24

Page 25: JAXLondon - Squeezing Performance of IMDGs

© 2014 Hazelcast Inc.

Simulation

25

Page 26: JAXLondon - Squeezing Performance of IMDGs

© 2014 Hazelcast Inc.

Simulation

26

#[Mean        =          2402.112,  StdDeviation      =          4519.652]  #[Max          =      148504.576,  Total  count        =                56690]  Operations  Per  Second=  5738

Page 27: JAXLondon - Squeezing Performance of IMDGs

© 2014 Hazelcast Inc.

Simulation

27

#[Mean        =          2402.112,  StdDeviation      =          4519.652]  #[Max          =      148504.576,  Total  count        =                56690]  Operations  Per  Second=  5738

What  is  wrong  here?    

Page 28: JAXLondon - Squeezing Performance of IMDGs

© 2014 Hazelcast Inc.

Lock

28

Page 29: JAXLondon - Squeezing Performance of IMDGs

© 2014 Hazelcast Inc.

Lock

29

#[Mean        =          3700.329,  StdDeviation      =          2750.031]  #[Max          =        56918.016,  Total  count        =                27045]  Operations  Per  Second=  2704

Page 30: JAXLondon - Squeezing Performance of IMDGs

© 2014 Hazelcast Inc.

Lock

30

#[Mean        =          3700.329,  StdDeviation      =          2750.031]  #[Max          =        56918.016,  Total  count        =                27045]  Operations  Per  Second=  2704

Can  we  improve  this  a  little  bit?    

Page 31: JAXLondon - Squeezing Performance of IMDGs

© 2014 Hazelcast Inc.

XA Transaction

31

Page 32: JAXLondon - Squeezing Performance of IMDGs

© 2014 Hazelcast Inc.

XA Transaction

32

#[Mean        =          4077.075,  StdDeviation      =          2119.846]  #[Max          =        43155.456,  Total  count        =                24561]  Operations  Per  Second=  2456

Page 33: JAXLondon - Squeezing Performance of IMDGs

© 2014 Hazelcast Inc.

XA Transaction

33

#[Mean        =          4077.075,  StdDeviation      =          2119.846]  #[Max          =        43155.456,  Total  count        =                24561]  Operations  Per  Second=  2456

Didn’t  improve  that  much.  Why?    

Page 34: JAXLondon - Squeezing Performance of IMDGs

© 2014 Hazelcast Inc.

Local Transaction

34

Page 35: JAXLondon - Squeezing Performance of IMDGs

© 2014 Hazelcast Inc.

Local Transaction

35

#[Mean        =          2654.831,  StdDeviation      =          5011.547]  #[Max          =      133955.584,  Total  count        =                56761]  Operations  Per  Second=  5726

Page 36: JAXLondon - Squeezing Performance of IMDGs

© 2014 Hazelcast Inc.

Local Transaction

36

#[Mean        =          2654.831,  StdDeviation      =          5011.547]  #[Max          =      133955.584,  Total  count        =                56761]  Operations  Per  Second=  5726

Can  we  do  it  without  a  Transaction?    

Page 37: JAXLondon - Squeezing Performance of IMDGs

© 2014 Hazelcast Inc.

Compare and swap instead of locking

37

Page 38: JAXLondon - Squeezing Performance of IMDGs

© 2014 Hazelcast Inc.

Compare and swap instead of locking

38

#[Mean        =          2540.975,  StdDeviation      =          5113.372]  #[Max          =      133365.760,  Total  count        =                60087]  Operations  Per  Second=  6082

Page 39: JAXLondon - Squeezing Performance of IMDGs

© 2014 Hazelcast Inc.

Compare and swap instead of locking

39

#[Mean        =          2540.975,  StdDeviation      =          5113.372]  #[Max          =      133365.760,  Total  count        =                60087]  Operations  Per  Second=  6082

What  other  options  do  we  have?    

Page 40: JAXLondon - Squeezing Performance of IMDGs

© 2014 Hazelcast Inc.40

Page 41: JAXLondon - Squeezing Performance of IMDGs

© 2014 Hazelcast Inc.

Move operation to data

41

Page 42: JAXLondon - Squeezing Performance of IMDGs

© 2014 Hazelcast Inc.

Move operation to data

42

Page 43: JAXLondon - Squeezing Performance of IMDGs

© 2014 Hazelcast Inc.

Move operation to data

43

#[Mean        =          5725.046,  StdDeviation      =      197009.148]  #[Max          =  13639876.608,  Total  count        =                37219]  Operations  Per  Second=  3721

Page 44: JAXLondon - Squeezing Performance of IMDGs

© 2014 Hazelcast Inc.

Move operation to data

44

#[Mean        =          5725.046,  StdDeviation      =      197009.148]  #[Max          =  13639876.608,  Total  count        =                37219]  Operations  Per  Second=  3721

Can  we  move  it  any  closer?

Page 45: JAXLondon - Squeezing Performance of IMDGs

© 2014 Hazelcast Inc.

Entry Processor

45

Page 46: JAXLondon - Squeezing Performance of IMDGs

© 2014 Hazelcast Inc.

Entry Processor

46

#[Mean        =          1876.355,  StdDeviation      =          1751.857]  #[Max          =        36306.944,  Total  count        =                69648]  Operations  Per  Second=  7018

Page 47: JAXLondon - Squeezing Performance of IMDGs

© 2014 Hazelcast Inc.

Entry Processor Object format

47

#[Mean        =          1199.272,  StdDeviation      =          1023.777]  #[Max          =        34013.184,  Total  count        =                83520]  Operations  Per  Second=  8352

Page 48: JAXLondon - Squeezing Performance of IMDGs

© 2014 Hazelcast Inc.

Questions?

48

HUGL meets tonight!!https://github.com/fuadm/webinar-TDHW !Twitter: @fuadm!https://groups.google.com/forum/#!forum/hazelcast!http://hazelcast.com/company/careers/!http://hazelcast.org/learn/