狠狠撸

狠狠撸Share a Scribd company logo
站内评论与留言系统

  技术部 kim
目的
? 介绍现状
? 分享开发过程
评论?
? UGC
? 基础模块
? 二级内容
播放页
专题
留言
我收到的
美女视频
瀑布流1
瀑布流2
瀑布流3
相片(旧)
相片(新)
精彩跟帖
负载
? PV 大于播放页
? 日增10-15万
? Nagios 监控
现状
?   PHP 3台
?   Memcached 18个节点
?   TT 12个节点
?   Redis 18个节点
?   MongoDB 2台机,6端口,48个库,每库2个
    表
页面入口
? 主脚本 objcmt.js
? 主样式 objcmt.importStyle()
? 模板 JavaScript+Html
程序入口
? 多入口
? 站内 api/commentApi.php
? 站外 e.g. api/renren/,api/sina/
回推
旧版
?   单库单表,1.4亿
?   Mysql Scheme
?   Enum字段
?   代码混乱
?   JavaScript Template
Why重构
?   存储
?   Read/Write 性能
?   Bugs
?   业务拓展
How?
?   MongoDB
?   开发环境
?   数据结构
?   数据迁移
?   程序重构
MongoDB
? ReplicaSet
? Sharding VS 分库
? 如何监控
MongoDB
? Group/MapReduce 性能
? Btree 索引
? PHP extension 不稳定
开发环境
? 本地模拟 ReplicaSet 架构
? 辅助工具 Rockmongo
数据结构(冗余架构)
?   视频相关 VS 用户相关
?   双表冗余
?   哈希
?   Observer模式
ID问题
?   ObjectId:4e7020cb 7cac81 af71 36236b
?   数字id:226166216
?   1/3内存
?   稳定性,移植性
?   ID生成器
ID问题
? CREATE TABLE IF NOT EXISTS `comment_id` (
?    `id` bigint(20) NOT NULL
  AUTO_INCREMENT,
?    PRIMARY KEY (`id`)
? ) ENGINE=InnoDB DEFAULT CHARSET=latin1
  AUTO_INCREMENT=200000000 ;
content问题
?   最大1k
?   Db size 与查询效率
?   理论上,非排序和条件字段都可放key/value
?   比如,放TT里
?   优化?
盖楼问题
?   MongoDB::getDBRef
?   楼层标识:tower_index
?   递归的使用
?   重复楼层的隐藏问题
?   上限?
Comment System of 56.com
数据迁移
?   脚本,求简
?   先迁移,后索引
?   No safe insert
?   1k/s 写入,白天单线程,晚上6线程,前后
    共计1星期
索引
? Free scheme 的优势

? 多值 OR 查询的修复:
? status:y/n/d -> status:1/0 and visible:1/0
索引
? 慢查询0容忍
? 日志的重要性
大表索引
? ReplicaSet 架构下的大表索引问题
缓存
?   列表,Redis list
?   总数,key/value
?   失效的时机
?   更高的命中率
分页
? LIMIT 的噩梦
? 排序,cursor 的应用
? LIMIT 0,稳定的翻页
F&Q
谢谢!

More Related Content

What's hot (20)

Kubernetes use-ceph
Kubernetes use-cephKubernetes use-ceph
Kubernetes use-ceph
Yang Guanjun
?
MongoDB SHARE
MongoDB SHAREMongoDB SHARE
MongoDB SHARE
zhangyunyang1985
?
Chasingice
ChasingiceChasingice
Chasingice
冰 白
?
Mesos intro
Mesos introMesos intro
Mesos intro
dennis zhuang
?
狈驳颈苍虫深度开发与客制化
狈驳颈苍虫深度开发与客制化狈驳颈苍虫深度开发与客制化
狈驳颈苍虫深度开发与客制化
Joshua Zhu
?
阿里颁顿狈技术揭秘
阿里颁顿狈技术揭秘阿里颁顿狈技术揭秘
阿里颁顿狈技术揭秘
Joshua Zhu
?
新浪微博贵别别诲服务架构
新浪微博贵别别诲服务架构新浪微博贵别别诲服务架构
新浪微博贵别别诲服务架构
XiaoJun Hong
?
笔测迟丑辞苍小团队不妨知道的技术
笔测迟丑辞苍小团队不妨知道的技术笔测迟丑辞苍小团队不妨知道的技术
笔测迟丑辞苍小团队不妨知道的技术
jie.wang
?
高性能存储引擎罢辞办耻顿叠剖析
高性能存储引擎罢辞办耻顿叠剖析高性能存储引擎罢辞办耻顿叠剖析
高性能存储引擎罢辞办耻顿叠剖析
Bohu TANG
?
Introduction to NodeJS
Introduction to NodeJSIntroduction to NodeJS
Introduction to NodeJS
TechParty@UIC
?
Redis
RedisRedis
Redis
Wei Weng
?
110412 kningsoft-mongo db-intro-usage-in-mercury
110412 kningsoft-mongo db-intro-usage-in-mercury110412 kningsoft-mongo db-intro-usage-in-mercury
110412 kningsoft-mongo db-intro-usage-in-mercury
Zoom Quiet
?
Ceph intro
Ceph introCeph intro
Ceph intro
Yang Guanjun
?
设计高性能尘测蝉辩濒应用-罢别肠丑颁濒耻产技术沙龙
设计高性能尘测蝉辩濒应用-罢别肠丑颁濒耻产技术沙龙设计高性能尘测蝉辩濒应用-罢别肠丑颁濒耻产技术沙龙
设计高性能尘测蝉辩濒应用-罢别肠丑颁濒耻产技术沙龙
banping
?
移动搜索在慢网速下的优化
移动搜索在慢网速下的优化移动搜索在慢网速下的优化
移动搜索在慢网速下的优化
Charlee Green
?
从开发到上线-实战持续交付
从开发到上线-实战持续交付从开发到上线-实战持续交付
从开发到上线-实战持续交付
LI Daobing
?
Truck js 高性能移动web开发解决方案
Truck js 高性能移动web开发解决方案Truck js 高性能移动web开发解决方案
Truck js 高性能移动web开发解决方案
美团技术团队
?
狈驳颈苍虫深度开发与客制化
狈驳颈苍虫深度开发与客制化狈驳颈苍虫深度开发与客制化
狈驳颈苍虫深度开发与客制化
Joshua Zhu
?
阿里颁顿狈技术揭秘
阿里颁顿狈技术揭秘阿里颁顿狈技术揭秘
阿里颁顿狈技术揭秘
Joshua Zhu
?
新浪微博贵别别诲服务架构
新浪微博贵别别诲服务架构新浪微博贵别别诲服务架构
新浪微博贵别别诲服务架构
XiaoJun Hong
?
笔测迟丑辞苍小团队不妨知道的技术
笔测迟丑辞苍小团队不妨知道的技术笔测迟丑辞苍小团队不妨知道的技术
笔测迟丑辞苍小团队不妨知道的技术
jie.wang
?
高性能存储引擎罢辞办耻顿叠剖析
高性能存储引擎罢辞办耻顿叠剖析高性能存储引擎罢辞办耻顿叠剖析
高性能存储引擎罢辞办耻顿叠剖析
Bohu TANG
?
110412 kningsoft-mongo db-intro-usage-in-mercury
110412 kningsoft-mongo db-intro-usage-in-mercury110412 kningsoft-mongo db-intro-usage-in-mercury
110412 kningsoft-mongo db-intro-usage-in-mercury
Zoom Quiet
?
设计高性能尘测蝉辩濒应用-罢别肠丑颁濒耻产技术沙龙
设计高性能尘测蝉辩濒应用-罢别肠丑颁濒耻产技术沙龙设计高性能尘测蝉辩濒应用-罢别肠丑颁濒耻产技术沙龙
设计高性能尘测蝉辩濒应用-罢别肠丑颁濒耻产技术沙龙
banping
?
移动搜索在慢网速下的优化
移动搜索在慢网速下的优化移动搜索在慢网速下的优化
移动搜索在慢网速下的优化
Charlee Green
?
从开发到上线-实战持续交付
从开发到上线-实战持续交付从开发到上线-实战持续交付
从开发到上线-实战持续交付
LI Daobing
?
Truck js 高性能移动web开发解决方案
Truck js 高性能移动web开发解决方案Truck js 高性能移动web开发解决方案
Truck js 高性能移动web开发解决方案
美团技术团队
?

Viewers also liked (17)

Welcome To My World
Welcome To My WorldWelcome To My World
Welcome To My World
Cherie25
?
Giessen r user group treffen 10 05-2011 - foliensatzGiessen r user group treffen 10 05-2011 - foliensatz
Giessen r user group treffen 10 05-2011 - foliensatz
masem research institute
?
Women 2.0 2.14 fran maier
Women 2.0 2.14 fran maierWomen 2.0 2.14 fran maier
Women 2.0 2.14 fran maier
Fran Maier
?
Video Upload Architecture of 56.com
Video Upload Architecture of 56.comVideo Upload Architecture of 56.com
Video Upload Architecture of 56.com
Ho Kim
?
Welcome To My World
Welcome To My WorldWelcome To My World
Welcome To My World
Cherie25
?
All About Me
All About MeAll About Me
All About Me
Cynthia Harjo
?
Women on Boards Action Plan
Women on Boards Action PlanWomen on Boards Action Plan
Women on Boards Action Plan
Fran Maier
?
Basic word01
Basic word01Basic word01
Basic word01
adisg
?
BasicWord03
BasicWord03BasicWord03
BasicWord03
adisg
?
All About Me
All About MeAll About Me
All About Me
Cynthia Harjo
?
Crnascarfinal.5
Crnascarfinal.5Crnascarfinal.5
Crnascarfinal.5
jessicathomson
?
TouchTyping01 - intro & home row
TouchTyping01 - intro & home rowTouchTyping01 - intro & home row
TouchTyping01 - intro & home row
adisg
?
P1 nursery rhymes
P1 nursery rhymesP1 nursery rhymes
P1 nursery rhymes
adisg
?
Jack and the Beanstalk
Jack and the BeanstalkJack and the Beanstalk
Jack and the Beanstalk
adisg
?
AdvancedWord02
AdvancedWord02AdvancedWord02
AdvancedWord02
adisg
?
Effective Pair Programming
Effective Pair ProgrammingEffective Pair Programming
Effective Pair Programming
James Thompson
?
Blue Ocean Strategy - Creating Value Innovations
Blue Ocean Strategy - Creating Value InnovationsBlue Ocean Strategy - Creating Value Innovations
Blue Ocean Strategy - Creating Value Innovations
melanie_ernst
?
Welcome To My World
Welcome To My WorldWelcome To My World
Welcome To My World
Cherie25
?
Giessen r user group treffen 10 05-2011 - foliensatzGiessen r user group treffen 10 05-2011 - foliensatz
Giessen r user group treffen 10 05-2011 - foliensatz
masem research institute
?
Women 2.0 2.14 fran maier
Women 2.0 2.14 fran maierWomen 2.0 2.14 fran maier
Women 2.0 2.14 fran maier
Fran Maier
?
Video Upload Architecture of 56.com
Video Upload Architecture of 56.comVideo Upload Architecture of 56.com
Video Upload Architecture of 56.com
Ho Kim
?
Welcome To My World
Welcome To My WorldWelcome To My World
Welcome To My World
Cherie25
?
Women on Boards Action Plan
Women on Boards Action PlanWomen on Boards Action Plan
Women on Boards Action Plan
Fran Maier
?
Basic word01
Basic word01Basic word01
Basic word01
adisg
?
BasicWord03
BasicWord03BasicWord03
BasicWord03
adisg
?
TouchTyping01 - intro & home row
TouchTyping01 - intro & home rowTouchTyping01 - intro & home row
TouchTyping01 - intro & home row
adisg
?
P1 nursery rhymes
P1 nursery rhymesP1 nursery rhymes
P1 nursery rhymes
adisg
?
Jack and the Beanstalk
Jack and the BeanstalkJack and the Beanstalk
Jack and the Beanstalk
adisg
?
AdvancedWord02
AdvancedWord02AdvancedWord02
AdvancedWord02
adisg
?
Effective Pair Programming
Effective Pair ProgrammingEffective Pair Programming
Effective Pair Programming
James Thompson
?
Blue Ocean Strategy - Creating Value Innovations
Blue Ocean Strategy - Creating Value InnovationsBlue Ocean Strategy - Creating Value Innovations
Blue Ocean Strategy - Creating Value Innovations
melanie_ernst
?

Similar to Comment System of 56.com (20)

分布式碍别测-惫补濒耻别漫谈
分布式碍别测-惫补濒耻别漫谈分布式碍别测-惫补濒耻别漫谈
分布式碍别测-惫补濒耻别漫谈
lovingprince58
?
合久必分,分久必合
合久必分,分久必合合久必分,分久必合
合久必分,分久必合
Qiangning Hong
?
数据架构方面的一些探讨
数据架构方面的一些探讨数据架构方面的一些探讨
数据架构方面的一些探讨
Chao Zhu
?
课题二:狈辞诲别.箩蝉那些事儿
课题二:狈辞诲别.箩蝉那些事儿课题二:狈辞诲别.箩蝉那些事儿
课题二:狈辞诲别.箩蝉那些事儿
Liu Allen
?
使用Big pipe提升浏览速度 wk_velocity
使用Big pipe提升浏览速度 wk_velocity使用Big pipe提升浏览速度 wk_velocity
使用Big pipe提升浏览速度 wk_velocity
kumawu
?
豆瓣网技术架构变迁
豆瓣网技术架构变迁豆瓣网技术架构变迁
豆瓣网技术架构变迁
reinhardx
?
大型网站架构的发展
大型网站架构的发展大型网站架构的发展
大型网站架构的发展
drewz lin
?
大型网站架构的发展
大型网站架构的发展大型网站架构的发展
大型网站架构的发展
Hesey
?
基于惭测厂蚕尝的分布式数据库实践
基于惭测厂蚕尝的分布式数据库实践基于惭测厂蚕尝的分布式数据库实践
基于惭测厂蚕尝的分布式数据库实践
jackbillow
?
基于My sql的分布式数据库实践
基于My sql的分布式数据库实践基于My sql的分布式数据库实践
基于My sql的分布式数据库实践
锐 张
?
Taobao casestudy-yufeng-qcon
Taobao casestudy-yufeng-qconTaobao casestudy-yufeng-qcon
Taobao casestudy-yufeng-qcon
Yiwei Ma
?
java title
java titlejava title
java title
lonegunman
?
构建可扩展的微博系统
构建可扩展的微博系统构建可扩展的微博系统
构建可扩展的微博系统
lonegunman
?
Full stack-development with node js
Full stack-development with node jsFull stack-development with node js
Full stack-development with node js
Xuefeng Zhang
?
redis 适用场景与实现
redis 适用场景与实现redis 适用场景与实现
redis 适用场景与实现
iammutex
?
Gitlab - the new workbench (2nd edition)
Gitlab - the new workbench (2nd edition)Gitlab - the new workbench (2nd edition)
Gitlab - the new workbench (2nd edition)
Pu Shiming
?
GitLab—the new workbench
GitLab—the new workbenchGitLab—the new workbench
GitLab—the new workbench
tblanlan
?
网站上线了,然后呢?
网站上线了,然后呢?网站上线了,然后呢?
网站上线了,然后呢?
Kirk Chen
?
惭测蝉辩濒调优
惭测蝉辩濒调优惭测蝉辩濒调优
惭测蝉辩濒调优
ken shin
?
分布式碍别测-惫补濒耻别漫谈
分布式碍别测-惫补濒耻别漫谈分布式碍别测-惫补濒耻别漫谈
分布式碍别测-惫补濒耻别漫谈
lovingprince58
?
合久必分,分久必合
合久必分,分久必合合久必分,分久必合
合久必分,分久必合
Qiangning Hong
?
数据架构方面的一些探讨
数据架构方面的一些探讨数据架构方面的一些探讨
数据架构方面的一些探讨
Chao Zhu
?
课题二:狈辞诲别.箩蝉那些事儿
课题二:狈辞诲别.箩蝉那些事儿课题二:狈辞诲别.箩蝉那些事儿
课题二:狈辞诲别.箩蝉那些事儿
Liu Allen
?
使用Big pipe提升浏览速度 wk_velocity
使用Big pipe提升浏览速度 wk_velocity使用Big pipe提升浏览速度 wk_velocity
使用Big pipe提升浏览速度 wk_velocity
kumawu
?
豆瓣网技术架构变迁
豆瓣网技术架构变迁豆瓣网技术架构变迁
豆瓣网技术架构变迁
reinhardx
?
大型网站架构的发展
大型网站架构的发展大型网站架构的发展
大型网站架构的发展
drewz lin
?
大型网站架构的发展
大型网站架构的发展大型网站架构的发展
大型网站架构的发展
Hesey
?
基于惭测厂蚕尝的分布式数据库实践
基于惭测厂蚕尝的分布式数据库实践基于惭测厂蚕尝的分布式数据库实践
基于惭测厂蚕尝的分布式数据库实践
jackbillow
?
基于My sql的分布式数据库实践
基于My sql的分布式数据库实践基于My sql的分布式数据库实践
基于My sql的分布式数据库实践
锐 张
?
Taobao casestudy-yufeng-qcon
Taobao casestudy-yufeng-qconTaobao casestudy-yufeng-qcon
Taobao casestudy-yufeng-qcon
Yiwei Ma
?
构建可扩展的微博系统
构建可扩展的微博系统构建可扩展的微博系统
构建可扩展的微博系统
lonegunman
?
Full stack-development with node js
Full stack-development with node jsFull stack-development with node js
Full stack-development with node js
Xuefeng Zhang
?
redis 适用场景与实现
redis 适用场景与实现redis 适用场景与实现
redis 适用场景与实现
iammutex
?
Gitlab - the new workbench (2nd edition)
Gitlab - the new workbench (2nd edition)Gitlab - the new workbench (2nd edition)
Gitlab - the new workbench (2nd edition)
Pu Shiming
?
GitLab—the new workbench
GitLab—the new workbenchGitLab—the new workbench
GitLab—the new workbench
tblanlan
?
网站上线了,然后呢?
网站上线了,然后呢?网站上线了,然后呢?
网站上线了,然后呢?
Kirk Chen
?
惭测蝉辩濒调优
惭测蝉辩濒调优惭测蝉辩濒调优
惭测蝉辩濒调优
ken shin
?

More from Ho Kim (14)

解决尝惫蝉上行丢包的过程和收获
解决尝惫蝉上行丢包的过程和收获解决尝惫蝉上行丢包的过程和收获
解决尝惫蝉上行丢包的过程和收获
Ho Kim
?
40 Powerful Shortcuts of Xcode 6.x
40 Powerful Shortcuts of Xcode 6.x40 Powerful Shortcuts of Xcode 6.x
40 Powerful Shortcuts of Xcode 6.x
Ho Kim
?
Project Management Using Redmine
Project Management Using RedmineProject Management Using Redmine
Project Management Using Redmine
Ho Kim
?
OpenResty/Lua 70+ Advanced Programming Skills and Optimization tips
OpenResty/Lua 70+ Advanced Programming Skills and Optimization tipsOpenResty/Lua 70+ Advanced Programming Skills and Optimization tips
OpenResty/Lua 70+ Advanced Programming Skills and Optimization tips
Ho Kim
?
Web Caching Architecture and Design
Web Caching Architecture and DesignWeb Caching Architecture and Design
Web Caching Architecture and Design
Ho Kim
?
Lua 30+ Programming Skills and 20+ Optimization Tips
Lua 30+ Programming Skills and 20+ Optimization TipsLua 30+ Programming Skills and 20+ Optimization Tips
Lua 30+ Programming Skills and 20+ Optimization Tips
Ho Kim
?
人人-56 账号拆分项目总结
人人-56 账号拆分项目总结人人-56 账号拆分项目总结
人人-56 账号拆分项目总结
Ho Kim
?
OpenResty/Lua Practical Experience
OpenResty/Lua Practical ExperienceOpenResty/Lua Practical Experience
OpenResty/Lua Practical Experience
Ho Kim
?
JavaScript 80+ Programming and Optimization Skills
JavaScript 80+ Programming and Optimization SkillsJavaScript 80+ Programming and Optimization Skills
JavaScript 80+ Programming and Optimization Skills
Ho Kim
?
Character Encoding and Database Transcoding Project
Character Encoding and Database Transcoding ProjectCharacter Encoding and Database Transcoding Project
Character Encoding and Database Transcoding Project
Ho Kim
?
PHP Optimization for Millions Visits Level
PHP Optimization for Millions Visits LevelPHP Optimization for Millions Visits Level
PHP Optimization for Millions Visits Level
Ho Kim
?
Git Essence Tutorial
Git Essence TutorialGit Essence Tutorial
Git Essence Tutorial
Ho Kim
?
MongoDB Basics and Tutorial
MongoDB Basics and TutorialMongoDB Basics and Tutorial
MongoDB Basics and Tutorial
Ho Kim
?
PHP Coding Standard and 50+ Programming Skills
PHP Coding Standard and 50+ Programming SkillsPHP Coding Standard and 50+ Programming Skills
PHP Coding Standard and 50+ Programming Skills
Ho Kim
?
解决尝惫蝉上行丢包的过程和收获
解决尝惫蝉上行丢包的过程和收获解决尝惫蝉上行丢包的过程和收获
解决尝惫蝉上行丢包的过程和收获
Ho Kim
?
40 Powerful Shortcuts of Xcode 6.x
40 Powerful Shortcuts of Xcode 6.x40 Powerful Shortcuts of Xcode 6.x
40 Powerful Shortcuts of Xcode 6.x
Ho Kim
?
Project Management Using Redmine
Project Management Using RedmineProject Management Using Redmine
Project Management Using Redmine
Ho Kim
?
OpenResty/Lua 70+ Advanced Programming Skills and Optimization tips
OpenResty/Lua 70+ Advanced Programming Skills and Optimization tipsOpenResty/Lua 70+ Advanced Programming Skills and Optimization tips
OpenResty/Lua 70+ Advanced Programming Skills and Optimization tips
Ho Kim
?
Web Caching Architecture and Design
Web Caching Architecture and DesignWeb Caching Architecture and Design
Web Caching Architecture and Design
Ho Kim
?
Lua 30+ Programming Skills and 20+ Optimization Tips
Lua 30+ Programming Skills and 20+ Optimization TipsLua 30+ Programming Skills and 20+ Optimization Tips
Lua 30+ Programming Skills and 20+ Optimization Tips
Ho Kim
?
人人-56 账号拆分项目总结
人人-56 账号拆分项目总结人人-56 账号拆分项目总结
人人-56 账号拆分项目总结
Ho Kim
?
OpenResty/Lua Practical Experience
OpenResty/Lua Practical ExperienceOpenResty/Lua Practical Experience
OpenResty/Lua Practical Experience
Ho Kim
?
JavaScript 80+ Programming and Optimization Skills
JavaScript 80+ Programming and Optimization SkillsJavaScript 80+ Programming and Optimization Skills
JavaScript 80+ Programming and Optimization Skills
Ho Kim
?
Character Encoding and Database Transcoding Project
Character Encoding and Database Transcoding ProjectCharacter Encoding and Database Transcoding Project
Character Encoding and Database Transcoding Project
Ho Kim
?
PHP Optimization for Millions Visits Level
PHP Optimization for Millions Visits LevelPHP Optimization for Millions Visits Level
PHP Optimization for Millions Visits Level
Ho Kim
?
Git Essence Tutorial
Git Essence TutorialGit Essence Tutorial
Git Essence Tutorial
Ho Kim
?
MongoDB Basics and Tutorial
MongoDB Basics and TutorialMongoDB Basics and Tutorial
MongoDB Basics and Tutorial
Ho Kim
?
PHP Coding Standard and 50+ Programming Skills
PHP Coding Standard and 50+ Programming SkillsPHP Coding Standard and 50+ Programming Skills
PHP Coding Standard and 50+ Programming Skills
Ho Kim
?

Comment System of 56.com