OceanBase-OB存储引擎高级技术

目录

一、常用参数

二、OBserver内存结构

1、 OBserver系统内存构成

2、租户内存

3、常见内存问题处理:外部客户常见报错处理

1)ERROR 4030 (HY000):OB-4030:Over tenant memory limits

2)  500租户内存超限

3) alloc memory 或 allocate memory 相关的报错

4)PLANCACHE命中率低于90%

4、参数相关总览


一、常用参数

  • memory_limit_percentage 

#设置observer占用服务器的总内存百分百数(可以是物理机或者Docker等)。

  • memory_limit       

#设置observer占用服务器的内存量总量,当memory_limit=0时 memory_limit_percentage 才生效。

  • system_memory       

#系统内部内存,memory_limit 或memory_limit_percentage分配给observer的内存并不能够全部分配给租户使用,还要有一部分给observer本身的程序使用,可分配给一般租户的内存为:

observer总内存 - system_memory -系统租户内存

  • memstore_limit_percentage       

#决定memstore占用租户总内存的百分比,默认值是50%

  • freeze_trigger_percentage

#当memStore内存使用量超过freeze_trigger_percentage的百分比时(默认70%),会触发冻结及后续转储或者合并行

 

二、OBserver内存结构

1、 OBserver系统内存构成

Total Memory
OBserver MemoryOS Memory
Tenantsystem memory
MemstoreKVcatch
PLAN CATCH
SQL AREA
WORK AREA
Other AREA

2、租户内存

        每个租户内存总体上分为两个部分

  •         不可动态伸缩内存:Memstore
  •         可动态伸缩的内存:KVstore

Memstore

Memstore用来存储DML产生的增量数据,空间不可被占用;KVstore内存可以被其他众多的内存模块占用。

Memstore 的内存大小有由参数memstore_limit_percentage决定,表示租户Memstore占用租户总内存的百分比。默认值是50及占用租户总内存的50%。

当Memstore占用的总内存超过freeze_tirgger_percentge设定的百分比时(默认70%),会触发冻结及后续的转储合并行为。

KVstore

保存来着SSTable的热数据,提高查询速度。

大小可动态伸缩,会被其他各种cache挤占。

3、常见内存问题处理:外部客户常见报错处理

1)ERROR 4030 (HY000):OB-4030:Over tenant memory limits

a)判断内存是否超过上限

select /*+ READ_CONSISTENCY(WEAK),query_timeout(100000000) */ TENANT_ID,IP,
round(ACTIVE/1024/1024/1024,2)ACTIVE_GB,
round(TOTAL/1024/1024/1024,2) TOTAL_GB,
round(FREEZE_TRIGGER/1024/1024/1024,2) FREEZE_TRIGGER_GB,
round(TOTAL/FREEZE_TRIGGER*100,2) percent_trigger,
round(MEM_LIMIT/1024/1024/1024,2) MEM_LIMIT_GB 
from gv$memstore
where tenant_id >1000 or TENANT_ID=1
order by tenant_id,TOTAL_GB desc;

查看TOTAL_GB是否已经达到MEM_LIMIT_GB,即已将Memstore全部写满。

gv$memstore视图用于展示所有服务器上所有租户MEMTable上使用内存的情况。

b)如果MemStore未超限,判断MemStore之外那个model占用内存最高

select tenant_id, svr_ip, mod_name, sum(hold) module_sum
from __all_virtual_memory_info
where tenant_id>1000 and hold<>0 and
mod_name not in ('OB_KVSTORE_CACHE', 'OB_MEMSTORE')
group by tenant_id,svr_ip, mod_name
order by module_sum desc;

查看排名靠前的内存模块。

__all_virtual_memory_info表展示OBServer内存标签的统计信息

c)除去MemStore和KVCache,查看使用超过内存一定大小(比如10G)的模块

select *
from gv$memory
where used > 1024*1024*1024*10
and CONTEXT not in ('OB_MEMSTORE','OB_KVSTORE_CACHE')
order by used desc;

2)  500租户内存超限

tenant_id=500的租户是OB内部租户,简称500租户。

500租户的内存使用量没有被v$memory和gv$memory统计,需要单独查询__all_vritual_memory_info表

select svr_ip,mod_name,sum(hold) system_memory_sum
from __all_virtual_memory_info
where tenant_id=500 and hold<>0 
group by svr_ip,mod_name
order by system_memory_sum desc;

3) alloc memory 或 allocate memory 相关的报错

报错原因,通常是系统内存耗尽或者达到了内存使用的上限。

4)PLANCACHE命中率低于90%

除了跑批外,如果是OLTP系统plancache命中率不应低于90%。

select hit_count,executions,(hit_count/executions) as hit_ratio
from v$plan_cache_plan_stat
where (hit_count/executions) < 0.9;

select hit_count,executions,(hit_count/executions) as hit_ratio
from v$plan_cache_plan_stat
where (hit_count/executions) < 0.9 and executions > 1000;

v$plan_cache_plan_stat 视图记录了当前租户在当前 Server 上的计划缓存中缓存的每一个缓存对象的状态。

gv$plan_cache_plan_stat 视图记录了当前租户在所有 Server 上的计划缓存中缓存的每一个缓存对象的状态。

4、参数相关总览

序号名称含义计算公式
1Max_Memory租户最大可用内存租户创建过程中设定的
2Sys Memory500租户内存上限默认配置30G
3Work_Area租户工作区内存

默认是租户内存的5%

ob_sql_work_area_percentage

4Active Memory Used活跃MemTable占用的内存实时统计
5Total Memory UsedMemstore总体占用的内存active + frozen memory
6memstore_limit_percentage租户内存最大可用给memstore的比例默认是50%
7freeze_trigger_percent基于Memstore_limit, Memstore触发冻结的百分比默认70%

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值