Practicing at the Cutting Edge Learning and Unlearning about - - PowerPoint PPT Presentation

practicing at the cutting edge
SMART_READER_LITE
LIVE PREVIEW

Practicing at the Cutting Edge Learning and Unlearning about - - PowerPoint PPT Presentation

Practicing at the Cutting Edge Learning and Unlearning about Performance Martin Thompson - @mjpt777 Learning and Unlearning 1. Brief History of Java 2. Evolving Design approach 3. An evolving Hardware platform 4. Changes in Culture 1. Brief


slide-1
SLIDE 1

Practicing at the Cutting Edge

Learning and Unlearning about Performance

Martin Thompson - @mjpt777

slide-2
SLIDE 2

Learning and Unlearning

slide-3
SLIDE 3
  • 1. Brief History of Java
  • 2. Evolving Design approach
  • 3. An evolving Hardware platform
  • 4. Changes in Culture
slide-4
SLIDE 4

1. Brief History of Java

slide-5
SLIDE 5

1.0

13 96

Java Timeline

97 98 99 00 01 02 03 04 05 06 07 08 09 10 11 12

In the beginning Java was Oak and Oak was slow

7 6 5 1.4 1.3 1.2 1.1

slide-6
SLIDE 6

How did it all start?

slide-7
SLIDE 7
slide-8
SLIDE 8
slide-9
SLIDE 9
slide-10
SLIDE 10
slide-11
SLIDE 11

How did Java perform then?

slide-12
SLIDE 12
slide-13
SLIDE 13
slide-14
SLIDE 14

...but everything must have a beginning

slide-15
SLIDE 15

1.0

13 96

Java Timeline

97 98 99 00 01 02 03 04 05 06 07 08 09 10 11 12

Netscape Navigator 2.0 & IE 3.0 with Applet support

7 6 5 1.4 1.3 1.2 1.1

slide-16
SLIDE 16

Ma, I don’t need to worry about deleting objects any more...

slide-17
SLIDE 17
slide-18
SLIDE 18
slide-19
SLIDE 19

...but we can distribute rich GUIs without an installer

slide-20
SLIDE 20

We could even do multi-threaded apps on Windows 3.11

slide-21
SLIDE 21

1.0

13 96

Java Timeline

97 98 99 00 01 02 03 04 05 06 07 08 09 10 11 12

Symantec and Microsoft JIT Performance Wars

7 6 5 1.4 1.3 1.2 1.1

slide-22
SLIDE 22
slide-23
SLIDE 23

Life with early JIT Compilers

slide-24
SLIDE 24

...cross platform GUIs are a real possibility

slide-25
SLIDE 25

1.0

13 96

Java Timeline

97 98 99 00 01 02 03 04 05 06 07 08 09 10 11 12

Generational Garbage Collection Servlets

7 6 5 1.4 1.3 1.2 1.1

slide-26
SLIDE 26
slide-27
SLIDE 27
slide-28
SLIDE 28
slide-29
SLIDE 29

But then came the surprise win

slide-30
SLIDE 30

Servlets vs CGI

slide-31
SLIDE 31

Graph Theory!

slide-32
SLIDE 32

1.0

13 96

Java Timeline

97 98 99 00 01 02 03 04 05 06 07 08 09 10 11 12

Hotspot Compiler JRockit for x86

7 6 5 1.4 1.3 1.2 1.1

slide-33
SLIDE 33
slide-34
SLIDE 34

EJB

slide-35
SLIDE 35
slide-36
SLIDE 36

1.0

13 96

Java Timeline

97 98 99 00 01 02 03 04 05 06 07 08 09 10 11 12

Native Threads on Linux + epoll NIO

7 6 5 1.4 1.3 1.2 1.1

slide-37
SLIDE 37
slide-38
SLIDE 38
slide-39
SLIDE 39

Java Memory Model

slide-40
SLIDE 40

1.0

13 96

Java Timeline

97 98 99 00 01 02 03 04 05 06 07 08 09 10 11 12

Java Util Concurrent + JMM Class Data Sharing

7 6 5 1.4 1.3 1.2 1.1

slide-41
SLIDE 41

Herb decided to write an essay...

slide-42
SLIDE 42

The free lunch is over...

slide-43
SLIDE 43

Java finds its way into our poor little mobile phones

slide-44
SLIDE 44
slide-45
SLIDE 45
slide-46
SLIDE 46

What about life on the Server?

slide-47
SLIDE 47

EJB

slide-48
SLIDE 48
slide-49
SLIDE 49

EJB

slide-50
SLIDE 50

1.0

13 96

Java Timeline

97 98 99 00 01 02 03 04 05 06 07 08 09 10 11 12

Escape Analysis Register Allocation Split Bytecode Verification

7 6 5 1.4 1.3 1.2 1.1

slide-51
SLIDE 51
slide-52
SLIDE 52
slide-53
SLIDE 53

What about our hero who freed us from the EJB tar pit?

slide-54
SLIDE 54
slide-55
SLIDE 55
slide-56
SLIDE 56
slide-57
SLIDE 57
slide-58
SLIDE 58

SQL too difficult?

slide-59
SLIDE 59

The world of hardware undergoes big changes!

slide-60
SLIDE 60
slide-61
SLIDE 61

High Frequency Trading

slide-62
SLIDE 62

Milliseconds Matter...

slide-63
SLIDE 63

...Microseconds Matter...

slide-64
SLIDE 64

...right from market

  • pen...
slide-65
SLIDE 65

...and especially after a quiet period...

slide-66
SLIDE 66

...it is like being at War

slide-67
SLIDE 67
slide-68
SLIDE 68
slide-69
SLIDE 69

Memory Cliff

slide-70
SLIDE 70

SHM, Locks, and Multi-core

slide-71
SLIDE 71

Safepoints!!!

slide-72
SLIDE 72

1.0

13 96

Java Timeline

97 98 99 00 01 02 03 04 05 06 07 08 09 10 11 12

Tiered Compilation G1 Garbage Collector Compressed Pointers

7 6 5 1.4 1.3 1.2 1.1

slide-73
SLIDE 73

What does the near future hold?

slide-74
SLIDE 74
slide-75
SLIDE 75

sun.misc.Unsafe

slide-76
SLIDE 76
slide-77
SLIDE 77
slide-78
SLIDE 78

What is everyone excited about?

slide-79
SLIDE 79
slide-80
SLIDE 80

What about other languages?

slide-81
SLIDE 81
slide-82
SLIDE 82

Now on with the story...

slide-83
SLIDE 83

2. Evolving Design Approach

slide-84
SLIDE 84

GUI Era

slide-85
SLIDE 85
slide-86
SLIDE 86
slide-87
SLIDE 87

Battle for the Desktop

slide-88
SLIDE 88

Battle for the Desktop

slide-89
SLIDE 89

What was the biggest factor in performance?

slide-90
SLIDE 90

People

slide-91
SLIDE 91

Comms design is significant to GUIs

slide-92
SLIDE 92

Users love responsive interfaces

slide-93
SLIDE 93

Modelling

slide-94
SLIDE 94
slide-95
SLIDE 95

“Big” Data Era

slide-96
SLIDE 96

What do the following companies have in common?

slide-97
SLIDE 97
slide-98
SLIDE 98

Huge product catalogues

slide-99
SLIDE 99

PCM

Sales Manufacturing Warehousing Logistics Partners e-Procurement Websites Catalogues

slide-100
SLIDE 100

Parsing

slide-101
SLIDE 101

Data Modelling & Representation

slide-102
SLIDE 102

Indexing

slide-103
SLIDE 103
slide-104
SLIDE 104
slide-105
SLIDE 105
slide-106
SLIDE 106

Set Theory Rocks!

slide-107
SLIDE 107

Databases are very powerful!

slide-108
SLIDE 108

Immutable Data Rocks!

slide-109
SLIDE 109

JDBC Drivers Suck!!!

slide-110
SLIDE 110

Stream Processing Rocks!

slide-111
SLIDE 111

public void characters(char[] ch, int start, int length) throws SAXException

slide-112
SLIDE 112

public void characters(char[] ch, int start, int length) throws SAXException public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException

slide-113
SLIDE 113

public String[] split(String regex)

slide-114
SLIDE 114

public String[] split(String regex) public Iterable<String> split(String regex)

slide-115
SLIDE 115

public String[] split(String regex) public Iterable<String> split(String regex) public void split(String regex, Collection<String> dst)

slide-116
SLIDE 116

Modelling

slide-117
SLIDE 117

OOP Set Theory Design Paradigms

slide-118
SLIDE 118

Transaction Processing Era

slide-119
SLIDE 119
slide-120
SLIDE 120

Synchronous designs are seriously limited

slide-121
SLIDE 121

Staged Event Driven Architecture

slide-122
SLIDE 122

The importance of Latency

slide-123
SLIDE 123

Latency given Throughput

Latency Load

slide-124
SLIDE 124

The issues with Concurrency

slide-125
SLIDE 125

The Disruptor

slide-126
SLIDE 126

The value of Determinism

slide-127
SLIDE 127

The value of pure Functions

slide-128
SLIDE 128

Modelling

slide-129
SLIDE 129

OOP Set Theory Design Paradigms FP

slide-130
SLIDE 130

3. Evolving Hardware Platform

slide-131
SLIDE 131

Mechanical Sympathy

slide-132
SLIDE 132

All Storage is Tape

slide-133
SLIDE 133

Networks are faster than Storage

slide-134
SLIDE 134

Memory Access Patterns Matter

slide-135
SLIDE 135

What if you could build a HashMap with reified generics and arrays of structures?

slide-136
SLIDE 136

Buckets

slide-137
SLIDE 137

A1 Bob Hash Buckets Key Value Next

slide-138
SLIDE 138

A1 Bob Hash Buckets FF Jim Key Value Next Hash Key Value Next

slide-139
SLIDE 139

A1 Bob Hash Buckets FF Jim Key Value Next Hash Key Value Next C7 Fred Hash Key Value Next

slide-140
SLIDE 140

Buckets Key Value Hash Next

slide-141
SLIDE 141

A1 Bob 4

  • 1

Buckets Key Value Hash Next

slide-142
SLIDE 142

1

A1 Bob 4

  • 1

Buckets Key Value Hash Next C7 Fred 2

  • 1
slide-143
SLIDE 143

1

A1 Bob 4 2 Buckets Key Value Hash Next C7 Fred 2

  • 1

FF Jim 4

  • 1
slide-144
SLIDE 144

.Net Dictionary is 10X faster than HashMap for 2GB of data

slide-145
SLIDE 145

ObjectLayout PackedObjects Value Types (Arrays 2.064)

slide-146
SLIDE 146

“Functional Programming will solve the multi-core problem”

  • Functional Fanboi
slide-147
SLIDE 147

Persistent Data Structures

slide-148
SLIDE 148

Market

HAMT

Ref *

HAMT

Venue *

HAMT

Instrument *

HAMT

Order *

slide-149
SLIDE 149

Market

HAMT

Ref *

HAMT

Venue *

HAMT

Instrument *

HAMT

Order * << CAS Failure? >>

slide-150
SLIDE 150

Market

HAMT

Ref *

HAMT

Venue *

HAMT

Instrument *

HAMT

Order * Model Depth Threads << CAS Failure? >>

slide-151
SLIDE 151

Shared Nothing to Scale Think Transputers but with message passing via SHM

slide-152
SLIDE 152

4. Changes in Culture

slide-153
SLIDE 153
slide-154
SLIDE 154

Measure Everything

slide-155
SLIDE 155
slide-156
SLIDE 156
slide-157
SLIDE 157

Questions?

Blog: http://mechanical-sympathy.blogspot.com/ Twitter: @mjpt777 “It does not matter how intelligent you are, if you guess and that guess cannot be backed up by experimental evidence - then it is still a guess.”

  • Richard Feynman