MGA (Managed Global Area) Reference Note (Doc ID 2638904.1)

简介: MGA (Managed Global Area) Reference Note (Doc ID 2638904.1)

About MGA (Managed Global Area):

The MGA allows a "smaller set" of processes (or even all processes) to share an address space for the duration (typically a query). The MGA is made up of namespaces which contain segments and heaps with space management either directly or through a heap manager (KGH).

Processes can attach to their namespace for the duration they require. For e.g., in a parallel query environment, PQs participating with the QC can share the namespace from QC to share the results. Once done, they will detach from the same and the namespace can be torn down.

The MGA is allocated dynamically which gives us more flexibility to create, control and share. The sharing is dynamic in the sense that processes coordinate before sharing. So in that sense, MGA sits between the SGA and PGA. In addition, since the MGA is a shared memory area, a latch (latch: MGA) is used to control access and protect it.

Difference between MGA/PGA/SGA:

The MGA is not the SGA or PGA. The PGA is private and the SGA is completely shared by all processes and is not elastic. The MGA is elastic (processes can create and drop their MGA segments dynamically), shared between a set of processes or all processes, and counted under the PGA target/limit values (in v$PGASTAT). The SGA is typically created once while the MGA is created on demand.

There can be multiple MGAs in an instance while we have just one SGA.

MGA Clients and Use Cases:

The MGA is a general feature which has multiple consumers and the benefit is based on the consumers. MGA consumers are: IPC, MGA hash join, IMCDT and PQ in current releases. PQ is not a client by default. When a query uses features like MGA hash join or IMCDT, PQs internally attach to the namespace. (In other words, MGA hash join and IMCDT are actually executed by PQs with MGA being shared.)

  1. IPC:

IPC is enable by default on Exadata. It's mainly used for shared PD, where big IPC segments (heap based) are allocated and shared across all the processes.

Shared PD meaning is that, sharing "protection domain". Sharing of PD : This helps a daemon process register/de-register memory regions and allow other processes to share those memory regions instead of having to register the memory regions again in each process.

These segments are registered with HA for RDBMS operations.

The primary consumers of IPC0 MGA namespace are Buffer Cache/DLM (kcl.c uses this through ksmsq APIs).

Since IPC0 alone performs memory registration on behalf of all other processes in the instance, it is normal for IPC0 to have high RSS in the OS.

  1. MGA Hash Join:

MGA hash join is used by parallel query execution. It's used by Hash join shared operations in the execution plan. It improves the performance of large joins.

It also:

  • avoids/limits PQ distribution for hash-hash joins
  • avoids the cost of PQ redistribution
  1. IMCDT

IMCDT is used by cursor duration tables. It's also used by parallel slaves to load into memory cursor duration tables.

IMCDT points to: In memory cursor duration tables. This can be controlled with hidden parameter "_in_memory_cdt"

             See NOTE:2388236.1 What is _in_memory_cdt Parameter?

MGA Usage:

From 19c onward, we can now get MGA usage from database instance by querying the v$pgastat view. For example:

SQL> select * from v$pgastat;

NAME VALUE UNIT CON_ID


...
MGA allocated (under PGA) bytes 0
maximum MGA allocated bytes 0
...

Note: In 18c, the values associated with the MGA entries in v$pgastat are not displayed. (The values show as 0.) Reference:

 Enhancement Bug:30596770  ADD VALUES FOR MGA IN 18C V$PGASTAT




New Wait Events Related to MGA:

latch: MGA shared context root latch

latch: MGA shared context latch

latch: MGA heap latch

相关文章
|
存储 监控 Kubernetes
k8s诊断之记一次pod oom的异常shmem输出
客户反馈java设置xms,xmx参数固定8G内存,而pod的limit则为16G, 三番五次出现了pod oom的情况,且oom的时候他的业务进程输出也是8g, 同时promethus的监控对应pod的working_set_memory也是8个多g, 剩下的几个g的内存到底去哪里了呢?
4225 1
k8s诊断之记一次pod oom的异常shmem输出
|
9月前
|
人工智能 JSON API
LongDocURL:中科院联合阿里推出多模态长文档理解基准数据集,用于评估模型对复杂文档分析与推理的能力
LongDocURL 是由中科院与淘天集团联合推出的多模态长文档理解基准数据集,涵盖 2,325 个问答对,支持复杂文档的理解、推理和定位任务。
424 77
LongDocURL:中科院联合阿里推出多模态长文档理解基准数据集,用于评估模型对复杂文档分析与推理的能力
|
存储 网络协议 关系型数据库
nacos技术分享
Nacos作为服务发现中心,具备更多的功能支持项,且从长远来看Nacos在以后的版本会 支持SpringCLoud+Kubernetes的组合,填补 2 者的鸿沟,在两套体系下可以采用同一套服务发现和配置管理的解 决方案,这将大大的简化使用和维护的成本。另外,Nacos 计划实现 Service Mesh,也是未来微服务发展的趋 势。
724 0
nacos技术分享
|
NoSQL Java Redis
SpringBoot2.0整合Redis高可用之Sentinel哨兵
本篇博文分享的是一主二从三哨兵模式。至于为什么用三个哨兵,同第一段。本文是模拟环境,都是一个服务器上面。
1206 0
|
前端开发 Java 关系型数据库
【SpringBoot】微服务学习笔记七:微服务中异步调用数据提交数据库的问题
【SpringBoot】微服务学习笔记七:微服务中异步调用数据提交数据库的问题
815 0
【SpringBoot】微服务学习笔记七:微服务中异步调用数据提交数据库的问题
|
弹性计算 监控 数据挖掘
事件驱动架构的优势与应用:深度解析与实战应用
【8月更文挑战第17天】事件驱动架构以其松耦合、可扩展性、异步处理、实时性和高可靠性等优势,在实时数据处理、复杂业务流程、弹性伸缩和实时通信等多个领域展现出巨大的应用潜力。通过合理应用事件驱动架构,可以构建灵活、可扩展和可维护的系统架构,满足不断变化的业务需求和技术挑战。对于开发者而言,深入理解事件驱动架构的核心概念和优势,将有助于更好地设计和实现高质量的软件系统。
|
存储 调度 块存储
十二年磨一剑:三代架构演进,打造高性能、低成本的块存储!
上周,全球计算机存储顶会USENIX FAST 2024 在美国加州圣克拉拉召开,继去年获得国内首个FAST最佳论文奖后,凭借在分布式块存储上的创新,阿里云新作再次斩获FAST大会最佳论文奖。这也是国内唯一一家连续两年获得FAST最佳论文奖的科技公司。
106570 105
|
监控 Linux
|
Cloud Native 关系型数据库 分布式数据库
2024最新一期中国数据库流行榜公布:阿里云PolarDB登顶
PolarDB登顶国产数据库流行榜,持续引领云原生数据库创新
2024最新一期中国数据库流行榜公布:阿里云PolarDB登顶
在Linux中,如何查看某进程所打开的所有文件?
在Linux中,如何查看某进程所打开的所有文件?