当前位置:首页 > 报告详情

吴辉静-PolarDB-PG企业级特性Global Cache(1).pdf

上传人: 2*** 编号:129070 2023-05-01 17页 1.12MB

1、PolarDB-PG 企业级特性Global Cache吴辉静(花名:午光)阿里云PolarDB数据库技术专家PostgreSQL 的 CacheCatalogBuffer PoolBackend ProcessRelCachePlanCacheSys/CatCachePostmaster ProcessWalsender ProcessParallel WorkerAutoVacuum ProcessData CacheBuffer Pool共享内存Meta CacheRelCache,Sys/CatCache,Plan Cache,Type Cache 等进程私有内存PostgreSQL

2、的 Data Cache:Buffer PoolKey:BufferTag容量管理:预分配所有进程共享Shared Memory ManagementHuge PageBuffer ManagerDatabase ClusterShared Buffer PoolBackend ProcessBackend ProcessBackend ProcessPostgreSQL 的 Data Cache:Buffer Pool并发控制buffer table lock,buffer descriptor lockpin/unpin淘汰算法Clock SweepRing Buffer刷脏Postgre

3、SQL 的 Meta Cache:Sys/CatCache用于快速查询系统表里的某个字段本质上缓存的是系统表里的 Tuple绝大多数模块都会使用,访问频率非常高SysCache 基于 CatCache 构建进程私有,无淘汰基于 SINVAL 机制失效内存管理使用 Memory Context,可观测性不强CatCacheSysCachepg_classParserOptimizerExecutorpg_typepg_attributeCatalogPostgreSQL 的 Meta Cache:RelCacheRelCache 中缓存了和表相关的所有元数据,加载多个系统表的数据组成了一个庞杂的

4、结构体绝大多数模块都会使用,访问比较高频进程私有,无淘汰基于 SINVAL 机制失效内存管理使用 Memory Context,可观测性不强RelCachetable1ParserOptimizerExecutortable2view1Catalogpg_classpg_indexpg_attributePostgreSQL 的 Meta Cache 失效机制:SINVALSINVAL 支持所有的 Cache 和 Catalog Snapshot 的失效事务提交时广播 SINVAL message随时检查 SINVAL QueueSINVAL Queue 如果溢出,通知所有 Process 执

5、行 Flush CacheSharedSINVALQueueProcess1(DDL)beginalter tablecommitLocal Queue语句结束执行 Local Queue 中的 sinval msgpushsinval msgpushsinval msgProcess2(DML)beginselectcommitacceptsinval msgacceptsinval msgPostgreSQL 的 Meta Cache 总结SINVAL 机制保证正确性进程私有大量冗余副本,OOM内存管理基于 Memory Context可观测性问题强生命周期管理&长连接只加载不淘汰Back

6、end ProcessBackend ProcessShared MemoryBuffer PoolCatalogGlibcMemory ContextSys/CatCacheRelCacheSINVALPolarDB-PG 的 Global Cache 架构Global Cache(L2)CatalogShared Memory ManagerSys/CatCacheRelationCachePlanCacheGeneric Global Cache LayerGlobal Cache Component ManagerGlobal CacheInva

word格式文档无特别注明外均可编辑修改,预览文件经过压缩,下载原文更清晰!
三个皮匠报告文库所有资源均是客户上传分享,仅供网友学习交流,未经上传用户书面授权,请勿作商用。
本文主要介绍了阿里云PolarDB数据库技术专家吴辉静(花名:午光)关于PolarDB-PG企业级特性Global Cache的讲解。PostgreSQL的Data Cache: Buffer Pool是所有进程共享的,采用预分配的容量管理和Huge Page Buffer Manager。其并发控制包括buffer table lock, buffer descriptor lock, pin/unpin以及淘汰算法如Clock Sweep和Ring Buffer。Meta Cache包括Sys/CatCache和RelCache,用于缓存系统表和表相关的所有元数据。SINVAL机制负责Cache和Catalog Snapshot的失效。PolarDB-PG的Global Cache架构包括Global Cache (L2)、Catalog、Shared Memory Manager、Sys/CatCache、Relation Cache、Plan Cache等,支持L1和L2的拷贝或引用、Write-Update或Write-Invalidate、容量管理和在线弹性扩缩容。Global Cache的正确性通过版本管理、Catalog Snapshot、Write Invalidate和Global Cache Generation来保证。共享内存管理基础设施包括Block Allocator、Chunk Allocator和Dynamic Shared Memory Allocator,支持内存整理、动态扩缩容和完善的监控。PolarDB-PG的Global Cache可以满足不同场景下各种极端需求,充分利用内存最大化提升性能。
"PolarDB-PG的Global Cache如何工作?" "PostgreSQL的Meta Cache有什么局限性?" "如何优化PolarDB-PG的共享内存管理?"
客服
商务合作
小程序
服务号
折叠