CS5226 Project Database Performance Dashboard Report Hu Weiwei A0068188N Wang Fangda A0068212M Zeng Zhong A0068960U 1 Introduction In this project, we developed a web-based database performance dashboard to help DBAs monitor the key statistics of the database more conveniently and efficiently. Our system is able to offer useful monitoring and tuning information of the database to the DBAs. The web-based interface is user-friendly and interactive, so that it can help DBAs look inside the database performance in a clear and easy way. The web interface is developed mainly using ASP.Net and the backend program is developed using java. The target database is Oracle 10g. 2 Project Admin There are three members of our group and the key components done by each member is as follows. Hu Weiwei – Backend and the workload Wang Fangda – Zeng Zhong – Frontend program implementation 3 System Design 3.1 Overall Architecture The overall architecture of our system is shown in Figure 1. As can be seen, there are mainly four components, including the web UI, the Oracle DB, the workload and the backend monitor. Oracle DB is based on the Oracle 10g. Workload program is written using java and select, insert and delete queries are randomly generated to simulate a actual workload. Backend monitor program is written using java and it analyzes the table every one minute to get the performance statistics. Web UI is written using ASP.Net and it offers a web-based interface for DBAs to get the result clearly and easily. 1 Figure 1 Overall Architecture 3.2 Backend Monitor The parameters monitored are described in Section 4 in detail. Here, we introduce the scheme of the statistic table used to save all the parameters in Table 1. create table statistic ( time date, LIBRARY_CACHE_HIT_RATIO float, DICTIONARY_CACHE_HIT_RATIO float, BUFFER_CACHE_HIT_RATIO float, REDO_BUFFER_ALLOCATION_RETRIES int, REDO_ENTRIES int, REDO_LOG_BUFFER_RATIO float, REDO_LOG_SPACE_WAIT_TIME int, SORT_DISK int, SORT_MEMORY int, SORT_AREA_RATIO float, ROLLBACK_SEGMENT_WAIT_RATIO float, primary key (time)); Table 1 Scheme of the Statistic Table 3.3 Web UI The Web UI Component consists of 5 web pages. They are Home page, Parameter Monitored page, Configuration page, On-demand Report page and Debug Interface page. The Home page presents a brief guide of the Web UI Component to the users. In addition, the users can test whether the Database in the backend is available. The Parameter Monitored page presents a 3-level of breakdown for the key database parameters. The top level shows the overall of the 7 key parameters. For each key parameter there is a second-level breakdown to show the aggregated values during a certain time interval. 2 The users can also set the smaller unit time block to monitor the parameter for a specific time block within the time interval. The Configuration page is used for users to set the alert and warning values of each parameter. The effect can be monitored in Parameter Monitored page. The On-demand Report page the DBA can view the history records of each parameter once setting the starting date and ending date. The Debug Interface page is an open interface between the DBA and backend database. The DBA can issue queries directly on the database and obtain the result in the text window below. 4 Performance Statistics We introduce the details on how the various statistics are computed and the SQL commands used to obtain the statistics in this section. In total we choose six parameters that need to be monitored, including shared pool, buffer cache, redo log buffer, redo log files, memory area used for sorting and rollback segments. 4.1 Shared Pool 4.1.1 Concepts The shared pool in Oracle is responsible for collecting, parsing, interpreting, and executing all of the SQL statements that go against the Oracle database. Hence, the shared pool is a key component, so it's necessary for the Oracle database administrator to check for shared pool contention. Shared pool contains two main components, the library cache and the dictionary cache and we will choose these two parameters as a indicator of the cache state of the database system. 4.1.2 Parameters We describe the two parameters, the computation methods, the SQL commands and the tuning advice in the following table. Parameter Computation Library Cache Hit Ratio Library Cache Hit Ratio = sum(PINHITS) / sum(PINS) SQL Select sum(PINHITS) / sum(PINS) as lchr from V$LIBRARYCACHE; Tuning advice Enlarge the SHARED_POOL_SIZE if the Library Cache Hit Ratio is in the unhealthy level 3 Dictionary Cache Hit Ratio Dictionary Cache Hit Ratio = sum(GETS – GETMISSES - FIXED) / sum(GETS) Select sum(GETS – GETMISSES FIXED) / sum(GETS) as dchr from V$ROWCACHE; Enlarge the SHARED_POOL_SIZE if the Dictionary Cache Hit Ratio is in the unhealthy level 4.2 Buffer Cache 4.2.1 Concepts The buffer cache is part of the SGA and it holds copies of data blocks so as they can be accessed more quickly by Oracle than by reading them off disk. The purpose of the buffer cache is to minimize physical I/O. When a block is read by Oracle, it places this block into the buffer cache, because there is a chance that this block is needed again. Reading a block from the buffer cache is less costly than reading it from the disk. 4.2.2 Parameters We describe the parameter, the computation method, the SQL command and the tuning advice in the following table. Parameter Computation Buffer Cache Hit Ratio Buffer Cache Hit Ratio = 1 – PHYSICAL_READS / (CONSISTENT_GETS + DB_BLOCK_GETS) Select (1 - PHYSICAL_READS / (CONSISTENT_GETS + DB_BLOCK_GETS)) as bchr from V$BUFFER_POOL_STATISTICS; Enlarge the DB_BLOCK_BUFFERS if the Buffer Cache Hit Ratio is in the unhealthy level SQL Tuning advice 4.3 Redo Log Buffer/Files 4.3.1 Concepts The redo log buffer is a RAM area that works to save changes to data, in case something fails and Oracle has to put it back into its original state (a “rollback”). When Oracle SQL updates a table, redo images are created and stored in the redo log buffer. Oracle will eventually flush the redo log buffer to disk after a commit operation occurs. When you make changes in the database you must commit them to make them permanent and visible to other users. 4.3.2 Parameters We describe the parameter, the computation method, the SQL command and the tuning advice in the following table. Parameter Computation Redo Log Buffer Ratio between retries and entries Redo Log Buffer Ratio = REDO_BUFFER_ALLOCATION_RETRIES / REDO_ENTRIES 4 Redo Log Space Wait Time SQL Tuning advice Select value as REDO_ENTRIES from V$SYSSTAT where name=’redo entries’; Select value as REDO_BUFFER_ALLOCATION_RETRIES from V$SYSSTAT where name=’redo buffer allocation retries’; Enlarge LOG_BUFFER_SIZE if the Redo Log Buffer Ratio is greater than 1% Select value as REDO_LOG_SPACE_WAIT_TIME from V$SYSSTAT where name=’redo log space wait time’; Enlarge LOG_BUFFER_SIZE if the value is in high 4.4 Memory area used for sorting 4.4.1 Concepts The Oracle server processes will sort as much as they can in the memory sort area before using any disk sort space. If the ratio of the disk sort space of the total sort space is greater than 5 percent, the sort area size will need to be enlarged. 4.4.2 Parameters We describe the parameter, the computation method, the SQL command and the tuning advice in the following table. Parameter Computation Sort Area Ratio between Disk and Memory Sort Area Ratio = SORTS_DISK / (SORTS_DISK + SORTS_MEMORY) Select value as SORTS_DISK from V$SYSSTAT where name=’sorts (disk)’; Select value as SORTS_MEMORY from V$SYSSTAT where name=’sorts (memory)’; Enlarge the SORT_AREA_SIZE if the Sort Area Ratio is greater than 5% SQL Tuning advice 4.5 Rollback segments 4.5.1 Concepts Rollback segments allow users to undo, or rollback transactions that have been made against a database. It can ensure other transactions do not see uncommitted changes made to the database and recover the database to a consistent state in case of failures. The rollback segment wait ratio shows the number of times a process was delayed during the most recent reporting interval while waiting to access the rollback segment. 4.5.2 Parameters 5 We describe the parameter, the computation method, the SQL command and the tuning advice in the following table. Parameter Computation Rollback Segment Wait Ratio Rollback Segment Wait Ratio = sum(WAITS) / sum(GETS) Select sum(WAITS) / sum(GETS) as rswr from V$ROLLSTAT; Add more rollback segments if the Rollback Segment Wait Ratio is in the unhealthy level SQL Tuning advice 5. Screenshots of the Application 5.1 Home Page One role of the home page is to help the DBA to use the Web UI application. As seen in the Figure 2, for each page there is some respect brief information. Another role is to test the connection to the Database. Once the connection test is successful, the home page will show the version of the database. Otherwise, it will show the error message. Figure 2 5.2 Parameter Monitored Page There are 3 levels of breakdown for parameters to monitor the status of the database. The top level breakdown shows the health of the all 7 database parameters being monitored. Each parameter value is calculated as the average value for the last 24 hours. When it is above the warning value, it implies that this parameter is currently healthy, the color for this row of record is green; when it is below the warning value but resides above threshold value, it implies that this parameter is unhealthy, the color for this row of record is yellow; however, when it 6 falls below the threshold value, this indicates that the status of database for this parameter is severely unsatisfied which should catch DBA’s attention. The color for the record is red. At this time, there will be a tuning advice for the DBA’s reference. Figure 3 In order to get detail information about one specific parameter, the DBA can click on the parameter s/he is interested in to zoom in to the second level. In the second level breakdown, the DBA can set the time interval and view the aggregated values for that parameter. Figure 4 show an interval of 30 min for parameter Dictionary Cache Hit Ratio. If the DBA wants to further exploit the status of the parameter within the previous time interval, s/he can click on the specific time interval on the second level to continuously zoom into the third level. In that level, a unit time block is set by the DBA and the value of the parameter for each unit time block will be shown as in Figure 5. 7 Figure 4 Figure 5 8 6. Conclusion Aiming to optimize DBMS performance, database tuning is a necessary skill for DBAs. Unfortunately, the chances are that the upfront work of obtaining important statistics is not straightforward duo to considerable computation. In order to help DBAs perform work as efficiently and rapidly as possible, a web-based database performance dashboard is designed and implemented. Our user-friendly application provides DBAs with not only a big picture of the health of the database, but also detailed information for further monitoring. In our application, five parameters – Shared Pool, Buffer Cache, Redo Log Buffer/Files, Memory area used for sorting and Rollback segments -- gathered from an Oracle DBMS, can be investigated and tuned to enhance performance. Additionally, the 3-level breakdown architecture and detailed reports make monitoring work much easier. 9