JAXLondon - Squeezing Performance of IMDGs

Preview:

Citation preview

© 2014 Hazelcast Inc.

Squeezing Performance !out of In-Memory Data Grids

FUAD MALIKOVHAZELCAST CO-FOUNDER

© 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.

© 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

© 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

© 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

© 2014 Hazelcast Inc.

Popular In-Memory Data Grids

Oracle Coherence !Gigaspaces!Gemfire!IBM ExtremeScale!

Infinispan!GridGain!Hazelcast!Terracotta*

6

© 2014 Hazelcast Inc.

Hazelcast

7

© 2014 Hazelcast Inc.

Data Distribution

8

© 2014 Hazelcast Inc.

Partitioning (1 node)

9

P_1

P_2

P_271

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

© 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

© 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

© 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”)?

© 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”)?

© 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”)?

© 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”)?

© 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”)?

© 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”)?

© 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”)?

© 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

© 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

© 2014 Hazelcast Inc.

Use - Case

21

© 2014 Hazelcast Inc.

Shopping card example

22

© 2014 Hazelcast Inc.

Shopping Cart Item

23

© 2014 Hazelcast Inc.

Shopping Cart

24

© 2014 Hazelcast Inc.

Simulation

25

© 2014 Hazelcast Inc.

Simulation

26

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

© 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?    

© 2014 Hazelcast Inc.

Lock

28

© 2014 Hazelcast Inc.

Lock

29

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

© 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?    

© 2014 Hazelcast Inc.

XA Transaction

31

© 2014 Hazelcast Inc.

XA Transaction

32

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

© 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?    

© 2014 Hazelcast Inc.

Local Transaction

34

© 2014 Hazelcast Inc.

Local Transaction

35

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

© 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?    

© 2014 Hazelcast Inc.

Compare and swap instead of locking

37

© 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

© 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?    

© 2014 Hazelcast Inc.40

© 2014 Hazelcast Inc.

Move operation to data

41

© 2014 Hazelcast Inc.

Move operation to data

42

© 2014 Hazelcast Inc.

Move operation to data

43

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

© 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?

© 2014 Hazelcast Inc.

Entry Processor

45

© 2014 Hazelcast Inc.

Entry Processor

46

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

© 2014 Hazelcast Inc.

Entry Processor Object format

47

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

© 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/