Top Banner
Web Performace with Adflex.vn Đoàn Văn Tuyển CTO Eway JSC
19

Web performace with Adflex

Jun 26, 2015

Download

Technology

Tuyển Đoàn

Web performace with Adflex
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Web performace with Adflex

Web Performace with Adflex.vn

Đoàn Văn TuyểnCTO Eway JSC

Page 2: Web performace with Adflex

Họ Tên: Đoàn Văn Tuyển Chức vụ: Giám đốc kỹ thuật Eway JSC Sản phẩm: Adflex.vn và Sangame.net

Giới thiệu

Page 3: Web performace with Adflex

Adflex.vn

Sản phẩm quảng cáo trên di động: in-app& web

1 năm tuổi với khoảng 12 triệu người dùng (80% ở Việt Nam)

DAU ~ 800k-1M, ~ 25-30 triệu request/ ngày

Tốc độ xử lý: 4ms-40ms / request

Page 4: Web performace with Adflex

Nội dung trình bày

Thiết kế hệ thống Web Server & CDN PHP Database (MongoDB) Cache server (Redis) Job server (RabbitMQ) Monitoring Debug & Profiling

Page 5: Web performace with Adflex

Thiết kế hệ thống

Page 6: Web performace with Adflex

Web Server & CDN

Proxy (Nginx): Nhận request và phân chia vào nhiều server để xử lý

Server (Apache & PHP): Xử lý business chính CDN: trả về các nội dung tĩnh như image,

CSS & JS Config for Performace:

− Gzip / Cache time− Log reponse time / server time

Page 7: Web performace with Adflex

PHP & Opcode cache

Page 8: Web performace with Adflex

PHP Configuration

Cấu hình opcode cache: APC Giới hạn memory: 32MB-64MB Giới hạn execute time: 2-10s

Page 9: Web performace with Adflex

Database Server

Page 10: Web performace with Adflex

Database Server

Sử dụng ổ SSD Chia làm 2 DB

− 1 DB xử lý realtime. Yêu cầu update nhiều, số lượng request lớn

− 1 DB xử lý report: yêu cầu query phức tạp. Monitoring

− Mongotop− Mongo slow query log− Http console log

Page 11: Web performace with Adflex

Cache Server

Sử dụng Redis làm cache server− Lưu dữ liệu thường xuyên truy cập− Lưu dữ liệu yêu cầu tạm thời (một vài ngày)

Cache file PHP + APC

Page 12: Web performace with Adflex

Job Server: Rabbit MQ

Page 13: Web performace with Adflex

Job Server: Rabbit MQ

Xử lý tất cả những tác vụ tốn thời gian qua job server: Gửi mail, log dữ liệu, tính toán...

Sử dụng RabbitMQ làm Job Server Sử dụng PHP làm worker (Chạy lệnh PHP) Worker sử lý theo Batch

Page 14: Web performace with Adflex

Monitoring - Newrelic

RAM CPU Network Disk

Used /IO

Page 15: Web performace with Adflex

Monitoring - Newrelic

Response time

Appdex Score

Throughput

Error & Alert

Page 16: Web performace with Adflex

Debug & Profiling

Page 17: Web performace with Adflex

Debug & Profiling

Profiling: xhprof Debug: Apache log4php Manual:

− microtime− register_shutdown_function− debug_print_backtrace− ...

Page 18: Web performace with Adflex

Q&A

Page 19: Web performace with Adflex

Tham khảohttp://www.slideshare.net/tuyenbk83/php-web-server-performace

http://java.dzone.com/articles/php-performance-crash-course

http://on.fb.me/1hAc7vL

https://developers.google.com/speed/docs/best-practices/rules_intro

http://developer.yahoo.com/performance/rules.html

http://www.slideshare.net/lonelywolf/web-optimization

http://code.google.com/p/modpagespeed/

https://github.com/pagespeed/ngx_pagespeed

://developer.yahoo.com/yslow/

https://developers.google.com/speed/pagespeed/insights_extensions

https://addons.mozilla.org/en-US/firefox/addon/firebug

http://php.net/manual/en/book.apc.php

http://php.net/manual/en/book.xhprof.php

http://www.mdproductions.ca/guides/50-best-practices-to-optimize-php-code-performance

http://www.chazzuka.com/63-best-practice-to-optimize-php-code-performances-58/

http://fuscata.com/kb/set-maxclients-apache-prefork