A Comprehensive Study on the Energy Efficiency of Java Thread-Save Collections

D0270498e20bd573441f1f48f2e425cf?s=47 Gustavo Pinto
January 14, 2018
27

A Comprehensive Study on the Energy Efficiency of Java Thread-Save Collections

D0270498e20bd573441f1f48f2e425cf?s=128

Gustavo Pinto

January 14, 2018
Tweet

Transcript

  1. 1.

    A Comprehensive Study on the Energy Efficiency of Java Thread-Safe

    Collections Fernando Castor Kenan Liu Gustavo Pinto David Liu 1
  2. 5.
  3. 6.

    First, energy consumption is not only a concern for unwired

    devices, but also for data centers 6 Second, multicore CPUs are ubiquitous
  4. 7.

    First, energy consumption is not only a concern for unwired

    devices, but also for data centers 7 Second, multicore CPUs are ubiquitous Third, data structures are the fundamentals of computer programming
  5. 12.

    12 • ArrayList • LinkedList • Vector • Collections.synchronizedList() •

    CopyOnWriteArrayList List<Object> lists = …; Non Thread-Safe Thread-Safe
  6. 21.

    21 List<Object> lists = …; • ArrayList • LinkedList •

    Vector • Collections.synchronizedList() • CopyOnWriteArrayList Non Thread-Safe Thread-Safe
  7. 24.

    24 List<Object> lists = …; Set<Objects> sets = …; Map<Object,

    Object> maps = …; And how about energy consumption?
  8. 25.

    16 Collections 25 List ArrayList Vector Collections.syncList() CopyOnWriteArrayList Set LinkedHashSet

    Collections.syncSet() CopyOnWriteArraySet ConcurrentSkipListSet ConcurrentHashSet ConcurrentHashSetV8 Map LinkedHashMap Hashtable Collections.syncMap() ConcurrentSkipListMap ConcurrentHashMap ConcurrentHashMapV8
  9. 26.

    16 Collections 26 List ArrayList Vector Collections.syncList() CopyOnWriteArrayList Set LinkedHashSet

    Collections.syncSet() CopyOnWriteArraySet ConcurrentSkipListSet ConcurrentHashSet ConcurrentHashSetV8 Map LinkedHashMap Hashtable Collections.syncMap() ConcurrentSkipListMap ConcurrentHashMap ConcurrentHashMapV8 Non thread-safe Thread-safe
  10. 27.

    16 Collections 27 List ArrayList Vector Collections.syncList() CopyOnWriteArrayList Set LinkedHashSet

    Collections.syncSet() CopyOnWriteArraySet ConcurrentSkipListSet ConcurrentHashSet ConcurrentHashSetV8 Map LinkedHashMap Hashtable Collections.syncMap() ConcurrentSkipListMap ConcurrentHashMap ConcurrentHashMapV8 Java 7 Java 8
  11. 28.

    16 Collections 28 List ArrayList Vector Collections.syncList() CopyOnWriteArrayList Set LinkedHashSet

    Collections.syncSet() CopyOnWriteArraySet ConcurrentSkipListSet ConcurrentHashSet ConcurrentHashSetV8 Map LinkedHashMap Hashtable Collections.syncMap() ConcurrentSkipListMap ConcurrentHashMap ConcurrentHashMapV8 x 3 Operations Traversal Insertion Removal
  12. 29.

    2 Environments AMD CPU: A 2×16-core, running Debian, 2.4 GHz,

    64GB of memory, JDK version 1.7 .0 11, build 21. 29 Intel CPU: A 2×8-core (32-cores w/ hyper-threading), running Debian, 2.60GHz, with 64GB of memory, JDK version 1.7 .0 71, build 14.
  13. 30.

    2 Environments AMD CPU: A 2×16-core, running Debian, 2.4 GHz,

    64GB of memory, JDK version 1.7 .0 11, build 21. 30 Intel CPU: A 2×8-core (32-cores w/ hyper-threading), running Debian, 2.60GHz, with 64GB of memory, JDK version 1.7 .0 71, build 14. Hardware-based energy measurement Software-based energy measurement
  14. 31.

    31 More details about how the experiments were conducted? http:/

    /icsme2016.github.io/program/accepted.html
  15. 46.

    46 Maps Intel CPU Traversal Insertion Removal AMD CPU Traversal

    Insertion Removal Less energy than the non thread-safe implementation!
  16. 48.

    48 Tomcat > A web server > More than 170K

    lines of Java code > More than 300 Hashtables
  17. 49.

    49 Tomcat Xalan > Parses XML in HTML documents >

    More than 188K lines of Java code > More than 140 Hashtables > A web server > More than 170K lines of Java code > More than 300 Hashtables
  18. 50.

    50 For each Hashtable instance, change it for a ConcurrentHashMap

    one. Do it again for ConcurrentHashMapV8 Task:
  19. 52.

    52 Tomcat Xalan Hashtable to CHM: -12.21% Hashtable to CHM8:

    -17 .82% Hashtable to CHM: -5.82% Hashtable to CHM8: -9.32%
  20. 57.

    57 Hashtable ConcurrentHashMap List<Object> obj = new Hashtable<>(); obj.clone(); Cloneable

    
 Map 
 / / works fine / / compiler error implements List<Object> obj = new ConcurrentHashMap<>(); obj.clone();
  21. 58.

    58 Hashtable ConcurrentHashMap List<Object> obj = new Hashtable<>(); obj.clone(); Cloneable

    
 Map 
 / / works fine / / compiler error implements List<Object> obj = new ConcurrentHashMap<>(); obj.clone(); Danny Dig Opportunity for improving refactoring tools!
  22. 61.

    61 Doug Lea Stay up-to-date with the new releases of

    the java.util.concurrent library
  23. 63.

    63

  24. 64.
  25. 65.

    A Comprehensive Study on the Energy Efficiency of Java Thread-Safe

    Collections Fernando Castor Kenan Liu Gustavo Pinto David Liu 65
  26. 66.

    Experimental Environments 66 AMD CPU: A 2×16-core, running Debian, 2.4

    GHz, 64GB of memory, JDK version 1.7 .0 11, build 21. Intel CPU: A 2×8-core (32-cores w/ hyper-threading), running Debian, 2.60GHz, with 64GB of memory, JDK version 1.7 .0 71, build 14.