Upgrade to Pro — share decks privately, control downloads, hide ads and more …

ElixirConf 2016 - Measuring your elixir App

Renan Ranelli
September 06, 2016

ElixirConf 2016 - Measuring your elixir App

Renan Ranelli

September 06, 2016
Tweet

More Decks by Renan Ranelli

Other Decks in Programming

Transcript

  1. Why should I care? We write code. We do it

    because it generate business value.
  2. Why should I care? We write code. We do it

    because it generate business value. But this business value is generated only when our code *runs*. *NOT* when it is written
  3. Why should I care? In order to make good decisions

    about something, we must understand it.
  4. Why should I care? In order to make good decisions

    about something, we must understand it. (And we want to make good decisions because we like getting paid)
  5. Metrics – average value First thing you should ask: Which

    time period does this average refer to ??? Averages completely destroy the **variability** and **recency**.
  6. Metrics – average value A common thing to do is

    add a “decay” component to the average calculation:
  7. Metrics – average value A common thing to do is

    add a “decay” component to the average calculation:
  8. Histograms Histograms are like averages on steroids. As such, you

    **have** to pay attention to The aggregation period it refers to
  9. You have to solve these parts: ❑ Collect ❑ Store

    ❑ Query, Analyze & Transform ❑ Visualize ❑ … ❑ MAKE DECISIONS (!)
  10. Our metrics collection architecture Log parsing Exometer & Elixometer Influxdb

    plugin “report api” Query & Visualize Transform & Analyze STORE Collect Store View
  11. Our (boring) choices ❑ Collect •Exometer & Elixometer are very

    easy to set up •We have used collectd extensively in the past ❑ Store (InfluxDB) •**Very** easy to set up & configure. And free. •Built-in retention policy configuration •Awesome query language & Continuous queries •Plugs seamlessly with grafana
  12. Our (boring) choices ❑ View (Grafana) •We have used it

    in the past. •It is awesome and beautiful (you will see!)
  13. Our (boring) choices ❑ You might ask: ❑ Why you’re

    not using solution like Splunk, DataDog, etc?
  14. Our (boring) choices ❑ You might ask: Why you’re not

    using solution like Splunk, DataDog, etc? ❑ Our answer: ❑ We don't like our data outside our walls. Also, NDAs and legal obligations
  15. Exometer & Elixometer ❑ Exometer Exometer Reporter Metrics buffer (pre

    aggregated ) High frequency Metric reports Store & update Aggregated view Collect & convert Low frequency Metrics formated for other backends
  16. Exometer & Elixometer ❑ This design is almost omnipresent in

    metrics world. ❑ Other tools like statsd, telegraf, etc might fit the role of exometer in your case. Use the one you’re most comfortable with. ❑ It is **very** important to be able to control the frequency which your storage receives requests. You don’t want to overload it.
  17. DEMONSTRATION • Measuring all requests to a phoenix app Step

    by step instructions here: http://milhouseonsoftware.com/2016/05/08/me asuring-your-elixir-application/
  18. Other things you should measure ❑ The Erlang VM is

    **awesome** (and that’s why we’re here ;P) ❑ There are lots of resources out there on how to measure, monitor and operate it. ❑ But sadly I don’t have enough time to go in depth about it ~ Use vm_stats to gather virtual machine metrics! https://github.com/ferd/vmstats
  19. Other things you should measure ❑ The Erlang VM is

    **awesome** (and that’s why we’re here ;P) ❑ ❑ There are lots of resources out there on how to measure, monitor and operate it. ❑ ❑ But sadly I don’t have enough time to go in depth about the things the instrumentation the VM exposes ~
  20. Other things you should measure ❑ The Erlang VM is

    **awesome** (and that’s why we’re here ;P) ❑ ❑ There are lots of resources out there on how to measure, monitor and operate it.
  21. Closing remarks ❑ Find “seams” in your code where you

    can “plug” measurements. ❑ Try not to spread metrics reporting “everywhere”. It’s best to separat “high level” measurements from “low level” ones. ❑ This is just the beginning. After you have this infrastructure in place, you have to start doing analysis, correlation and other math stuffs. That’s where the real *gold* is.
  22. Closing remarks ❑ Bend your metrics to generate alerts. This

    is **really** awesome. ❑ Another (similar) metrics collection architecture is described here: http://tech.footballaddicts.com/blog/gathering-metrics-in-elixir- applications ❑ Zed Shaw has an awesome post about statistics: ❑https://zedshaw.com/archive/programmers-need-to-learn-statistics- or-i-will-kill-them-all/