Database is slow once in a while

loadoracleoracle-11g-r2performanceperformance-tuningquery-performance

I am executing a web service for 100 times. The average response time of this service is 1.5 seconds. But when I look at the response time of each execution individually, there are a few executions (at least 10) which are taking beyond 15 seconds to respond. The data for each request is exactly the same as any previous request (just appending a dynamic number to name…etc).

It certainly looks like a database issue, because my database is responding differently each time we execute a same query again and again. I am not able to understand why my database is behaving like this. My database is oracle 11g. I have experienced this issue with different UI flows as well previously.

Edited to add collected metrics.

enter image description here

Best Answer

Yes, statspack is an easy free way to go. First thing to look at is the top 5 timed events. Unfortunately statspack won't tell you the problem for specific sql statements. To see where and how particular sql statements are spending their time, you need ASH. A graphical interface to ASH along with the collection of ASH (ie no perf pack license needed) is available with WASH. http://www.oraclerealworld.com/web-ash-w-ash/ I'd recommend lab128 which has a 2 day free trial http://www.lab128.com/lab128_download.html Lab128 can collect ASH itself or optionally use the ASH collection from the performance pack. One you have on of those running, see where you are spending time - CPU, I/O, Locks or other stuff. In both the above tools you can see where individual SQL spend time to help you distinguish a problem in one SQL vs loosing that SQLs problems in the overall stats of the database.