Oracle 10g introduced sga_target that automated the memory allocation and re-allocation to/from some of the critical memory components based on the load on each of these and this is done online. Currently, db_cache_size, shared_pool_size, java_pool_size and large_pool_size are the components that are managed automatically. Other than these, other components are to be configured manually.
Issues with SGA_TARGET when set to a higher value
There are many applications that are not properly optimized. Though, these applications are deployed as an OLTP application, the amount of Logical Reads per execution done by these are alarming.
With Automated Memory Management, due to the demand raised by these Huge Logical Reads queries, the Buffer Cache grows to a large value. This is to eliminate or reduce the amount of physical reads done by each of these queries. We all know that Disk Read is Costly and time consuming process, but, Memory Read is not cheaper as well. Therefore, if the cache grows significantly, queries requiring buffers from the cache consume huge amount of CPU, as read from memory require CPU Cycles.
I have come across such instances in the past, and in one such instance, a customer had sized buffer cache to 7 GB, shared pool to 3 gb. The SGA_Target was set to 40 GB. With this setting, based on the requirement, 30GB of memory was still available for the memory components to grow. The application queries on this database were resource intensive. Therefore, over time, the cache was at its peak with its total size at 30 to 32 GB. At this point of time, a temporary database freeze was observed with lots of session reading from the cache and consuming CPU and no IDLE CPU left. This, in turn, prevented further logins to the system. Operating System Utilities SAR reported usr% as high as 85%. We all know that Oracle processes works in usr mode, therefore, CPU utilization reported in usr% is for the Oracle Processes. In this case, it was quite evident that Oracle was consuming most of the CPU resources. The Wait Events were not that alarming with few sessions waiting on sequential reads and very few on scattered reads. From Waits perspective, database seemed to be healthy but Database Freeze seemed to be quite confusing. The only solution to this was to take a restart of the database. This freeze was reported after few days of the db restart and resulted in customer dissatisfaction.
At this point in time, we decided to remove SGA_TARGET and set the cache_size to 15gb (originally 7 gb). Once, this was set, neither the performance degradation nor the core issue of database freeze was reported. It has been almost 3 months, the freeze that use to be a regular routine (every 4-5 days) has not been reported. Similar issues were reported by few other customers as well, where the dba's reported that whenever the freeze was observed, no one had a clue about the reason for this freeze. In this case too, due to the resource intensive queries, the overgrown size of the cache seemed to be an issue and after restricting this, the issue has been eliminated.
There are databases with 100 GB's of cache and the performance of these are quite normal with no freeze reported. Therefore, the size of the cache or SGA_TARGET is not an actual issue. The issue occurs if the queries does millions of logical reads, where, at one point of time, more number of sessions start fetching blocks from the cache thus consuming CPU's. The recommended solution, in these cases, would be to actually optimize the queries and then enable Automated Memory Management feature as this is one of the best feature that does not require any SGA optimization or tweaking.
Therefore, as mentioned earlier, Oracle new features are meant to solve most of the issues / challenges reported in earlier versions, but there optimal usage sometimes depend on the application behaviour.
Comments are always a welcome....

4 comments:
Thx for sharing this !
I remember there was one more issue related to automatic memory management about not freeing up shared pool to buffer cache when not in use.
To explain if shared pool wants to increase - it takes space from SGA_TARGET (if additional memory is available) OR if SGA_TARGET is sum of buffers, it takes memory from buffer pool. But it never returns that back when the other needs it.
http://el-caro.blogspot.com/search/label/sga_target
Thx for sharing this !
I remember there was one more issue related to automatic memory management about not freeing up shared pool to buffer cache when not in use.
To explain if shared pool wants to increase - it takes space from SGA_TARGET (if additional memory is available) OR if SGA_TARGET is sum of buffers, it takes memory from buffer pool. But it never returns that back when the other needs it.
http://el-caro.blogspot.com/search/label/sga_target
Excellent...Keep posting.
Changing gears, Vivek Sharma offers his precaution on database freezes when SGA_TARGET is set to a high value.
Post a Comment