性能优化

Profile-guided Optimization

利用性能监测产生的profile,找到热点代码,引导编译器优化

内存数据库

磁盘数据库慢主要是因为磁盘中的数据放到内存中需要进行数据结构转换。详见 DDIA中的Keeping everything in memory 一节

性能最好的串行化实现方式

Serializable Snapshot Isolation (SSI),PostgreSQL的串行化、FoundationDB用的是这个实现方式

详见 DDIA 中的 Serializable Snapshot Isolation 一节

space/temporal locality

CSAPP的优化矩阵乘法的例子

优化 branch predictor

C里面有宏可以做到这个,一般性能提升有限

将线程和 CPU 绑定

线程在CPU之间切换会导致L1、L2缓存失效

用 memcached 降低 Redis hgetall 的压力

memcached的纯kv性能很好

异步写入数据库

写入非常慢才有用,否则只会进一步降低性能

Go 高性能编程

https://geektutu.com/post/high-performance-go.html

最后更新于