Bjorn Hansen的网站性能和可扩展性建议。基本上都是已知的东西。看来我们做的几个项目在这方面都是世界级的了。
Think Horizontally at every point in your architecture, not just at the web tier.
这句话很重要!
Benchmarking
找好基准点
Vertical scaling sucks.
垂直分割是很烂的
Horizontal scaling rocks.
水平分割才是王道
Run many application servers
运行多个应用服务器
Don’t keep state in the app server
不要做应用服务器上保存状态
Be stateless
系统要是无状态的
Optimization is necessary, but is different than scalability.
优化是必要的,但不等同于扩展
Cache things you hit all the time.
缓存所有命中的内容
Measure, don’t assume, check.
测量、检查,不要假设
Make pages static.
页面静态化
aching is a trade-off.
缓存是双刃剑
Cache full pages.
缓存整个页面
Cache partial pages.
缓存部分页面
Cache complex data.
缓存复杂数据
ySQL query cache is flushed on update.
ySQL查询缓存在update操作是会刷新
Cache invalidation is hard.
缓存过期很难做好
Replication scales reads, not writes.
读操作要用复制扩展
Partition to scale writes. 96% of applications can skip this step.
写操作用分区来扩展。96%的应用不需要这步
aster-master setup facilitates on-line schema changes.
???
Create summary tables and summary databases rather than do COUNT and GROUP-BY at runtime.
创建统计表和统计数据库,而不要每次使用COUNT和GROUP-BY
Make code idempotent. If it fails you should just be able to run it again.
代码要自省。错误了要能重新运行。
Load data asynchronously. Aggregate updates into batches.
异步加载数据。批量更新数据
Move processing to application and out of the database as much as possible.
数据处理尽量用App服务器做而不要让数据库去计算
Stored procedures are dangerous.
存储过程很危险
Add more memory.
多加内存
Enable query logging and take a look at what your app is doing.
打开查询日志,看看你的程序在干嘛
Run different MySQL instances for different work loads.
为不同的工作负载运行不同的MySQL实例
Config tuning helps, query tuning works.
数据库配置优化是有用的,查询语句优化很有用
Reconsider persistent DB connections.
重新考虑持久化数据库连接
Don’t overwork the database. It’s hard to scale.
不要滥用数据库,他很难扩展
Work in parallel.
并行计算
Use a job queuing system.
采用任务队列系统
Log http requests.
记录HTTP请求
Use light processes for light tasks.
轻量的工作用轻量的处理
Build on APIs internally. Clean loosely coupled APIs are easy to scale.
建立内部接口。松耦合的接口容易扩展。
Don’t incur technical debt.
技术上不要欠债
Automatically handle failures.
自动处理错误
Make services that always work.
服务要能一直运行
Load balancing is the key to horizontal scaling.
负载均衡是水平扩展的核心
Redundancy is not load-balancing. Always have n+1 capacity.
太多冗余不是复杂均衡。始终拥有N+1的容积
Plan for disasters.
考虑到灾难恢复
Make backups.
做好备份
Keep software deployments easy.
简化软件部署
Have everything scripted.
每个步骤都脚本话
Monitor everything. Graph everything.
监控所有的东西,图形化所有的东西
Run one service per server.
每个服务器只运行一个服务
Don’t ever swap memory for disk.
别用内存交换区
Run memcached if you have extra memory.
如果内存赋予就运行memcached吧
Use memory to save CPU or IO. Balance memory vs CPU vs IO.
用内存来节省CPU或IO。掌握好三者之间的平衡
Netboot your application servers.
从网络启动应用服务器
There’s lot of good slides on what to graph.
有很多好的PPT教你要图形化些什么内容
Use a CDN.
使用CDN
Use YSlow to find client side problems.
用YSlow来发现浏览器端问题
- Benchmarking
- 找好基准点
- Vertical scaling sucks.
- 垂直分割是很烂的
- Horizontal scaling rocks.
- 水平分割才是王道
- Run many application servers
- 运行多个应用服务器
- Don’t keep state in the app server
- 不要做应用服务器上保存状态
- Be stateless
- 系统要是无状态的
- Optimization is necessary, but is different than scalability.
- 优化是必要的,但不等同于扩展
- Cache things you hit all the time.
- 缓存所有命中的内容
- Measure, don’t assume, check.
- 测量、检查,不要假设
- Make pages static.
- 页面静态化
- aching is a trade-off.
- 缓存是双刃剑
- Cache full pages.
- 缓存整个页面
- Cache partial pages.
- 缓存部分页面
- Cache complex data.
- 缓存复杂数据 全文阅读 »