1 / 30

天涯运维的那些事

天涯运维的那些事. 周小军 @ 网络系统部 . 天涯. 主题. 天涯现状 运维的历史 运维工具 愿景. 天涯现状. 中国 最大 的社区 5000 万 用户 发源于 天涯论坛 论坛使用 asp 脚本语言 使用 Windows 平台和 MSSQL 数据库 2 个 机房, 6G 带宽, 1000+ 服务器,并发 20 万 +. 1999 年 …. 关键词:卓锐 1 台服务器 80 人在线, 1 万 4 千用户. 2004 年. 关键词:天涯博客 竹影青瞳 300 、 1000 、 8000 、 2 万在线

hea
Download Presentation

天涯运维的那些事

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 天涯运维的那些事 周小军@ 网络系统部.天涯

  2. 主题 • 天涯现状 • 运维的历史 • 运维工具 • 愿景

  3. 天涯现状 • 中国最大的社区 • 5000万用户 • 发源于天涯论坛 • 论坛使用asp脚本语言 • 使用Windows平台和MSSQL数据库 • 2个机房,6G带宽, • 1000+服务器,并发20万+

  4. 1999年… • 关键词:卓锐 • 1台服务器 • 80人在线,1万4千用户

  5. 2004年 • 关键词:天涯博客 竹影青瞳 • 300、1000、8000、2万在线 • 6万、16万、38万、94万、220万用户 • 瓶颈:单机压力 • 解决:WEB及DB剥离,分库 • DNS轮询及www1、www2….

  6. 基于应用的负载均衡 客户端 重定向到其它服务器 WWW1 WWW2 WWW3 WWW4 主版DB 副版DB

  7. 2005年 • 14万在线,463万用户 • 瓶颈:WEB CPU压力/IIS 内存回收/数据库IO压力 • 解决:使用squid(11台www,4台squid,6台DB) • 黑客入侵

  8. 页面缓存结构 squid1 squid2 保存页面副本 WWW1 WWW2 WWW3 WWW4 定制N分钟缓存 主版DB 副版DB

  9. squid Request Hit Ratios: 5min: 46.8%, 60min: 44.8% Byte Hit Ratios: 5min: 10.2%, 60min: 11.6% Request Memory Hit Ratios: 5min: 29.7%, 60min: 25.1% Request Disk Hit Ratios: 5min: 2.7%, 60min: 7.6%

  10. 2006年 • 20万在线,887万用户 • 21台www,12台squid,14台DB • 瓶颈:数据库压力(存储过程、IO) • 解决:继续分库 • 服务器第一次搬家 • 开始采用Java和Mysql • 域名变更

  11. 2007 • 30万在线,1300万用户 • 68台www,33台squid,32台DB • 瓶颈:南北互联/负载均衡/缓存命中率 • 解决:双线双IP,购置F5,部署7层负载均衡、动静资源剥离 • 数据库双机复制/读写分离 • 新架构开发 • 与谷歌合作来吧及问答

  12. 七层负载均衡 acl free_content path_beg -i /publicforum/content/free acl free_list path_end -i free.shtml acl asp path_end -i .asp acl static path_end -i .js .css .gif .jpg .htm .html use_backend asp if asp use_backend static if static use_backend pub_hot_1 if free_content OR free_list

  13. 结构 F5-GTM F5-GTM F5-LTM F5-LTM Haproxy 根据URL分拆版块应用 Squid squid squid squid WWW WWW WWW WWW 写 读 DB主 DB从

  14. 2008-2009 • 40万人在线,2000->3000万用户 • 瓶颈:性能利用不均衡/页面未压缩 • 解决:服务器虚拟化,Squid迁移到varnish • IBM天涯用户体验咨询,天涯页面全新改版 • 论坛新架构在部分版块试运行

  15. varnish • 热门版块命中率70% • 流量节约70% • 上午9时40分varnishstat输出结果: Hitrate ratio: 10 100 137 Hitrate avg: 0.7300 0.7206 0.7196 56322971 48.96 45.05 Client connections accepted 45186154 42.97 36.14 Client requests received

  16. 2010年 • 54万在线,4500万用户 • 瓶颈:数据库磁盘IO • 解决:Memcache、Redis • 论坛放弃迁移到新架构

  17. ASP对memcache的操作 set cache = Server.CreateObject("Tianyamemcached.Client") cache.setGroup("group_test") content = cache.get("key") add_action = cache.add("key",content,OutTime) del_action = cache.Delete ("key") set cache = nothing

  18. F5-GTM F5-GTM F5-LTM F5-LTM Haproxy 根据URL分拆版块应用 Varnish Varnish Varnish Varnish WWW WWW WWW WWW Memcache Redis 写 读 DB主 DB从

  19. 天涯论坛技术特点 • 分库、分表、读写分离 • 无回复表 • 无状态服务 • 双线双IP • 四层、七层负载均衡 • 动静分离 • 采用缓存 • 页面压缩 • URL Rewrite

  20. 特点(续……) • 一帖到底(不限制-300K-200K-100K-100回复) • 帖子不物理删除 • 所有帖子都可以回复

  21. 分库 • 应用不断被动调整 • 业务中断代价 • 运维成本高

  22. 脏读 • update带来X锁 • 读阻塞 • 放弃一致性,使用unlock • 通过memcache或redis做记录级update

  23. 天涯运维的特点

  24. 运维的四个阶段 • 性能优化 • 架构 • 自动化 • 规范流程与面向云计算

  25. 运维监控平台 • 每台PM/VM安装Agent • 对象监控插件化 • Agent以轮循方式执行注册插件 • 数据以XML包格式发送 • Socket Server解析XML • Socket Server将采集数据入库 • WEB UI展现数据,统计报表,性能分析 • 开发语言:Python、C++、Java • 数据库:MySQL • WEB框架:Django

  26. 监控平台结构 WatchDog Agent Server XML WEB Server Switch Socket Server SNMP XML Agent DB Server

  27. 其它运维开源工具 • Nagios • Cacti • Func • Python

  28. 虚拟化 • 双路四核CPU/64G内存/6块SATA 500GB硬盘/RAID 10 • 1 vs 7 (单CPU/8G/100GB) • 目前有17台实体服务器,129台VM在线 • 节约了70%硬件投入、10个机柜托管成本……

  29. 运维蓝图 虚拟化 性能监控 容量规划 流程管理 可用性监控 资源库 配置管理 远程管理 系统发布 自动部署

  30. 谢谢 欢迎线下与我交流 zhouxj@hainan.net

More Related