SEEDS: A SOFTWARE ENGINEER’S ENERGY OPTIMIZATION DECISION SUPPORT FRAMEWORK Irene Manotas, Lori Pollock, and James Clause ! University of Delaware SOFTWARE ENERGY USAGE: WHY CARE? Reducing energy consumption can: Extend battery life (mobile devices) Reduce electricity bills and related costs (data centers) Support sustainability STATE OF THE ART Software Engineer Can the software engineer help? Source Code Compiler Operating System Hardware cpu, disk, etc. Energy Reducing Transformations Manage Energy Usage Dynamic Voltage Frequency Scaling YES, THEY CAN Many decisions made by developers impact energy usage: • Algorithms: Increase or decrease energy usage up to 30% (Bunse et al., 2009; Zhuo and Chakrabarti, 2008) • Design Patterns: Increase or decrease energy usage up to 700% (Sahin et al., 2012) • Refactorings: Increase or decrease energy usage up to 7% (Sahin et al., 2014) HOW CAN DEVELOPERS HELP? Collection x = new ??! Choose the most energy List x = new ?? efficient implementation LinkedHashSet TreeSet HashSet EnumSet CopyOnWriteArraySet UnifiedSet UnifiedMap SetAdapter MultiReaderFastList InmutableUnifiedMap ~ 10 CharArraySet ObjectArraySet ObjectAVLTreeSet OpenObjHashBigSet ObjectRBTreeSet ... ... ~ 40 ... ... ~ 40 FastSet FastBitSet LocalMap FastMap FastList ~ 700 JCF Hundreds of possibilities for each choice. Collection x = new ?? UnifiedSet! UnifiedMap! SetAdapter! MultiReaderFastList! InmutableUnifiedMap UnifiedSet! UnifiedMap! SetAdapter! MultiReaderFastList! InmutableUnifiedMap ~ 700 ... ... LinkedHashSet! TreeSet! HashSet! EnumSet! CopyOnWriteArraySet UnifiedSet! UnifiedMap! SetAdapter! MultiReaderFastList! InmutableUnifiedMap ~ 40 ~ 40 ~ 10 CharArraySet! ObjectArraySet! ObjectAVLTreeSet! OpenObjHashBigSet! ObjectRBTreeSet ~ 700 LinkedHashSet! TreeSet! HashSet! EnumSet! CopyOnWriteArraySet UnifiedSet! UnifiedMap! SetAdapter! MultiReaderFastList! InmutableUnifiedMap ~ 40 ~ 40 Hundreds of decision points! Choose the most energy efficient implementation FastSet! FastBitSet! LocalMap! FastMap! FastList! ~ 10 CharArraySet! ObjectArraySet! ObjectAVLTreeSet! OpenObjHashBigSet! ObjectRBTreeSet ... ~ 700 Collection x = new ?? ... ~ 10 CharArraySet! ObjectArraySet! ObjectAVLTreeSet! OpenObjHashBigSet! ObjectRBTreeSet Hundreds of possibilities for each choice. ... ~ 40 Hundreds of possibilities for each choice. FastSet! FastBitSet! LocalMap! FastMap! FastList! HOW CAN DEVELOPERS HELP? ... ~ 40 FastSet! FastBitSet! LocalMap! FastMap! FastList! ... ... ~ 700 Choose the most energy efficient implementation ... Collection x = new ?? ... ~ 10 CharArraySet! ObjectArraySet! ObjectAVLTreeSet! OpenObjHashBigSet! ObjectRBTreeSet Hundreds of possibilities for each choice. HOW CAN DEVELOPERS HELP? ... ... ~ 40 ... ... ~ 40 FastSet! FastBitSet! LocalMap! FastMap! FastList! UnifiedSet! UnifiedMap! SetAdapter! MultiReaderFastList! InmutableUnifiedMap JCF ... UnifiedSet! UnifiedMap! SetAdapter! MultiReaderFastList! InmutableUnifiedMap Choose the most energy efficient implementation LinkedHashSet! TreeSet! HashSet! EnumSet! CopyOnWriteArraySet ... Collection x = new ?? ~ 700 efficient implementation ... Hundreds of possibilities for each choice. ~ 10 CharArraySet! ObjectArraySet! ObjectAVLTreeSet! OpenObjHashBigSet! ObjectRBTreeSet ... ... JCF HOW CAN DEVELOPERS HELP? JCF ~ 10 FastSet! FastBitSet! LocalMap! FastMap! FastList! Hundreds of possibilities for each choice. Choose the most energy ... ~ 40 CharArraySet! ObjectArraySet! ObjectAVLTreeSet! OpenObjHashBigSet! ObjectRBTreeSet ~ 40 ... ~ 40 FastSet! FastBitSet! LocalMap! FastMap! FastList! ~ 40 Collection x = new ?? efficient implementation ... ~ 700 JCF LinkedHashSet! TreeSet! HashSet! EnumSet! CopyOnWriteArraySet UnifiedSet! UnifiedMap! SetAdapter! MultiReaderFastList! InmutableUnifiedMap ... ~ 10 LinkedHashSet! TreeSet! HashSet! EnumSet! CopyOnWriteArraySet ... ~ 40 CharArraySet! ObjectArraySet! ObjectAVLTreeSet! OpenObjHashBigSet! ObjectRBTreeSet UnifiedSet! UnifiedMap! SetAdapter! MultiReaderFastList! InmutableUnifiedMap HOW CAN DEVELOPERS HELP? Hundreds of possibilities for each choice. Choose the most energy ... ... ... ... ~ 40 FastSet! FastBitSet! LocalMap! FastMap! FastList! LinkedHashSet! TreeSet! HashSet! EnumSet! CopyOnWriteArraySet JCF HOW CAN DEVELOPERS HELP? Collection x = new ?? ~ 700 efficient implementation ... UnifiedSet! UnifiedMap! SetAdapter! MultiReaderFastList! InmutableUnifiedMap ~ 700 JCF ... LinkedHashSet! TreeSet! HashSet! EnumSet! CopyOnWriteArraySet efficient implementation ~ 10 ... ... Hundreds of possibilities for each choice. Choose the most energy Collection x = new ?? ~ 40 CharArraySet! ObjectArraySet! ObjectAVLTreeSet! OpenObjHashBigSet! ObjectRBTreeSet ~ 10 CharArraySet! ObjectArraySet! ObjectAVLTreeSet! OpenObjHashBigSet! ObjectRBTreeSet Hundreds of possibilities for each choice. Choose the most energy ... JCF HOW CAN DEVELOPERS HELP? ~ 40 FastSet! FastBitSet! LocalMap! FastMap! FastList! ~ 40 Collection x = new ?? efficient implementation ... ~ 700 UnifiedSet! UnifiedMap! SetAdapter! MultiReaderFastList! InmutableUnifiedMap ... ~ 10 LinkedHashSet! TreeSet! HashSet! EnumSet! CopyOnWriteArraySet ~ 40 FastSet! FastBitSet! LocalMap! FastMap! FastList! HOW CAN DEVELOPERS HELP? Hundreds of possibilities for each choice. Choose the most energy Collection x = new ?? UnifiedSet! UnifiedMap! SetAdapter! MultiReaderFastList! InmutableUnifiedMap JCF HOW CAN DEVELOPERS HELP? ... ~ 40 CharArraySet! ObjectArraySet! ObjectAVLTreeSet! OpenObjHashBigSet! ObjectRBTreeSet ... ... ... ... ~ 40 FastSet! FastBitSet! LocalMap! FastMap! FastList! JCF ... LinkedHashSet! TreeSet! HashSet! EnumSet! CopyOnWriteArraySet efficient implementation ~ 700 LinkedHashSet! TreeSet! HashSet! EnumSet! CopyOnWriteArraySet ... Hundreds of possibilities for each choice. Choose the most energy ... Choose the most energy efficient implementation ... HOW CAN DEVELOPERS HELP? ~ 10 CharArraySet! ObjectArraySet! ObjectAVLTreeSet! OpenObjHashBigSet! ObjectRBTreeSet ... ~ 40 FastSet! FastBitSet! LocalMap! FastMap! FastList! Collection x = new ?? ... ~ 40 Choose the most energy efficient implementation ... ~ 700 JCF Collection x = new ?? UnifiedSet! UnifiedMap! SetAdapter! MultiReaderFastList! InmutableUnifiedMap ... ~ 10 LinkedHashSet! TreeSet! HashSet! EnumSet! CopyOnWriteArraySet ... ~ 40 CharArraySet! ObjectArraySet! ObjectAVLTreeSet! OpenObjHashBigSet! ObjectRBTreeSet ... ... ... ... ~ 40 FastSet! FastBitSet! LocalMap! FastMap! FastList! Collection x = new ?? HOW CAN DEVELOPERS HELP? ... LinkedHashSet! TreeSet! HashSet! EnumSet! CopyOnWriteArraySet Choose the most energy efficient implementation HOW CAN DEVELOPERS HELP? ... HOW CAN DEVELOPERS HELP? ~ 700 JCF JCF Hundreds of possibilities for each choice. Hundreds of possibilities for each choice. SEEDS Software Engineer’s Energy-optimization Design Framework ! Help developers improve energy usage of their applications by making decisions about which source-level changes to apply THE SEEDS FRAMEWORK Application SEEDS Energy Optimized Modifications 1. Automatically apply changes to explore decision space with regard to energy usage (many versions) 2. Abstract away tedious system level concerns: create versions; monitor energy usage; select 3. Support different software engineering decisions SEEDS APPROACH Inputs Application Code Potential Changes Optimization Parameters Context Information Outputs Energy Optimized Application Modifications ! Define ApplicationSpecific Search Space Search Optimization Results SEEDS FRAMEWORK COMPONENTS Inputs Outputs Search Application Code Potential Changes Optimization Parameters Context Information ! Define ApplicationSpecific Search Space Select Solution Transform Application Profile Energy Usage Energy Optimized Application Modifications Optimization Results AN INSTANTIATION: SEEDSAPI SEEDSapi supports the selection of Collections implementations to optimize Java applications. Java Application Collections Libraries Implementations Set, List Application Test Suite Define ApplicationSpecific Search Space Application Generalization Identify Collection Allocations Filter choices based on optimization parameters. Search Select Implementation Transform Application Profile Energy Usage Optimized Java Application Optimization Results EVALUATION OF SEEDS • RQ1: Effectiveness Can SEEDS improve the energy usage of applications? • RQ2: Exploration Capability How does the size of the search space impact effectiveness? How often do developers choose the most energy efficient implementation? How often is an implementation the most energy efficient? • RQ3: Cost What is the time required to find the best solution? EVALUATION METHODOLOGY • Independent Variable: Library Implementation 157 implementations from 6 Collections Libraries • Dependent Variable: Energy Usage (joule) • Subjects Seven Java applications 8k - 100k LoC JCF LEAP Machine Barbecue, Jdepend, Apache-XML-Security, Jodatime, Commons-Lang, Commons-beanutils, Commons-cli RQ1: EFFECTIVENESS Application Barbecue Jdepend Apache-xml-security JodaTime Commons-lang Commons-beanutils Commons-cli % Improvement (JCF only) 17* 3* 5 8* 10 — 2* % Improvement (all 6 libraries) 17* 6* 5 9 13 — 2* Interactions between transformations cancel out expected benefits * only one change † multiple changes SEEDSapi was able to improve the energy efficiency of 6/7 applications. RQ2: EXPLORATION CAPABILITY How does the size of the search space impact effectiveness? Application Barbecue Jdepend Apache-xml-security JodaTime Commons-lang Commons-beanutils Commons-cli * only one change % Improvement (JCF only) 17* 3* 5 8* 10 — 2* † % Improvement (all 6 libraries) Increase 17* 6* 3 5 9 1 13 3 — 2* - multiple changes More choices can result in larger improvements. RQ2: EXPLORATION CAPABILITY How often do developers choose the most energy efficient implementation? • SEEDS analyzed a total of 123 decision points • Switching from the developer’s original choice to a new choice improved the energy usage: JCF only: 56% (69 times) All Libraries: 72% (89 times) Developers are unlikely to choose the most efficient implementation. RQ2: EXPLORATION CAPABILITY How often is a given implementation the most energy efficient? Selection Frequency 12% 8% 4% 0% No single implementation is the most Collections API Implementation energy efficient. RQ3: COST OF SEEDS Optimization time (hours) 250! Other Parts of SEEDS! Profiling Energy! 200! 150! 100! 50! 0! JCF! ALL! JCF! ALL! Barbecue! Jdepend! Cost is reasonable JCF! ALL! JCF! ALL! JCF! ALL! JCF! ALL! JCF! ALL! Apachexmlsecurity! Jodatime! Commonslang! Commonsbeanutils! Commonscli! Cost could be improved by using different energy measurement techniques CONCLUSIONS Designed SEEDS, a general framework for supporting decisions to improve applications’ energy usage. • Demonstrated feasibility/usefulness: • SEEDSapi, an instantiation of SEEDS for API implementation selection. • Evaluated SEEDS with 7 Applications: - effective at improving the energy usage of Java applications - supports asking and answering energy-usage related questions • FUTURE WORK • • Improve SEEDS search strategy • many decisions • many decision points in code Explore more instantiations • how general IMPROVING SEEDS SEARCH • What search-based techniques make the most sense? • What properties does the search space have? • How do we frame the problem to use a searchbased technique? ADDITIONAL RELATED WORK • Measure the Energy Consumption of Applications Provide energy usage of application by different approaches (HW instrumentation, simulation, estimation) (e.g., Singh, 2010; Hao, 2013). Does not provide information about which changes could be made to reduce the energy. • Language Support Implement energy management policies according to device status, tasks being executed, events or features (e.g., Cohen, 2012; Malakuti, 2014; Siegmund, 2010). Need to know which policies to implement and where and when to apply them manually.
© Copyright 2024