Slide 1

Slide 1 text

Characterizing the Energy Efficiency of Java’s Thread-Safe Collections in a Multi-Core Environment Gustavo Pinto [email protected] Fernando Castor [email protected]

Slide 2

Slide 2 text

Motivation (1/3) • First, energy consumption is a concern for unwired devices and also for data centers • Second, there is a large body of work in hardware/architecture, OS, runtime systems • However, little is known about the application level 2

Slide 3

Slide 3 text

Motivation (2/3) 3 • First, multicore CPUs are ubiquitous • Second, more cores used more power consumed • However, little is known about the energy-efficiency of multicore programs

Slide 4

Slide 4 text

Motivation (3/3) 4 • Data structures are the fundamentals of computer programming

Slide 5

Slide 5 text

5 List lists = …; • ArrayList • LinkedList

Slide 6

Slide 6 text

6 List lists = new ArrayList<>();

Slide 7

Slide 7 text

7 List lists = new ArrayList<>(); Thread

Slide 8

Slide 8 text

8 • ArrayList • LinkedList • Vector • Collections.synchronizedList() • CopyOnWriteArrayList List lists = …;

Slide 9

Slide 9 text

List lists = new Vector<>(); 9

Slide 10

Slide 10 text

10 List lists = new Vector<>(); Thread

Slide 11

Slide 11 text

11 List lists = new Vector<>(); Thread Thread-safe!

Slide 12

Slide 12 text

12 List lists = new Vector<>(); Thread { } … Thread-safe!

Slide 13

Slide 13 text

13 List lists = new Vector<>(); Thread { } … Thread-safe!

Slide 14

Slide 14 text

List lists = new CopyOnWriteArrayList<>(); 14

Slide 15

Slide 15 text

List lists = new CopyOnWriteArrayList<>(); 15 Thread

Slide 16

Slide 16 text

List lists = new CopyOnWriteArrayList<>(); 16 Thread Thread-safe!

Slide 17

Slide 17 text

List lists = new CopyOnWriteArrayList<>(); 17 { } Thread Thread-safe!

Slide 18

Slide 18 text

List lists = new CopyOnWriteArrayList<>(); 18 { } Thread Thread-safe!

Slide 19

Slide 19 text

List lists = new CopyOnWriteArrayList<>(); 19 { } Thread Thread-safe!

Slide 20

Slide 20 text

20 • ArrayList • LinkedList • …. • Vector • Collections.synchronizedList() • CopyOnWriteArrayList • …. List lists = …;

Slide 21

Slide 21 text

21 List lists = …; Set sets = …; Map maps = …;

Slide 22

Slide 22 text

22 List lists = …; Set sets = …; Map maps = …;

Slide 23

Slide 23 text

Research Questions 23 • RQ1: Do different implementations of the same collection have different impacts on energy consumption? • RQ2: Do different operations in the same implementation of a collection consume energy differently?

Slide 24

Slide 24 text

24 List Set Map ArrayList LinkedHashSet LinkedHashMap Vector ——— Hashtable Collections.syncList() Collections.syncSet() Collections.syncMap() CopyOnWriteArrayList CopyOnWriteArraySet ——— ——— ConcurrentSkipListSet ConcurrentSkipListMap ——— ConcurrentHashSet ConcurrentHashMap ——— ConcurrentHashSetV8 ConcurrentHashMapV8 16 Benchmarks

Slide 25

Slide 25 text

25 List Set Map ArrayList LinkedHashSet LinkedHashMap Vector ——— Hashtable Collections.syncList() Collections.syncSet() Collections.syncMap() CopyOnWriteArrayList CopyOnWriteArraySet ——— ——— ConcurrentSkipListSet ConcurrentSkipListMap ——— ConcurrentHashSet ConcurrentHashMap ——— ConcurrentHashSetV8 ConcurrentHashMapV8 16 Benchmarks Not-thread safe Thread safe

Slide 26

Slide 26 text

26 List Set Map ArrayList LinkedHashSet LinkedHashMap Vector ——— Hashtable Collections.syncList() Collections.syncSet() Collections.syncMap() CopyOnWriteArrayList CopyOnWriteArraySet ——— ——— ConcurrentSkipListSet ConcurrentSkipListMap ——— ConcurrentHashSet ConcurrentHashMap ——— ConcurrentHashSetV8 ConcurrentHashMapV8 16 Benchmarks x 3 Operations Traversal Insertion Removal

Slide 27

Slide 27 text

27 Experimental Environment A 2×16-core AMD CPUs, running Debian Linux, 64GB of memory, JDK version 1.7.0 11, build 21.

Slide 28

Slide 28 text

28 Experimental Environment A 2×16-core AMD CPUs, running Debian Linux, 64GB of memory, JDK version 1.7.0 11, build 21.

Slide 29

Slide 29 text

29 Experimental Environment A 2×16-core AMD CPUs, running Debian Linux, 64GB of memory, JDK version 1.7.0 11, build 21.

Slide 30

Slide 30 text

30 Experimental Environment A 2×16-core AMD CPUs, running Debian Linux, 64GB of DDR3 1600 memory, and JDK version 1.7.0 11, build 21.

Slide 31

Slide 31 text

List 31 Time

Slide 32

Slide 32 text

List 32 Time

Slide 33

Slide 33 text

List 33 Time 1.98x more energy!

Slide 34

Slide 34 text

List 34 Time

Slide 35

Slide 35 text

List 35 Time No sync!

Slide 36

Slide 36 text

List 36 Time CopyOnWriteArrayList: +152x

Slide 37

Slide 37 text

Set 37 Time

Slide 38

Slide 38 text

Set 38 Time Time is proportional to energy Time is not proportional to energy

Slide 39

Slide 39 text

Map 39 Time

Slide 40

Slide 40 text

Map 40 Time Time is proportional to energy Time is not proportional to energy

Slide 41

Slide 41 text

Map 41 Time

Slide 42

Slide 42 text

Map 42 Time

Slide 43

Slide 43 text

Map “Tuning Knobs” 43 Initial capacity

Slide 44

Slide 44 text

44 Load factor Map “Tuning Knobs”

Slide 45

Slide 45 text

45 Collision 100% Map “Tuning Knobs”

Slide 46

Slide 46 text

46

Slide 47

Slide 47 text

Future Work 47 • Perform the “removal” operations on Lists • Vary the number of threads accessing the data structure • Perform the experiments in another machine

Slide 48

Slide 48 text

Characterizing the Energy Efficiency of Java’s Thread-Safe Collections in a Multi-Core Environment Gustavo Pinto [email protected] Fernando Castor [email protected]