作者
digoal
日期
2018-01-13
标签
PostgreSQL , PPAS , enterprisedb , spin , 锁等待优化
背景
PostgreSQL商用版本EnterpriseDB,对于spin锁等待的一个优化,在NUMA架构的硬件中,当跨SLOT等待SPIN LOCK时,可能遇到性能问题,由于SPIN时CPU时间片被抢占,如果长时间等待会导致CPU空转的资源浪费。
通过设置edb_max_spins_per_delay参数,可以缓解这个性能问题。SPIN LOCK等待超过这个自旋次数,将进程转入sleep状态,从而释放CPU(CPU可以分配给其他进程使用),避免长时间占用CPU。
参数
edb_max_spins_per_delay
Parameter Type: Integer
Default Value: 1000
Range: {10 | 1000}
Minimum Scope of Effect: Per cluster
When Value Changes Take Effect: Restart
Required Authorization to Activate: EPAS service account
Use edb_max_spins_per_delay to specify the maximum number of times that a session will 'spin' while waiting for a spin-lock. If a lock is not acquired, the session will sleep. If you do not specify an alternative value for edb_max_spins_per_delay, the server will enforce the default value of 1000.
This may be useful for systems that use NUMA (non-uniform memory access) architecture.
参考
https://www.enterprisedb.com/docs/en/10.0/EPAS_Guide_v10/EDB_Postgres_Advanced_Server_Guide.1.24.html#pID0E0PRF0HA
PostgreSQL 许愿链接
您的愿望将传达给PG kernel hacker、数据库厂商等, 帮助提高数据库产品质量和功能, 说不定下一个PG版本就有您提出的功能点. 针对非常好的提议,奖励限量版PG文化衫、纪念品、贴纸、PG热门书籍等,奖品丰富,快来许愿。开不开森.