SlideShare uma empresa Scribd logo
1 de 35
Baixar para ler offline
GCC PostgreSQL
Applying Compiler Optimizations in PostgreSQL
Speaker
•
PostgreSQL
•
• Open source ( source code)
• PostgreSQL License (BSD-like License)
•
GCC (GNU Compiler Collection)
• Compiler system
• C
•
Compiler
Compiler
Compiler
machine
code
source
code
Compiler
• Google Google
•
•
•
source code
.
.
.
Compiler.c
.c
.c
.o
.o
.o
Compiler
Compiler
Linker
object file
executable
Compiler Optimization
Dead Code Elimination ( )
•
Function Call Inline ( )
•
Paul SayHello
SayHello
function inline
inline
• inline Alice Mary Paul
)
cache cache miss
• v.s.
NO!!!
•
•
•
•
• GCC
• PostgreSQL
•
• CPU bound v.s. IO bound
• PostgreSQL
PostgreSQL Compiler
• PostgreSQL
• -O0
• -O3
• -O3 -O0 1.5
• PostgreSQL
• PostgreSQL
0
0.5
1
1.5
2
CentOS Ubuntu
Compiler	Sensitive
O0 O3
PostgreSQL
baseline	(default)	
• function
function
• function call overhead
Benchmark
• pgbench, select-only mode
• P C
• 13MB
• IO
CPU Intel® Core™ i7-6700
Memory 16GB
OS CentOS 7.3
Compiler GCC 5.4.0
PostgreSQL 9.6.2
(12% improvement)
0.9
0.95
1
1.05
1.1
1.15
baseline O2 O3 O2	flto O2	finline-functions O2	flto	finline-
functions
CentOS
CentOS
1.12
1.03 1.04
• -finline-functions
• functions inline
• function
• -flto (linking time optimization)
• object file
• object file
• object file function inline
-O2 –finline-functions –flto
• function
function inline
• function call overhead
Conclusion
•
•
•
• PostgreSQL 12%
Thank you
Contact:	tclin914@gmail.com
Q	&	A
• inline function
• inline function inline
inline improment
Problem
• 資料庫管理系統遇到執行效能上的瓶頸
• 希望能從編譯器方面來優化PostgreSQL
Method
• 使用 GCC 許多的不同優化組合,並藉由 benchmark	的執行測量,
去找出最佳的優化組合
Solution
• 使用 GCC	特定的優化組合來優化 PostgreSQL
• 藉由分析得知其效果是來自哪些因素
Solution
• 使用 GCC	特定的優化組合來優化 PostgreSQL
• 藉由分析得知其效果是來自哪些因素
Outline
• Compiler	optimizations
• How	to	find	optimization	options	to	speed	up	PostgreSQL
• Experimental	and	profiling	result
• Conclusion
inline
• inline function inline
• inline Alice Mary Paul
)
cache cache miss
•
NO!!!
Paul do_something
do_something
do_something …

Mais conteúdo relacionado

Semelhante a 用 GCC 讓你的 PostgreSQL 噴噴噴~

腾讯大讲堂46 自由cgi之路v3
腾讯大讲堂46 自由cgi之路v3腾讯大讲堂46 自由cgi之路v3
腾讯大讲堂46 自由cgi之路v3
George Ang
 
scrapy+sphinx搭建搜索引擎
scrapy+sphinx搭建搜索引擎scrapy+sphinx搭建搜索引擎
scrapy+sphinx搭建搜索引擎
Ping Yin
 
调试技术的应用
调试技术的应用调试技术的应用
调试技术的应用
延胜 黄
 
淘宝网前台应用性能优化实践
淘宝网前台应用性能优化实践淘宝网前台应用性能优化实践
淘宝网前台应用性能优化实践
丁 宇
 

Semelhante a 用 GCC 讓你的 PostgreSQL 噴噴噴~ (20)

a glance of Javascript module
a glance of Javascript modulea glance of Javascript module
a glance of Javascript module
 
Python 于 webgame 的应用
Python 于 webgame 的应用Python 于 webgame 的应用
Python 于 webgame 的应用
 
Comment System of 56.com
Comment System of 56.comComment System of 56.com
Comment System of 56.com
 
ASP.NET Core 6.0 全新功能探索
ASP.NET Core 6.0 全新功能探索ASP.NET Core 6.0 全新功能探索
ASP.NET Core 6.0 全新功能探索
 
該怎麼樣(認真的)部署你的 Python Web 應用程式?
該怎麼樣(認真的)部署你的 Python Web 應用程式?該怎麼樣(認真的)部署你的 Python Web 應用程式?
該怎麼樣(認真的)部署你的 Python Web 應用程式?
 
[MOPCON 2022] 以 Kotlin Multiplatform 制霸全平台
[MOPCON 2022] 以 Kotlin Multiplatform 制霸全平台[MOPCON 2022] 以 Kotlin Multiplatform 制霸全平台
[MOPCON 2022] 以 Kotlin Multiplatform 制霸全平台
 
腾讯大讲堂46 自由cgi之路v3
腾讯大讲堂46 自由cgi之路v3腾讯大讲堂46 自由cgi之路v3
腾讯大讲堂46 自由cgi之路v3
 
做自己的可可豆夾 @ cocoahead.tw
做自己的可可豆夾 @ cocoahead.tw做自己的可可豆夾 @ cocoahead.tw
做自己的可可豆夾 @ cocoahead.tw
 
Grpc + python.key
Grpc + python.keyGrpc + python.key
Grpc + python.key
 
KISSY Editor Design 2
KISSY Editor Design 2KISSY Editor Design 2
KISSY Editor Design 2
 
Docker 101
Docker 101Docker 101
Docker 101
 
Node分享 展烨
Node分享 展烨Node分享 展烨
Node分享 展烨
 
scrapy+sphinx搭建搜索引擎
scrapy+sphinx搭建搜索引擎scrapy+sphinx搭建搜索引擎
scrapy+sphinx搭建搜索引擎
 
Elastic stack day-2
Elastic stack day-2Elastic stack day-2
Elastic stack day-2
 
调试技术的应用
调试技术的应用调试技术的应用
调试技术的应用
 
改善 Angular 開發流程:你所不知道的 Schematics 程式碼產生器
改善 Angular 開發流程:你所不知道的 Schematics 程式碼產生器改善 Angular 開發流程:你所不知道的 Schematics 程式碼產生器
改善 Angular 開發流程:你所不知道的 Schematics 程式碼產生器
 
[students AI workshop] Pytorch
[students AI workshop]  Pytorch[students AI workshop]  Pytorch
[students AI workshop] Pytorch
 
COSCUP2016 - LLVM框架、由淺入淺
COSCUP2016 - LLVM框架、由淺入淺COSCUP2016 - LLVM框架、由淺入淺
COSCUP2016 - LLVM框架、由淺入淺
 
COSCUP 2016 - LLVM 由淺入淺
COSCUP 2016 - LLVM 由淺入淺COSCUP 2016 - LLVM 由淺入淺
COSCUP 2016 - LLVM 由淺入淺
 
淘宝网前台应用性能优化实践
淘宝网前台应用性能优化实践淘宝网前台应用性能优化实践
淘宝网前台应用性能优化实践
 

用 GCC 讓你的 PostgreSQL 噴噴噴~