Meetup - NGinx - 08/2014

Embed Size (px)

DESCRIPTION

Slides of the nginx meetup

Text of Meetup - NGinx - 08/2014

  • Meetup - Nginx 04/08
  • Introduccin Qu problemas tenamos? Cmo los resolvimos? Nginx Qu es? Cmo funciona? Benchmark Demo Trfico/Nmeros NGinx Mejoras AB Test implementation Mobile detection Testing rules Logs / Tracking Preguntas Agenda
  • Introduccin
  • WebServer Java 1.5 BD Web F5 Infrastructure Development Qu problemas tenamos? WebServer Java 1.5 WebServer Java 1.5 WebServer Java 1.5
  • 80 mb Qu problemas tenamos?
  • Deploy lento - Jar ~ 80mb Incertidumbre y dificultad de upgrade de versiones Innovacin acotada Solo contratbamos desarrolladores java Dependencia externa para configurar reglas Dificultad para dedicar hardware a ciertas funcionalidades .... if the only tool you have is a hammer, to treat everything as if it were a nail. Abraham Maslow Qu problemas tenamos?
  • Qu problemas tenamos?
  • Deploy lento - ~Jar 80mb Aplicaciones acotadas! Incertidumbre y dificultad de upgrade de versiones Aplicaciones independientes! Innovacin acotada Stack libre! Solo contratbamos desarrolladores java Developers en cualquier lenguaje! Dependencia externa para configurar reglas Acceso abierto a reglas! Dificultad para dedicar hw a ciertas funcionalidades Crear equipos facilmente! Open platform! Cmo los resolvimos?
  • Web F5 Infrastructure Development NGinx Node JS Play!Tomcat Elastic search NGinx F5 Grails Rails api.mercadolibre.com [Enter your HTTP server here] Cmo los resolvimos?
  • Fuente: http://static.thegeekstuff.com/wp-content/uploads/2013/11/nginx-architecture.png Cmo funciona?
  • Fuente: http://joeandmotorboat.com/2008/02/28/apache-vs-nginx-web-server-performance-deathmatch/ Apache NGINX Benchmark
  • Demo
  • Server 4 CPUs x Intel Core(TM)2 6 GB RAM Ubuntu 12.04 Linux 3.2.0-31-generic x86_64 Trfico/Nmeros APIs 8,050,000 req x min 57 servers Frontends 1,000,000 req x min 28 servers Total 9,050,000 req x min 85 servers
  • Mejoras
  • upstream old_upstream { server 127.0.0.1:1234; } upstream new_upstream { server 127.0.0.1:4321; } split_clients $vars* $split_upstream { 10% _new_upstream; - _old_upstream; } server { location / { proxy_pass http://$split_upstream$request_uri; } } $vars* eg: $remote_addr / $request_uri A/B Testing upstream old_upstream { server 127.0.0.1:1234; } upstream new_upstream { server 127.0.0.1:4321; } location / { if ($http_cookie ~* "test=yes") { proxy_pass http://new_upstream; break; } proxy_pass http://old_upstream; } Consistent hashing Custom hashing
  • map $http_user_agent $xDeviceType { ~*(ipad|Silk.1.0.22.79|android(?!(.*mobile|.*kindle|.*A2107A|.*HP. 7|.*HP.Slate.7|.*B1-710|.*GT-P3100|.*IdeaTabA1000|.*gt-P3110|.*gt-P3113|.*ME172V|.*B1-A71|.*A200|.*A100|. *SM-T210R|.*SGPT12|.*SM-T310))(?!(.*MMS-V))|xoom|sch-i800|playbook|tablet|gt-P1000|gt-P5100|gt-P7500|gt- P7510|kindle.fire|.*KFOT.Build|.*KFTT.Build|.*KFJWI.Build|.*KFJWA.Build) "tablet"; ~*(blackberry|android|iphone|ipod|symb|googlebot-mobile|Playstation.Vita|kindle|symbian|windows. phone|BB10|Mobile.*Firefox|Nokia[0-9][0-9]|Nokia[A-Z][0-9]|LG-[A-Z][0-9]|SAMSUNG-GT|SPICE|Opera.Mini) "mobile"; default "desktop"; } proxy_set_header X-Device-Type "$xDeviceType"; map $http_user_agent $xDeviceJs { ~*(SPICE|BB10|SAMSUNG-GT-C3322|SAMSUNG-GT-E2200|SAMSUNG-GT-S5222|SAMSUNG-GT- S3570|S3570XILH1|blackberry|symbian|opera.mini|windows.phone|Nokia[0-9][0-9]|Nokia[A-Z][0-9]|LG-C[0-9] |LG-T[0-9]) false; default true; } proxy_set_header X-Device-JS "$xDeviceJs"; Mobile detection if(headers['X-Device-Type']=='desktop'){ render('desktop_tpl'); else{ render('mobile_table_tpl'); } Backend - JS
  • Logs/Tracking NGinx WS X-DATA:[RESPONSE_DATA] Stream Hadoop Real Time Consumers Live Streaming Informacin del Request completo. Trackeo por Browser, Session y Request. 100% de Trackeo. Informacin agregada client-side y server-side.
  • Drone.io curlb.ml.com->->10.3.2.5? curlc.ml.com->->10.3.2.6? curld.ml.com->->10.3.2.7? curla.ml.com->->10.3.2.4? 1 Pullreq Launch CIRun tests OK / Fail OK / Fail OK/Fail OK? 23 4 5 7 6 Deploy Testing rules Coming soon open-source!
  • Preguntas We are hiring!