Oracle Database Performance Tuning For RESTAURANTS Case Study
COMPANY CLIENT PROFILE: Restaurants is the name of a grand and passionate journey of flavours, unraveling authentic cuisines and sharing them with the world. TECHNOLOGIES USED: Database: Oracle 10.2.0.5 OS Platform: Windows OVERVIEW: Restaurants is a Largest chain of Fine dining and Casual Dining Restaurants and Confectionaries by 2016 with leading brands of Indian and most popular International Cuisines. It has India s largest fine dining chain of Chinese restaurants - Mainland China; India s most awarded cuisine, Oh! Calcutta, new and raring Sigree Global Grill and Café Mezzuna which have to their credit TOI Good Food Awards in their first year itself, Sweet Bengal as an award winner for the best mithai and Hoppipola besides a few other brands like Sigree, Machan, Flame & Grill, Haka. CHALLENGES: Mentioned below were the major database performance issues faced by the Client: Performance Bottleneck. Resource Intensive Queries. High CPU consumption. Excessive I/O utilization. Enqueue TX & TM INITIAL ANALYSIS PERFORMED: Studied AWR reports. Studied ASH reports. Monitored Logical and physical reads of the tables. Traced the time consuming queries. Analysis of SQL query plans. Planned for Index creation and SQL profiling.
ISSUES IDENTIFIED: Below were the issues identified on the databases which were affecting the performance: High CPU Utilization: During peak hours sudden spike of CPU utilization has been observed. Most of time CPU utilization reaches up to 75%. The main reason behind this is Resource Intensive Queries and Excessive Parsing. Excessive Hard Parsing: On average, around 15 to 30 per second, and on month-end, these are in the range of 45 to 50 per second hard query parsing was observed. These hard parses were contributing to the Shared Pool and Library Cache Latch contention thus consuming more CPU's. A hard parse applies to new cursors and cursors that are aged out and must be re-executed. These Excessive hard parses are due to application use SQL statements with literal values. A hard parse is a very expensive operation, and a child library cache latch must be held for the duration of the parse. During this phase most of the CPU gets utilized. Hard Parses are not only CPU Intensive, they also mean lack of Cursor Sharing, which makes Query diagnostic very difficult as each statement is parsed to its own SQL_ID, spreading database workload over thousands of statements which only differ by parameter values. Resource Intensive Queries: Most of the application queries are flagged as resource-intensive based on their I/O request. As mentioned earlier, due to high hard parses, it was very difficult to get into the critical statistics of the resource intensive queries.
STEPS PERFORMED FOR PERFORMANCE TUNING: Index creation: Below tasks were performed: 1) Table re-indexing for top and contention causing Queries 2) Index creations as per new optimizer plan and query filters/logic 3) Existing index modifications required for query tuning Table level Statistics gathering: Schema level stats gathering completed. And set auto stats with required sample size consider database size and transaction load. It helped us to stabilize Oracle SQL queries plan. Queries not using bind variables: Identified Problematic Queries which are not using bind variables and causing hard parses. Application team has to use bind variable instead of literals for efficient query parsing (i.e. for soft parsing). Tuned the resource intensive queries : Resource intensive queries were tuned by rewriting the code keeping the business needs in mind. DATABASE PERFORMANCE GAIN AFTER TUNING: Performance gain by DB Time and Executions Instance Efficiency Increased I/O bottleneck reduced after Performance Tuning Peak time load minimized (50% gain achieved)
Thank You!