Hochschule Bonn-Rhein-Sieg Energy Consumption of small Database Systems Faculty: Course: Instructor: Computer Science and Engineering, York University (CA) CSE 6421- Advanced Database Systems Prof. Jarek Gryz Speaker: Date: Benedikt Iltisberger 2010-12-01 Hochschule Bonn-Rhein-Sieg Presentation Time: Energy Consumption of DB Systems 35-45 minutes Questions: I am looking forward to answer your questions during the presentation. Slide 2 Hochschule Bonn-Rhein-Sieg Energy Consumption of DB Systems Agenda of the Presentation What is the topic? Why is it important? How to solve the problem? What do you have to keep in mind? Does it work in the real world? What is the conclusion? What can be done in the future? Slide 3 Hochschule Bonn-Rhein-Sieg Energy Consumption of DB Systems What is the Topic? Show a way how to measure the power consumption of a single query! Speed Energy Consumption Slide 4 Hochschule Bonn-Rhein-Sieg Energy Consumption of DB Systems What are the Scientific Challenges? Never done before[12] Could/should be implemented in any DBMS Multiple factors need to be considered Upcoming and important research area Slide 5 Hochschule Bonn-Rhein-Sieg Energy Consumption of DB Systems Energy Consumption Source: [7] Slide 6 Hochschule Bonn-Rhein-Sieg Energy Consumption of DB Systems Why is it worth to focus on energy saving? Saving the environment Growing market Job opportunity Saving costs for companies Energy bills are rising quickly Very important research area in Europe Interesting from the technical point of view Slide 7 Hochschule Bonn-Rhein-Sieg Energy Consumption of DB Systems Benchmarking Organizations SPEC “New SPECweb2009 benchmark adds ability to measure power consumption of web servers” (June 5, 2009)[4] TPC “Transaction Processing Performance Council Announces First Results for its TPC-Energy Specification” (July 7, 2010)[5] Slide 8 Hochschule Bonn-Rhein-Sieg Energy Consumption of DB Systems Energy consumption in the IT Source: [6] Slide 9 Hochschule Bonn-Rhein-Sieg Energy Consumption of DB Systems What have DBs to do with that? Core Service Delivering data for any business process Store the foundation of a company Need to be accessible 24/7 Today integrated even in small projects Data warehouses and Data marts Long running energy consuming queries Slide 10 Hochschule Bonn-Rhein-Sieg Energy Consumption of DB Systems Reasons for Decision-Makers 1. Reducing costs 2. Keep up a good image (Green IT) 1. Innovation 2. Keep up with the times 3. Being faster than competitors 3. Depending on the area of work 4. Additional company policies Slide 11 Hochschule Bonn-Rhein-Sieg Energy Consumption of DB Systems Idea of this Proposal Estimate the energy consumption of a single query to Compare queries in terms of efficiency Optimize queries for energy saving Get energy information in real time Teach the optimizer to do this task Green IT initiative Slide 12 Hochschule Bonn-Rhein-Sieg Energy Consumption of DB Systems How to achieve this goal? DBMS (e.g. DB2) can generate reports about executed queries containing: Original statement -> optimized statement Access Plan with many details like: CPU Cost CPU I/O Cost HDD Bufferpool Buffers Main Memory Slide 13 Hochschule Bonn-Rhein-Sieg Energy Consumption of DB Systems What information is given? IBM DATABASE 2 Explain Table Format Tool DB2 version: 09.07.3 Detailed information about queries including Access Plan (also graphical) Original query Optimized Query Detailed information about the different costs Detailed information about tables, indexes, … Slide 14 Hochschule Bonn-Rhein-Sieg Energy Consumption of DB Systems Information from the Statistic File Database Context: ---------------Parallelism: CPU Speed: Comm Speed: Buffer Pool size: Sort Heap size: Database Heap size: Lock List size: Maximum Lock List: Average Applications: Locks Available: None 1.889377*107 100 6000 1000 900 4096 22 1 28835 4) SORT : (Sort) ---------------Cumulative Total Cost: Cumulative CPU Cost: Cumulative I/O Cost: Cumulative Re-Total Cost: Cumulative Re-CPU Cost: Cumulative Re-I/O Cost: Cumulative First Row Cost: Estimated Bufferpool Buffers: 27541.2 5.39421*109 23667.2 27541.1 5.39388*109 0 27541.2 585 Detailed information: [9, 10, 11] Slide 15 Hochschule Bonn-Rhein-Sieg Energy Consumption of DB Systems Key Metrics in Detail CPU Cost I/O Cost Number of seeks and page transfers Bufferpool Buffer Instructions needed to execute a query Number of used pages Total Cost Measured in Timerons (proprietary IBM algo.) Slide 16 Hochschule Bonn-Rhein-Sieg Energy Consumption of DB Systems The Optimizer’s Access Plan Slide 17 Hochschule Bonn-Rhein-Sieg Energy Consumption of DB Systems Slide 18 Hochschule Bonn-Rhein-Sieg | 18000 TABLE: TPCDS ITEM Q2 Energy Consumption of DB Systems /------------------+------------------\ 211.307 299.933 ^HSJOIN FETCH ( 8) ( 18) 26913.4 30.4522 23078.2 4 /----------+-----------\ /---+----\ 13889.9 29221.1 300 300 NLJOIN TBSCAN IXSCAN TABLE: TPCDS ( 9) ( 17) ( 19) PROMOTION 17710.9 9200.94 14832.2 8246 /-------+--------\ | 352.257 39.4311 1.9208e+006 TBSCAN FETCH TABLE: TPCDS ( 10) ( 13) CUSTOMER_DEMOGRAPHICS 723.246 39.5703 Q4 656 32.9996 | /----+-----\ 352.257 39.4311 2.8804e+006 SORT RIDSCN DP-TABLE: TPCDS ( 11) ( 14) STORE_SALES 723.246 7.59231 Q5 656 1 | | 352.257 39.4311 0.105098 0 | 300 INDEX: SYSIBM SQL100701103316930 Q1 Q1 Slide 19 Hochschule Bonn-Rhein-Sieg Energy Consumption of DB Systems Parse and Compute 1. Perl script to gather important information 2. Provide script with following parameters: 3. Grab all CPU, HDD and Memory operations Sum them up Energy consumption of 1 CPU cylce Energy consumption of 1 HDD operation Energy consumption of 1 Memory operation Calculate the query's power consumption Using the information from no. 1 and no. 2 Slide 20 Hochschule Bonn-Rhein-Sieg Energy Consumption of DB Systems Perl Script Slide 21 Hochschule Bonn-Rhein-Sieg Energy Consumption of DB Systems Assumed DB System CPU[1] HDD[2] Overall: 213.66W Seagate Cheetah 15K, 600GB, 16MB Cache I/O Data transfer rate 600MB/s, 16.35W (avg operating power consumption) RAM[6] Intel Xeon X7560 @2.266 GHz, 130W 8 Cores, 16 Threads, 24MB L3 Cache 4GB DDR3 RAM (2 * 2GB DIMM#) with 9W per DIMM 18W Additional Hardware[6]: 30% of average power consumption of other components which leads to (130W + 16.35W + (2 * 9W)) * 0.3 = 49,305W Source: [6], Page 1233, Section 3.2 #) DIMM Dual In-Line Memory Module Slide 22 Hochschule Bonn-Rhein-Sieg Energy Consumption of DB Systems How to measure the parameters? I CPU Peak power consumption (p) of the manufacturer (Watts per hour) Total MIPS per hour (c) Calculate avg power consumption (a) p/c=a Problems Slide calculation flaws may end in high differences Many instructions take more the one cycle This also depends on the CPU type Current multicore architecture need special customization Slide 23 Hochschule Bonn-Rhein-Sieg Energy Consumption of DB Systems How to measure the parameters? II HDD Peak power consumption (p) of the manufacturer (Watts per hour) Calculate the max. avg I/O operations per hour (c) Calculate avg power consumption per I/O and hour (a) p/c=a Problems Different energy consumption for read & write RAID-n or other storage systems Slide 24 Hochschule Bonn-Rhein-Sieg Energy Consumption of DB Systems How to measure the parameters? III Main Memory Peak power consumption (p) of the manufacturer (Watts per hour) Calculate the max. page change rate per hour (c) Calculate avg power consumption per page change (a) p/c=a Problems: Very complicated and inprecise Strongly dependent on memory architecture and manufacturing process Slide 25 Hochschule Bonn-Rhein-Sieg Energy Consumption of DB Systems Exemplary Technical Issue: “Samsung DDR3” Source: [8] Slide 26 Hochschule Bonn-Rhein-Sieg Energy Consumption of DB Systems Automation of Data Collection about CPU, HDD, RAM Proposal: “energyDB” Name, Modell, Speed, Energy consumption, … Online service to provide needed information Comparable with CDDB[13] or freedb[14] Useful for other projects as well Slide 27 Hochschule Bonn-Rhein-Sieg Energy Consumption of DB Systems Optimizing Queries Areas of optimization: Execution speed (typical parameter) Resource usage When time is relevant For many concurrent users/queries New: Energy Consumption Slide 28 Hochschule Bonn-Rhein-Sieg Energy Consumption of DB Systems Optimizing Queries No. 1 Original Query: SELECT i_item_id, CAST(avg(CAST(ss_quantity AS DECFLOAT)) AS DECIMAL(10,6)) agg1, CAST(avg(ss_list_price) AS DECIMAL(10,6)) agg2, CAST(avg(ss_coupon_amt) AS DECIMAL(10,6)) agg3, CAST(avg(ss_sales_price) AS DECIMAL(10,6)) agg4 FROM tpcds.store_sales, tpcds.customer_demographics, tpcds.date_dim, tpcds.item, tpcds.promotion WHERE ss_sold_date_sk = d_date_sk and ss_item_sk = i_item_sk and ss_cdemo_sk = cd_demo_sk and ss_promo_sk = p_promo_sk and cd_gender = 'M' and cd_marital_status = 'S' and cd_education_status = 'College' and (p_channel_email = 'N' or p_channel_event = 'N') and d_year = 2000 GROUP BY i_item_id ORDER BY i_item_id FETCH FIRST 100 ROWS ONLY Slide 29 Hochschule Bonn-Rhein-Sieg Energy Consumption of DB Systems Optimizing Queries (Results) Original Query 1 (with index) CPU Cost I/O Cost Buffer Pool usage* Energy Consumption Total Cost Declined Query 1 (index deleted) 4.96336*109 5.39446*109 8636.78 23667.20 68303.99 70816.80 TBD TBD 12119.3 27541.2 *) Sum of all buffer pool operations for all involved queries. Slide 30 Hochschule Bonn-Rhein-Sieg Energy Consumption of DB Systems Optimizing Queries No. 2 Original Query: SELECT i_item_id, CAST(avg(CAST(ss_quantity AS DECFLOAT)) AS DECIMAL(10,6)) agg1, CAST(avg(ss_list_price) AS DECIMAL(10,6)) agg2, CAST(avg(ss_coupon_amt) AS DECIMAL(10,6)) agg3, CAST(avg(ss_sales_price) AS DECIMAL(10,6)) agg4 FROM tpcdsnp.store_sales, tpcdsnp.customer_demographics, tpcdsnp.date_dim, tpcdsnp.item, tpcdsnp.promotion WHERE ss_sold_date_sk = d_date_sk and ss_item_sk = i_item_sk and ss_cdemo_sk = cd_demo_sk and ss_promo_sk = p_promo_sk and cd_gender = 'M’ and cd_marital_status = 'S' and cd_education_status = 'College' and (p_channel_email = 'N' or p_channel_event = 'N') and d_year = 2000 GROUP BY i_item_id ORDER BY i_item_id FETCH FIRST100 ROWS ONLY Slide 31 Hochschule Bonn-Rhein-Sieg Energy Consumption of DB Systems Optimizing Queries (Results) Original Query 2 (with index) CPU Cost I/O Cost Buffer Pool usage* Energy Consumption Total Cost Declined Query 2 (index deleted) 4.51373*107 1.45693*109 654.55 8495.00 3971.55 17575.20 TBD TBD 1124.43 8772.47 *) Sum of all buffer pool operations for all involved queries. Slide 32 Hochschule Bonn-Rhein-Sieg Energy Consumption of DB Systems Optimizing Queries (Problems) Better performance but higher energy usage: Precomputation for faster response times Materialized Views CPU Cheap in terms of time consumption but Expensive in terms of energy consumption Slide 33 Hochschule Bonn-Rhein-Sieg Energy Consumption of DB Systems Conclusions I Reducing costs is always welcome in companies High need for this research in the long term Due to corporate identity and rising energy costs Environmental saving Query optimization does not necessarily lead to power saving Proposed technique can be added to the optimizer Slide 34 Hochschule Bonn-Rhein-Sieg Energy Consumption of DB Systems Conclusions II Cons You need to measure the single components in the first place Not easily applicable to complex systems Accuracy must be determined Checking results with hardware based measurement data How to measure VMs? Slide 35 Hochschule Bonn-Rhein-Sieg Energy Consumption of DB Systems Future Work I Add power consumption optimization techniques directly to the optimizer IBM seems to be working on that[12] Optional output of estimate power consumption Improve calculation techniques Even slide inaccuracy can have a big impact RAM usage is pretty inaccurate at the moment Automization of the process Slide 36 Hochschule Bonn-Rhein-Sieg Energy Consumption of DB Systems Future Work II Implementation of complex Dataware House systems or for distributed database systems Inaccuracy with measuring multi CPU systems „energyDB“ web service implementation Impact of hardware power saving GPU for databases, SSD, Dynamic voltage scaling, ... Slide 37 Hochschule Bonn-Rhein-Sieg Energy Consumption of DB Systems Concluding … This topic is worth for further research! Slide 38 Hochschule Bonn-Rhein-Sieg Energy Consumption of DB Systems Thank you for your attention! Any questions? Reference: 1. 2. 3. 4. 5. 6. http://www.intel.com/p/en_US/products/server/processor/xeon7000/specificat ions http://www.seagate.com/www/en-us/products/enterprise-harddrives/cheetah-15k#tTabContentSpecifications http://www.gruene-it.de/index.php/2010/09/17/ram-stromverbrauch-server/ http://www.spec.org/web2009/press/release.html http://www.tpc.org/information/press/tpcpress20100707.asp M. Poess, R. O. Nambiar, Energy Cost, “The Key Challenge of Today’s Data Centers: A Power Consumption Analysis of TPC-C results”,Oracle Corporation and Hewlett-Packard Company, N.A.. Slide 39 Hochschule Bonn-Rhein-Sieg Energy Consumption of DB Systems Reference (cont.): 7. 8. 9. 10. 11. 12. 13. 14. 15. http://www.bp.com/liveassets/bp_internet/globalbp/globalbp_uk_english/repo rts_and_publications/statistical_energy_review_2008/STAGING/local_assets /2010_downloads/statistical_review_of_world_energy_full_report_2010.pdf http://www.samsung.com/global/business/semiconductor/Greenmemory/Appl ications/ServerStorage/ServerStorage_DDR3.html http://www-01.ibm.com/support/docview.wss?rs=0&uid=swg21207055 http://publib.boulder.ibm.com/infocenter/db2luw/v8/index.jsp?topic=/com.ibm. db2.udb.doc/admin/r0000295.htm http://www.ibm.com/developerworks/data/library/techarticle/0212wieser/index .html http://www.freepatentsonline.com/y2009/0281986.html http://www.gracenote.com/ http://www.freedb.org R. Ramahrishnan, J. Gehrke, „Database Management Systems”, Third Edition, McGraw-Hill, Boston, 2003. Slide 40