十分钟构建高性能微信后台
Upcoming SlideShare
Loading in...5
×
 

十分钟构建高性能微信后台

on

  • 5,954 views

基于redis,一个类Kik应用的后台实现

基于redis,一个类Kik应用的后台实现

Statistics

Views

Total Views
5,954
Views on SlideShare
5,939
Embed Views
15

Actions

Likes
30
Downloads
235
Comments
0

5 Embeds 15

http://www.techgig.com 9
http://twitter.com 3
http://us-w1.rockmelt.com 1
http://www.mefeedia.com 1
http://paper.li 1

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    十分钟构建高性能微信后台 十分钟构建高性能微信后台 Presentation Transcript

    • 十分钟构建高性能微信后台
      Twitter:Dcshi
      Sina:Dcshi
      2011-03-31
    • Redis
      High-performance key-value store
      - Redis VS Memcache
      data structure server
      - strings, hashes, lists, sets and sorted sets
      Persistence
      -Snapshotting, Append-only file
      http://redis.io
    • Redis VS Memcache
      http://timyang.net/data/mcdb-tt-redis/
      http://antirez.com/post/redis-memcached-benchmark.html
    • Webdis
      Providing an HTTP interface to Redis
      curl http://127.0.0.1:7379/SET/hello/world
      Base on libevent/libev
      High-performance
      50,000 http requests per second on a desktop
      Flexible
      Json/jsonp….
      ACL(Access control)
    • 微信是神马?
    • Mockup(A)
    • Mockup(B)
    • Connection
      Socket
      Tcp
      Udp
      长连接:
      Comet
      Pub/Sub
      轮询
      Webdis
    • 轮询
    • Data Structure
      Friends list:
      Sorted Sets:
      - key : “friends:user_id”
      - val: (‘friend_id1’, friend_id2’,’ friend_id3’,…….)
      Messages:
      Lists:
      - key : “message:from_id:to_id”
      - value:[“time|url|content”, ”time|url|content”,..]
    • Operation
      Send a message:
      - Zincrby(http://redis.io/commands/zincrby)
      - Me +0
      - friend +1
      - Lpush(http://redis.io/commands/lpush)
    • Operation-mockup(A)
      初始化页面:
      - Nick
      - Avata
      - Latest message(content + time)
      检查未读消息数
      curl http://localhost:7379/zrevrangebyscore/friends:user_id/+inf/1/withscores
      return{"zrevrangebyscore":[“62716","4",“71313","2"]}
    • Operation-mockup(B)
      初始化页面
      Lrange
      Zincrby
      检查未读消息数
      curl http://localhost:7379/zscore/message:user_id/friend_id
      Return {“zscore”:4}
    • Q&A