flyingv laravel & aws 經驗分享

Download flyingV Laravel & AWS 經驗分享

Post on 19-Aug-2014

1.468 views

Category:

Engineering

10 download

Embed Size (px)

DESCRIPTION

 

TRANSCRIPT

  • flyingV Laravel + AWS solution
  • About me Eugene FlyingV Inside
  • About flyingV flyingV 2011/7 2012/4 9 ()
  • flyingV 354 635 796 248 - 693 1198
  • flyingV AWS solution EC2 + RDS + CloudFront + S3 + SES + SQS Play framework (java, scala) Laravel 4 (php) jQuery Backbone.js jQuery + handlebars.js Github Slack Asana Rollbar
  • flyingV EC2 Haproxy / Staging Server /Admin Panel / memcache FE1 FE2 FE3 . RDS Cloudfront S3 SES SQS
  • Laravel 4 best PHP Framework ever
  • Laravel PHP PHP Composer PHP artisan ModelController Migration Localhost web server Eloquent ORM
  • Composer.json flyingV laravel/framework: 4.1 cartalyst/sentry cartalyst/sentry-social j20/php-uuid intervention/image aws/aws-sdk-php-laravel vinelab/http codesleeve/asset-pipeline rollbar/rollbar thujohn/rss anahkiasen/former intouch/laravel-newrelic Dev barryvdh/laravel-debugbar barryvdh/laravel-migration- generator
  • flyingV submodule
  • flyingV 67%
  • Google
  • - 2013 2014
  • color run 6536700 (java scala) 74x large FE 8x large RDS safe 1600
  • flyingV PHP Laravel 7 4xlarge FE + RDS 8xlarge 2200 RDS cpu100% 800 table foreign key index
  • ptt 4xlarge FE + RDS 8X large RDS 100% 6700 cache view cachequery cachemysql slow log
  • FE 4X large FE + xlarge RDS 1000 FE4100% RDS 10% cache nativeio lock memcache
  • SlackRollbar SlackPM Rollbar
  • .
  • Thanks & Continue eugene@ontoo.cc
  • About me Ronald/hothero FlyingV http://about.me/hothero
  • Outline New Server Architecture Problem & Solution how to solve Ssl termination Elb auto scaling The future of flyingv https nfs I/O lock problem Nginx php5-fpm different instance typehtop (php RDS)
  • Due to ex https OpenSSL (ex: Heartbleed) 100 500 1000 2000 0 1000 2000 3000 1 5 10 30
  • NFS I/O-Lock PHP-FPM & Nginx DB Indexing Slow Query N+1 Query
  • NFS I/O-Lock cache lock !!! View cache, db query cache, session, View Cache DB Query Cache Session
  • PHP5-FPM & Nginx Configuration EC2 Instance Type: c3.large, c3.xlarge, c3.2xlarge, c3.4xlarge, c3.8xlarge # of CPU Core: 2~32 RAM: 3.75~60 GiB Configuration Nginx: worker_processes 4; PHP5-FPM: pm.max_children = 32; Static, dynamic, on demand Process children RAM php scripts CPU Nginx worker_process
  • Programming Detail DB Connections
  • (1/2) Before Instancefrom AMI PHP5-FPM & Nginx private ip haproxy Private ip: public ip New Get Notifications
  • (2/2) SSL Termination ELB SSL Termination Auto Scaling
  • SSL Termination SSL AWS HTTPS forward to HTTP Web Server HTTP URL Rewrites: 3xx Redirects POST Website Development Framework URL Helper laravel form::open, request::root(), PHP $_SERVER[HTTP_X_FORWARDED_PROTO] ex: js/jquery.latest.min.js)
  • SSL Termination Troubleshooting
  • PHP Script Including Laravel require '../vendor/autoload.php'; require '../bootstrap/start.php'; use IlluminateDatabaseCapsuleManager as Capsule; $capsule = new Capsule; $capsule- >addConnection(Config::get('database.connections. mysql')); $capsule->bootEloquent();
  • Auto Scaling Group Monitoring CPU Bandwidth Disk I/O Swarm CPU 50% 1000
  • ELB Auto Scaling Group Launch Configuration
  • FlyingV PM Bug