Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Detrás del Backend [phpDay 2015]

1,675 views

Published on

Centralización de logs con Elasticsearch + Logstash + Kibana
y Recolección de métricas con statsd/collectd, con multiples storages y visualizadores de métricas

Repositorio con infraestructuras automatizadas + un symfony que se integra
https://github.com/felixcarmona/detras-del-backend
(vagrant up)

Published in: Data & Analytics
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download Full EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download Full doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book THIS can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer THIS is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story THIS Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money THIS the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths THIS Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download Full EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download Full doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book THIS can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer THIS is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story THIS Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money THIS the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths THIS Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download Full EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download Full doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book THIS can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer THIS is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story THIS Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money THIS the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths THIS Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Be the first to like this

Detrás del Backend [phpDay 2015]

  1. 1. Sobre mi @felixcarmona46 github.com/felixcarmona linkedin.com/in/felixcarmona
  2. 2. Aplicación web
  3. 3. Aplicación web
  4. 4. ERROR 500 Aplicación web
  5. 5. Servidor SSH
  6. 6. tail -f /var/log/apache2/error.log
  7. 7. Servidor 1 Servidor 2 Servidor 3 Servidor 4 Servidor 5 Servidor 6 Servidor 7
  8. 8. Servidor 1 Servidor 2 Servidor 3 Servidor 4 Servidor 5 Servidor 6 Servidor 7
  9. 9. Servidor 1 Servidor 2 Servidor 3 Servidor 4 Servidor 5 Servidor 6 Servidor 7
  10. 10. Servidor 1 Servidor 2 Servidor 3 Servidor 4 Servidor 5 Servidor 6 Servidor 7
  11. 11. Servidor 1 Servidor 2 Servidor 3 Servidor 4 Servidor 5 Servidor 6 Servidor 7
  12. 12. tail -f /var/log/apache2/error.log
  13. 13. Centralización de Logs
  14. 14. Servidor 1 Servidor 2 Servidor 3 Servidor 4 Servidor 5 Servidor 6 Servidor 7 Procesador de Logs Almacen de Logs Visualizador de Logs Logstash Elasticsearch Kibana rsyslog
  15. 15. Tomando decisiones a la hora de desarrollar Software
  16. 16. Razonamiento antes que Intuición Razonamiento = Datos = Métricas
  17. 17. ¿Que preguntas deberían poder respondernos nuestras métricas?
  18. 18. ¿Esta mi aplicación funcionando? Si no lo está, ¿que parte esta fallando?
  19. 19. ¿Que áreas necesitan mejorar el rendimiento?
  20. 20. ¿Necesito escalar?
  21. 21. ¿Cual fue el impacto del último código deployado? ¿Ha repercutido sobre los usuarios? ¿Negativamente? ¿Deberiamos hacer rollback?
  22. 22. Tipos de métricas
  23. 23. Métricas de negocio (Alto nivel)
  24. 24. Métricas de las aplicaciones
  25. 25. Métricas de los sistemas (Bajo nivel)
  26. 26. Flujos y estrategias para recolectar métricas
  27. 27. Recolectando métricas con statsd Aplicación Peticiones Muestras Agregador de métricas Almacén de métricas Agrupación y guardado de las métricas recibidas durante x segundos (aka flush interval) Visualizador de metricas statsd Graphite (whisper) AWS CloudWatch Librato (Storage) Graphite (web app) Librato AWS CloudWatch (web)
  28. 28. Flush interval 1 1 1 1 1 1 1 7Statsd
  29. 29. Segundos que tarda en procesarse la tarea X 4 3 6 3 3 7 2 Statsd
  30. 30. Segundos que tarda en procesarse la tarea X 4 3 6 3 3 7 2 ?Statsd
  31. 31. Segundos que tarda en procesarse la tarea X 4 3 6 3 3 7 2 28?Statsd
  32. 32. Segundos que tarda en procesarse la tarea X 4 3 6 3 3 7 2 4Statsd
  33. 33. Segundos que tarda en procesarse la tarea X 4 3 6 3 3 7 2 7Statsd
  34. 34. Segundos que tarda en procesarse la tarea X 4 3 6 3 3 7 2 2Statsd
  35. 35. Tipos de métricas soportadas por statsd ● Counters ● Timers ● Gauges ● Sets
  36. 36. Contador, no confundir con esto: Alberto Contador
  37. 37. Counters Si durante el transcurso de un flush interval, enviamos las siguientes muestras para una métrica determinada: +2, +2, +4, -1. Statsd los sumará y guardará simplemente un valor 7.
  38. 38. Timers Sirven para colectan números. No necesariamente tienen porque ser valores de tiempo. Por ejemplo puedes guardar con ellos, el número de bytes leídos, el número de objetos en un almacén o cualquier cosa que sea un número.
  39. 39. Timers Finalizado el flush interval, statsd guardara 8 valores. Por ejemplo para las muestras 8.5, 2.3, 5, 3.1: ● La muestra mínima recibida (2.3) ● La muestra máxima recibida (8.5) ○ + percentil 90 ● La suma de todas las muestras recibidas (18.9) ○ + percentil 90 ● La media de todas las muestras recibidas (4.725) ○ + percentil 90 ● Número de muestras recibidas (4)
  40. 40. Gauges Solo la última muestra recibida durante un flush interval es guardada. Por ejemplo, si durante un flush interval statsd recibe las siguientes muestras para una métrica determinada: 1, 7, 4, 2. Statsd solo guardará el valor 2, y ademas lo reenviará al storage en cada flush interval
  41. 41. Sets Suma el número de muestras recibidas (no su valor, si no la cantidad de muestras recibidas) para una métrica determinada durante un flush interval. Pero para los valores repetidos, solo contará 1. Por ejemplo, si enviamos las muestras: 3, 4, 5, 2, 2, 3. Guardará un valor 4. porque descartará los repetidos, convirtiendo 3, 4, 5, 2, 2, 3 en 3, 4, 5, 2. Por lo tanto, guardará un valor 4. (4 muestras recibidas)
  42. 42. Balanceando vários statsd statsd statsd statsd Almacén de métricasBalanceador DNS Round Robin UDP Load Balancer (https://github.com/felixcarmona/udp-load-balancer) 1 3 2 ¿ 1 , 3 , 2 ? se guardará solo uno de los statsd que reporten
  43. 43. Balanceando vários statsd statsd statsd statsd statsd Almacén de métricas 1 3 2 6 Balanceador DNS Round Robin UDP Load Balancer (https://github.com/felixcarmona/udp-load-balancer)
  44. 44. Recolectando métricas con collectd Sistema Consultas Colector de métricas Almacén de métricas Cada X segundos (aka Interval) Visualizador de metricas collectd RRDtool Graphite (whisper) AWS CloudWatch Librato (Storage) Visage Graphite (web app) Librato AWS CloudWatch (web) nagios
  45. 45. Sistema Recolectando métricas con collectd + plugin statsd (escrito en C) Aplicación Muestras Colector Agregador collectd statsd plugin Almacén de métricas Visualizador de metricas RRDtool Graphite (whisper) AWS CloudWatch Librato (Storage)Consultas Visage Graphite (web app) Librato AWS CloudWatch (web)
  46. 46. Almacenes de métricas
  47. 47. 15 días de retención de datos $0,50 por metrica al mes AWS CloudWatch
  48. 48. Round Robin Database RRDtool Image from: http://www.loriotpro.com/Products/On-line_Documentation_V5/LoriotProDoc_EN/V22-RRD_Collector_RRD_Manager/V22- A1_Introduction_RRD_EN.htm
  49. 49. Escrito en Python Muy similar a RRDtool (Fixed size) Mas lento que RRDtool (Escrito en C) Roll-up: En lugar de desechar los datos más antiguos, los va degradando a menor resolución (60 métricas x 1 min -> 1 métrica x 1 h) Graphite (Whisper)
  50. 50. Librato 13 meses de retención Roll-up como whisper: ● Últimos 30 minutos: raw resolution ● Últimos 60 minutos: raw resolution ● Últimas 3 horas: 1 minuto de resolución ● Últimas 6 horas: 1 minuto resolución ● Últimas 12 horas: 15 minutos de resolución ● Últimas 24 horas: 15 minutos de resolución ● Últimos 3 días: 1 hora de resolución ● Últimos 7 días: 1 hora de resolución ● Últimas 4 semanas: 1 hora de resolución
  51. 51. Balanceando para Librato statsd statsd statsd LibratoBalanceador DNS Round Robin UDP Load Balancer (https://github.com/felixcarmona/udp-load-balancer) 1 3 2 1 , 3 , 2 se guardarán todos los statsd que reporten. Por lo que luego podremos leer la suma de todos (1 + 3 + 2 = 6), o la media de estos, etc
  52. 52. Visualizadores de métricas
  53. 53. Visage Image from http://hasnaas.blogspot.com.es/2013/08/gnome-opw-update-3.html
  54. 54. Graphite Image from https://www.devco.net/archives/2011/10/08/gdash-graphite-dashboard.php
  55. 55. AWS CloudWatch Image from http://blogs.clogeny.com/custom-metrics-in-amazon-cloudwatch/
  56. 56. Librato Image from http://blog.appharbor.com/2014/02/03/librato-integration-and-perfomance-metrics

×