开放平台的资源分配与多级缓存体系的优化

1,903 views

Published on

开放平台,资源分配,多级缓存,体系,优化

Published in: Technology, Sports
0 Comments
4 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,903
On SlideShare
0
From Embeds
0
Number of Embeds
715
Actions
Shares
0
Downloads
0
Comments
0
Likes
4
Embeds 0
No embeds

No notes for slide

开放平台的资源分配与多级缓存体系的优化

  1. 1. F -X C h a n ge F -X C h a n ge PD PD ! ! W W O O N N y y bu bu to to k k lic lic C Cw w m m w ww w o o .d o .c .d o .c c u -tr a c k c u -tr a c k http://weibo.com/steadwater 2011 SACC2011 1
  2. 2. F -X C h a n ge F -X C h a n ge PD PD ! ! W W O O N N y y bu bu to to k k lic lic C Cw w m m w ww w o o .d o .c .d o .c c u -tr a c k c u -tr a c k • • – – – 2011 SACC2011 2
  3. 3. F -X C h a n ge F -X C h a n ge PD PD ! ! W W O O N N y y bu bu to to k k lic lic C Cw w m m w ww w o o .d o .c .d o .c c u -tr a c k c u -tr a c k • • SNS • SNS • • • 2011 SACC2011 3
  4. 4. F -X C h a n ge F -X C h a n ge PD PD ! ! W W O O N N y y bu bu to to k k lic lic C Cw w m m w ww w o o .d o .c .d o .c c u -tr a c k c u -tr a c k • SNS • 2011 SACC2011 4
  5. 5. F -X C h a n ge F -X C h a n ge PD PD ! ! W W O O N N y y bu bu to to k k lic lic C Cw w m m w ww w o o .d o .c .d o .c c u -tr a c k c u -tr a c k • – TimeLine Feed • – API • – • – PC API 2011 SACC2011 5
  6. 6. F -X C h a n ge F -X C h a n ge PD PD ! ! W W O O N N y y bu bu to to k k lic lic C Cw w m m w ww w o o .d o .c .d o .c c u -tr a c k c u -tr a c k • RESTFUL OPENAPI Push 2011 SACC2011 6
  7. 7. F -X C h a n ge F -X C h a n ge PD PD ! ! W W O O N N y y bu bu to to k k lic lic C Cw w m m w ww w o o .d o .c .d o .c c u -tr a c k c u -tr a c k • IP Nginx7 – limit_zone one $binary_remote_addr 10m; • – • Redis DB – • -> redis, DB • VIP -> -> -> shmop Redis 2011 SACC2011 7
  8. 8. F -X C h a n ge F -X C h a n ge PD PD ! ! W W O O N N y y bu bu to to k k lic lic C Cw w m m w ww w o o .d o .c .d o .c c u -tr a c k c u -tr a c k • 80% • Web Server 4000RPS • • 2011 SACC2011 8
  9. 9. F -X C h a n ge F -X C h a n ge PD PD ! ! W W O O N N y y bu bu to to k k lic lic C Cw w m m w ww w o o .d o .c .d o .c c u -tr a c k c u -tr a c k Web CDN Web Server 7 Redis Web BufferPool Web 2011 SACC2011 9
  10. 10. F -X C h a n ge F -X C h a n ge PD PD ! ! W W O O N N y y bu bu to to k k lic lic C Cw w m m w ww w o o .d o .c .d o .c c u -tr a c k c u -tr a c k • Web 2011 SACC2011 10
  11. 11. F -X C h a n ge F -X C h a n ge PD PD ! ! W W O O N N y y bu bu to to k k lic lic C Cw w m m w ww w o o .d o .c .d o .c c u -tr a c k c u -tr a c k CDN Nginx 7 Image Web DFS 2011 SACC2011 11
  12. 12. F -X C h a n ge F -X C h a n ge PD PD ! ! W W O O N N y y bu bu to to k k lic lic C Cw w m m w ww w o o .d o .c .d o .c c u -tr a c k c u -tr a c k • Image CDN • Lazy 7 Web 2011 SACC2011 12
  13. 13. F -X C h a n ge F -X C h a n ge PD PD ! ! W W O O N N y y bu bu to to k k lic lic C Cw w m m w ww w o o .d o .c .d o .c c u -tr a c k c u -tr a c k • Cache- Control header CDN • Nginx7 CDN 7 Web • ImageServer 2011 SACC2011 13
  14. 14. F -X C h a n ge F -X C h a n ge PD PD ! ! W W O O N N y y bu bu to to k k lic lic C Cw w m m w ww w o o .d o .c .d o .c c u -tr a c k c u -tr a c k • DFS CDN 7 Web ImageServer DFS 2011 SACC2011 14
  15. 15. F -X C h a n ge F -X C h a n ge PD PD ! ! W W O O N N y y bu bu to to k k lic lic C Cw w m m w ww w o o .d o .c .d o .c c u -tr a c k c u -tr a c k ESI Web APC Session Session Session Redis LRU Pool InnoDB Buffer Pool 2011 SACC2011 15
  16. 16. F -X C h a n ge F -X C h a n ge PD PD ! ! W W O O N N y y bu bu to to k k lic lic C Cw w m m w ww w o o .d o .c .d o .c c u -tr a c k c u -tr a c k JS 2011 SACC2011 16
  17. 17. F -X C h a n ge F -X C h a n ge PD PD ! ! W W O O N N y y bu bu to to k k lic lic C Cw w m m w ww w o o .d o .c .d o .c c u -tr a c k c u -tr a c k JS IE UserData FireFox Chrome SessionStorage FlashCache – FlashCache – HTML5 2011 SACC2011 17
  18. 18. F -X C h a n ge F -X C h a n ge PD PD ! ! W W O O N N y y bu bu to to k k lic lic C Cw w m m w ww w o o .d o .c .d o .c c u -tr a c k c u -tr a c k • PHP ob_XXX • Web – – – 2011 SACC2011 18
  19. 19. F -X C h a n ge F -X C h a n ge PD PD ! ! W W O O N N y y bu bu to to k k lic lic C Cw w m m w ww w o o .d o .c .d o .c c u -tr a c k c u -tr a c k • ESI – Web Nginx ESI Module 7 – – 2011 SACC2011 19
  20. 20. F -X C h a n ge F -X C h a n ge PD PD ! ! W W O O N N y y bu bu to to k k lic lic C Cw w m m w ww w o o .d o .c .d o .c c u -tr a c k c u -tr a c k • APC – Shmop – – • Session – Session – – OAuth Token 2011 SACC2011 20
  21. 21. F -X C h a n ge F -X C h a n ge PD PD ! ! W W O O N N y y bu bu to to k k lic lic C Cw w m m w ww w o o .d o .c .d o .c c u -tr a c k c u -tr a c k • APC – Shmop – – • Session – Session – – OAuth Token 2011 SACC2011 21
  22. 22. F -X C h a n ge F -X C h a n ge PD PD ! ! W W O O N N y y bu bu to to k k lic lic C Cw w m m w ww w o o .d o .c .d o .c c u -tr a c k c u -tr a c k • Redis • Redis • – Web Server – – Server Hash Persist 2011 SACC2011 22
  23. 23. F -X C h a n ge F -X C h a n ge PD PD ! ! W W O O N N y y bu bu to to k k lic lic C Cw w m m w ww w o o .d o .c .d o .c c u -tr a c k c u -tr a c k • Session – – Session 50 Ajax – 2011 SACC2011 23
  24. 24. F -X C h a n ge F -X C h a n ge PD PD ! ! W W O O N N y y bu bu to to k k lic lic C Cw w m m w ww w o o .d o .c .d o .c c u -tr a c k c u -tr a c k • Session – – – DiskStore 2011 SACC2011 24
  25. 25. F -X C h a n ge F -X C h a n ge PD PD ! ! W W O O N N y y bu bu to to k k lic lic C Cw w m m w ww w o o .d o .c .d o .c c u -tr a c k c u -tr a c k • – Transaction – • – Apache Common Pool – LRU 2011 SACC2011 25
  26. 26. F -X C h a n ge F -X C h a n ge PD PD ! ! W W O O N N y y bu bu to to k k lic lic C Cw w m m w ww w o o .d o .c .d o .c c u -tr a c k c u -tr a c k • Feed • TimeLine Topic Mysql Feed MySQL handlerSocket • MySQL handlerSocket Buffer Pool – innodb_buffer_pool_size 70% – innodb_flush_method=O_DIRECT SWAP – Secondary Buffer Pool SSD Percona XtraDB 2011 SACC2011 26
  27. 27. F -X C h a n ge F -X C h a n ge PD PD ! ! W W O O N N y y bu bu to to k k lic lic C Cw w m m w ww w o o .d o .c .d o .c c u -tr a c k c u -tr a c k • – DFS IOPS -> – Xhprof PHP Feed RPC -> Redis – IOPS -> Redis • 2011 SACC2011 27
  28. 28. F -X C h a n ge F -X C h a n ge PD PD ! ! W W O O N N y y bu bu to to k k lic lic C Cw w m m w ww w o o .d o .c .d o .c c u -tr a c k c u -tr a c k • • • 2011 SACC2011 28
  29. 29. F -X C h a n ge F -X C h a n ge PD PD ! ! W W O O N N y y bu bu to to k k lic lic C Cw w m m w ww w o o .d o .c .d o .c c u -tr a c k c u -tr a c k 2011 SACC2011 29

×