This section describes free lists and shared pool lru list.
1. The chunk size in the shared pool is different, but it is continuous.
2. Because the chunk is the smallest unit for allocation, the session will apply in chunk units when it needs to allocate space to the object.
3. The available chunk (free) will form a chain table feee lists, so that you can find the available suitable chunk through the traversal chain table for ease of allocation, linked List is a way for chunk to organize and manage
4. An available chunk linked list is a bucket. There are many buckets in the shared pool. The chunk size varies with the bucket numbers.
5. when a chunk needs to be searched from the shared pool, a bucket is located first, and then the bucket is traversed to find the most suitable chunk. If the chunk space is larger than the required space, then the chunk is split into two parts, one is allocated, the other is free, and then mounted to the corresponding bucket.
6. If a bucket does not have a suitable chunk, search for another non-empty bucket. If no suitable chunk exists in all buckets, then, a part of the Space is released from the rec-type linked list to be free, or the free space is properly merged .. Note: Only rec-type chunks can be released. Even if the space is released, these chunks may not be consecutive and are small chunks, which may lead to such a situation, shared pool has space but a large number of very small chunks, so it is difficult to find the right chunk when looking for chunk-shared pool fragments
7. All types of chunks in the shared pool are managed as linked lists.
##############
Divided by bucket, there are 255 buckets, bucket 0 --- bucket 254
Each bucket has a chunk list;
Distribution of Bucket size on free lists:-- Environment: LINUX 32-bit/ORACLE 11.2.0.4
Previously, the Bucket size increased by 4 bytes
The Bucket size of this section is increased by 64 bytes.
The Bucket size growth of Bucket 240--254 does not seem to be too regular. In short, it increases progressively.
Because the number of free chunks is very large, the number of chunks in each Bucket is reduced, the search efficiency is improved, and the competition for shared pool latch is also greatly reduced. Note: If a large number of small free chunks appear in the shared pool, the share pool latch contention will occur, even if the size of the shared pool is increased, this problem may occur over time.
Reserved free lists:
The number of buckets on the reserved free lists is 15.
Keep free lists. When the CHUNK required by the SQL statement is greater than 4400bytes, the idle CHUNK will be searched in RESERVED FREE LISTS.
If the CHUNK required by the SQL statement is no greater than 4400bytes, the CHUNK will only be searched in the free list.
This is controlled by implicit parameters: _ shared_pool_reserved_min_alloc minimum allocation size in bytes for reserved area. The default value is 4400.
###################
View the free lists/bucket/reserved free lists structure in the DUMP Shared Pool: -- create a session
Alter session set events 'immediate trace name heapdump level 2 ';
Select value from v $ diag_info where name like 'de % ';
/U01/diag/rdbms/bys3/bys3/trace/bys3_ora_7876.trc
Chunk 2bffa844 sz= 22460 freeable "character set m"
Total heap size = 146798680 -- 146798680/1024/1024 -- 139.99813 initialization parameter: shared_pool_size -- 140 M
Bucket 0 size =
Chunk 2bc00048 sz = 0 kghdsx
Chunk 23a60468 sz = free ""
Chunk address, size, and status
Chunk 23ceb498 sz = 20 free ""
Chunk 237fcde4 sz = 20 free ""
-- 24 bytes, that is, the size of Bucket 2 ranges from 20 to 24 bytes ..
Chunk 245b13e4 free ""
Chunk 23ace7c0 sz = 24 free ""
Chunk 239c5a28 sz = 24 free ""
Bucket 3 size = 28
Chunk 24540e9c free ""
Chunk 2521209c sz = 28 free ""
Chunk 23483448 sz = 28 free ""
..................
Bucket 199 size = 1452
Chunk 22.16d2ac sz = 1492 free ""
Chunk 24b28a94 sz = 1548 free ""
Chunk 2433bb14 sz= 1620 free ""
Chunk 2463a89c sz= 1620 free ""
Chunk 24b829c4 sz= 1620 free ""
Chunk 23498518 sz = 1704 free ""
Chunk 23de90d0 sz= 1696 free ""
..................
Bucket 236 size = 3820
Bucket 237 size = 3884
Bucket 241 size = 4100
Bucket 242 size = 4108
Bucket 243 size = 8204
Bucket 244 size = 8460
Bucket 245 size = 8464
Bucket 246 size = 8468
Bucket 247 size = 8472
Bucket 248 size = 9296
Bucket 249 size = 9300
Bucket 250 size = 12320
Bucket 251 size = 12324
Bucket 252 size = 16396
Bucket 253 size = 32780
Bucket 254 size = 65548
Total free space = 518232
Reserved bucket 0 size = 16
Chunk 23420320 sz = 676 R-free ""
Chunk 23427b94 sz = 3420 R-free ""
Chunk 2342618c sz = 952 R-free ""
Chunk 23800050 sz = 1040 R-free ""
Chunk 23400050 sz = 2824 R-free ""
Chunk 25bff028 sz = 4032 R-free ""
Chunk 293ff788 sz = 2144 R-free ""
Chunk 23430a40 sz = 4564 R-free ""
Reserved bucket 3 size = 8460
Reserved bucket 4 size = 8464
Reserved bucket 5 size = 8468
Reserved bucket 6 size = 8472
Chunk 2342b988 sz = 9136 R-free ""
Reserved bucket 7 size = 9296
Reserved bucket 8 size = 9300
Reserved bucket 9 size = 12320
Reserved bucket 10 size = 12324
Reserved bucket 11size = 16396
Chunk 234161f8 sz = 16448 R-free ""
Reserving bucket 12 size = 32780
Reserved bucket 13 size = 65548
Chunk 23401d50 sz = 72296 R-free ""
Chunk 23815668 sz = 125312 R-free ""
Chunk 23c00050 sz= 180380 R-free ""
Reserved bucket 14 size = 1990652
, Used 0.6 M
######################
In the LRU chain of the shared pool, recreate and freeabl chunks are mounted. Multiple chunks may be required for an SQL statement, and the chunks in recreate State can be found on the LRU chain, then, the chunk in the recreate State is mounted to another CHUNK in the freeabl state., -- Avoid all chunks causing too long LRU chain on the LRU chain.
Find a section about (lru first) in the TRACE file. The method is the same as above:
Reserved bucket 14 size = 1990652
Total reserved free space = 6712468
-- The status is null, the SIZE is 348 bytes, And the status,
Chunk 237cb10c sz = 4096 recreate "KGLH0 ^ b9197c6e" latch = (nil)
Chunk 24bb5df0 sz = 364 recreate "KGLHD" latch = (nil)
Chunk 241aa1b8 sz = 4096 recreate "KGLH0 ^ 59449e50" latch = (nil)
Chunk 252640a0 sz = 364 recreate "KGLHD" latch = (nil)
Chunk 23a619a0 sz = 4096 recreate "KGLH0 ^ d5f1e0d7" latch = (nil)
Chunk 23465600 sz = 348 recreate "KGLHD" latch = (nil)
Chunk 2346575c sz = 1036 recreate "KGLHD" latch = (nil)
Chunk 23465b68 sz = 4096 recreate"KGLH0 ^ c6e0d102" latch = (nil) recreateMultiple freeable status chunks under the CHUNK
Ds 24bdecb0 sz= 4096 ct = 1
"SQLA ^ 1536bb77" ds = 0x23db5bd8
"KGLDA"
"KGLH0 ^ ba3f9b05" ds = 0x2425e238