【Oracle】SGA与free命令中cached的关系

疑问1:SGA与free命令中cached的关系

如图:

[root@rhel75 ~]# cat /proc/meminfo 
MemTotal:        1865284 kB
MemFree:          161528 kB
MemAvailable:     575428 kB
Buffers:               0 kB
Cached:           544736 kB
SwapCached:         2476 kB
Active:           415740 kB
Inactive:         508396 kB
Active(anon):     139664 kB
Inactive(anon):   250908 kB
Active(file):     276076 kB
Inactive(file):   257488 kB
Unevictable:           0 kB
Mlocked:               0 kB
SwapTotal:       2097148 kB
SwapFree:        2087412 kB
Dirty:                28 kB
Writeback:             0 kB
AnonPages:        378136 kB
Mapped:            88512 kB
Shmem:             10000 kB
Slab:              61788 kB
SReclaimable:      22860 kB
SUnreclaim:        38928 kB
KernelStack:        6240 kB
PageTables:        36184 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:     2722588 kB
Committed_AS:     895584 kB
VmallocTotal:   34359738367 kB
VmallocUsed:      185324 kB
VmallocChunk:   34359310332 kB
HardwareCorrupted:     0 kB
AnonHugePages:      6144 kB
CmaTotal:              0 kB
CmaFree:               0 kB
HugePages_Total:     300
HugePages_Free:        7
HugePages_Rsvd:        0
HugePages_Surp:        0
Hugepagesize:       2048 kB
DirectMap4k:       71552 kB
DirectMap2M:     2025472 kB
DirectMap1G:           0 kB
[root@rhel75 ~]# 

如上所示,SGA值小于cache,正常来说,SGA全部包含在cache中(Q1见后文),但此处为何SGA反而大于cache ?

原因:开启了大页。

在启用了 HugePage 并生效的情况下, SGA 不算在 cache 中。
在不开启 HugePage的情况下,sga对应的内存被归类到 Cache中。

此处HugaPage用了(300-7)*2MB=586MB。

 

------------------------------------------------------------------------------------------------------------------------------

Q1:见https://access.redhat.com/solutions/58689中写到:

But there is something tricky in this. One cannot just consider free + buffer + cache when it comes to Oracle database. Oracle uses SGA. Oracle SGA would keep all the shared memory in RAM, which will be unused by other applications. The SGA will be shown under "cached" in free output. The memory allocated for SGA under cache cannot be considered as available.
** There is a system and requirement for new DB instance with an expected total SGA of 8GB. Assume that Memory is the only constraint. How do we determine if there is enough RAM available?**
In general as a thumb of rule the SGA should not more than 70% of total physical memory available as concerning to operating system.
In normal case amount of available free memory would be : 'free + cached + buffer' but as this case represent 3 instances of Oracle on this system and it can be seen most of the memory is utilized in cache, It can not be calculated how much amount of memory is available/free as it will be depend upon size of SGA. Its better to take the suggestion from Oracle on this.
Does SGA resides in cache ? Does ALL of the SGA reside in cache or only a portion? And if only a portion, which portion?
Yes, All of the SGA resides in cache only.
Here's an example SGA, Which Components would be represented in cache?

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值