首页 > 代码库 > 系统设计4:Web服务和流量限制

系统设计4:Web服务和流量限制

阅读材料:

HTTP-Session:

http://www.cnblogs.com/tankxiao/archive/2012/02/13/2342672.html

http://www.cnblogs.com/xueyuwyz/p/3593739.html

日志:

http://dataunion.org/12268.html

http://www.chinawebanalytics.cn/wa-server-logfile-basic-pros-and-cons/

Web服务:

http://blog.csdn.net/tuantuanls/article/details/41288311

http://job.xdnice.com/content/BiShiJingYan/2012-11/3992.htm

DNS:

http://codefine.co/978.html

https://www.slideshare.net/jonoxer/introduction-to-dns

http://linux.vbird.org/linux_server/0350dns.php

浏览器访问过程:

http://blog.csdn.net/bruce_6/article/details/39499439

反向代理:

http://www.admin10000.com/document/6186.html

https://www.zhihu.com/question/24723688

https://www.zhihu.com/question/19761434

lazy load:

https://www.zhihu.com/question/19703400

https://en.wikipedia.org/wiki/Lazy_loading

cache:

http://community.brocade.com/t5/vADC-Docs/Cache-your-website-just-for-one-second/ta-p/73929

CDN:

http://blog.csdn.net/wangqi0079/article/details/8582411

rate limiter:

http://stackoverflow.com/questions/667508/whats-a-good-rate-limiting-algorithm

https://github.com/jhurliman/node-rate-limiter

Token Bucket:

https://en.wikipedia.org/wiki/Token_bucket

http://code.activestate.com/recipes/578659-python-3-token-bucket-rate-limit/

https://engineering.classdojo.com/blog/2015/02/06/rolling-rate-limiter/

秒杀:

http://www.cnblogs.com/rollenholt/p/3393398.html

http://chuansong.me/n/1334017

http://sobuhu.com/program/2013/04/07/how-to-design-seckill.html

http://jag522.iteye.com/blog/2113519

http://mm.fancymore.com/reading/%E7%A7%92%E6%9D%80%E7%B3%BB%E7%BB%9F%E7%9A%84%E8%AE%BE%E8%AE%A1.html

http://itindex.net/detail/53237-%E7%A7%92%E6%9D%80-%E7%B3%BB%E7%BB%9F-%E8%AE%BE%E8%AE%A1

12306:

http://itindex.net/detail/39902-%E7%B3%BB%E7%BB%9F-%E8%AE%BE%E8%AE%A1

http://coolshell.cn/articles/6470.html

1、打开google网页时发生什么

网页访问失败率:连接失败数/全部连接数、一个网页都看不了的用户数/总用户数

http://blog.csdn.net/bruce_6/article/details/39499439

不耐烦用户

2、如何加速一个网页访问

  • 反向代理+多服务器
  • 压缩内容(js库)、压缩图片、lazy load
  • 缓存:浏览器、ISP cache、反向代理、应用服务器cache

3、如何设计一个秒杀系统

  • QPS:10 iphone,100W QPS(轰击流量)
  • 两级队列
  • 减少流量
    • 减少页面大小
    • 静态页面
    • 代理
    • 限制请求量(js,rate limit)
  • 保持简单
    • 无数据库:内存和日志
    • 无锁
  • 隔离
    • 挡冲击的服务器不要有其它逻辑
    • 异步
  • 攻击
    • IP
    • 验证码
  • Lottery

4、如何设计一个流量控制系统

  • 请求间隔
  • 吊桶(数据库、非数据库)
  • 队列
  • Token Bucket

系统设计4:Web服务和流量限制