Fotolog对memcached的应用

Fotolog在21台server上部署了51个memcached实例,使用了175G,剩余254G。他们对待缓存的策略是:缓存所有在查询、获取和计算上慢的东西。

几种应用类型:

Non-Deterministic Cache: 最常用的存储需要read的数据。平均每个memcached实例上有440gets/sec, 40sets/sec和11gets/set。但是通常来说memcached不是一个吃cpu的东西,但是却达到了90%的占用量,几乎每分钟一次内存垃圾回收,还有blocking发生。数据都不是transactional的。用了45个实例。

State Cache:把程序当前状态保存在cache里。对于昂贵的操作、session(如果存储session的memcached挂了,那改用户就得重新登陆了),为IM存储在线用户。

Deterministic Cache:这里存的是某些表的所有数据,程序在这里只搜索的缓存,而不去care数据库里的数据,在程序获取数据之前甚至都不用去检查数据是否存在(因为是整个db中tables的映像)。保存的是不会过期的数据,以及用户的profiles/preferences/photo lists等。如果网站重新启动了,在网站重启之前缓存的内容会提前建立。这部分做了LB。在缓存的cluster里发生9w gets/sec、300 sets/second,get:set=300:1(get/set ratio)。数据库结构到内存对象的映射(db schema=>objects)。

其次Fotolog还有Proactive Cache/File System Cache/Partial Page Cache/Application Based Replication等几种cache方案、应用。但不是(在当前阶段和使用微软技术的原因下)特别重要。

关于Fotolog的历史:

  • 2002年开始,04年时又30-40万会员,3名员工,在系统架构和盈利模式上都可以说一无所有。
  • 发展迅速,问题不断,2005年开始限制每天新增1000会员
  • 07年与1100万会员
  • 会员主要来自于South America,超过20%的pv来自欧洲。
  • 每月350亿pv,2千万独立访问ip
  • 拥有3亿照片,每天上传50万
  • 每天新增3万用户,4600万新用户访问
  • 20%用户每天都要访问并且平均时间为24分钟
  • 有32台mysql server和30台memcached server cluster

Revenue model:
- Gold camera member for about $5/month means you can upload 6 photos a day instead of 1, have 200 comments per photo instead of 20, a custom title image for your profile, a mini-thumbnail of your most recent photo displayed next to your name in guest books, plus the possibility of having your photo featured on the front page..
- Adsense. Revenue lift from Google is trending up approximately 15% given additional contextual data from guest books.
- Will move to a peer-to-peer advertising among their members.
- Members will have the ability to buy and sell real and virtual items using a micro-payment service.

posted @ 2009-03-05 10:11  new 维生素C.net()  阅读(295)  评论(0编辑  收藏  举报