技术头条 - 一个快速在微博传播文章的方式     搜索本站
您现在的位置首页 --> MySQL --> the ways to kill mysql application performance

the ways to kill mysql application performance

浏览:1823次  出处信息

    和普通的优化建议不同,下列的整理是告诉我们那些操作行为会影响性能.

    主要的理解至于存储引擎的优化

    1:Thinking too small

    a:最大的性能问题来至于书写的sql,schema的设计,索引策略.

    b:任何一个大型系统在不同层面都有代理及缓存.

    c:不要使用单个的"big box"架构.

    d:尽早的进行拆分及复制

    e:分离组件及应用程序

    f:performance != scalability

    3:choosing the wrong data types

    a:尽可能使用小的数据类型

    b:使用小的数据类型,索引和数据能够尽量放入内存

    4:using persistent connections in php

    a:持久化链接不可能在一个非shared的架构中存在.

    b:假如中止一个apache进程,其附属的持久化链接也将自动释放.

    c:mysql快于oracle/postgresql的原因

    使用lightweight/short-lived设计

    没有特殊需求,一般不要在mysql之上使用抽象层

    5:not understanding storage engines

    a:了解不同存储引擎的优缺点

    b:不同存储引擎处理索引及物理数据都是不同的

    c:系统中一般不可能就使用一个存储引擎

    6:not understanding index layouts

    正确的选择索引及存储引擎是非常重要的.需要理解聚簇和非聚簇索的区别

    具体可以参考(http://xiayuanfeng.javaeye.com/blog/429701)

    7:not understanding query cache

    a:是否使用query cache,需要参考数据库的读写比例

    b:query cache是性能及cpu处理之间的平衡

    c:对于并发量比较大的应用,大量的query cache反而会影响性能

    d:需要注意query cache失效的问题,提高query cache的命中率主要是需要拆分表.

    8:using stored procedures

    对于不同的rdbms,编译过程要不断在不能的链接线程中切换,所以对于页面级的查询,不建议使用存储过程.

    存储过程一般适用于如下场景:预处理的statements和动态的sql:

    etl-type procedures

    stuff that\'s comple+ and not execute often

    stuff that\'s simple and execute multiple times per request

    9:operating on indexed column with a function

    10:having missing or useless indexes

    a:无用的索引最大的原因:索引的可选择性不高.无用的索引也会减低更新操作的性能

    b:索引丢失

    对索引增加mysql的内部函数调用

    group by 操作的索引没有加索引

    善于使用覆盖索引

    11:not being join-fu master

    12:not accounting for deep scans

    对于大型网站需要使用search engine spider

    13:select count(*) with no where on an innodb table

    这个问题产生的原因是复杂的mvcc影响,innodb是基于行级锁,所以每个事务中为了计算准确都要重新扫描一个表.

    14:not profiling of benchmarking

    profiling是诊断系统的瓶颈,而压力测试是计算每次修改带来的性能评估,以及衡量网站的负载

    profiling concepts :

    a:try to profile on a testing or stage environment

    b:you are looking for bottlenecks in (memory disk i/o cpu network i/o and os)

    c:slow query logging

    benchmarking concepts :

    a:track changes in application performance over time

    b:isolate to a single changed variable

    c:record ererything

    d:shut off unnecessary programs

    e:disable query cache

    15:not using auto_increment

    a:能够产生一个数据的热区.

    b:能够保持新纪录的数据在一起.

    c:能够加快并发写

    参考:http://www.slideshare.net/techdude/how-to-kill-mysql-performance

建议继续学习:

  1. Xvfb+YSlow+ShowSlow搭建前端性能测试框架    (阅读:53969)
  2. 30分钟3300%性能提升――python+memcached网页优化小记    (阅读:11839)
  3. WEB系统需要关注的一些点    (阅读:10154)
  4. 基于SSD的数据库性能优化    (阅读:7173)
  5. jQuery性能优化指南    (阅读:7140)
  6. 长连接(KeepAlive)在 http 连接中的性能影响    (阅读:6837)
  7. SQL vs NoSQL:数据库并发写入性能比拼    (阅读:6446)
  8. 服务器性能测试工具推荐    (阅读:6170)
  9. Go Reflect 性能    (阅读:6027)
  10. 一次简单C程序的性能优化    (阅读:5448)
QQ技术交流群:445447336,欢迎加入!
扫一扫订阅我的微信号:IT技术博客大学习
© 2009 - 2024 by blogread.cn 微博:@IT技术博客大学习

京ICP备15002552号-1