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

Elastic Stackで始めるJavaアプリのパフォーマンス監視 / Intro Elastic Stack and Elastic APM Java

Elastic Stackで始めるJavaアプリのパフォーマンス監視 / Intro Elastic Stack and Elastic APM Java

2018/07/25のJJUG ナイトセミナーで使用したスライドになります。

サンプルアプリ、Beats系の設定は以下のGitHubリポジトリで公開してます。
https://github.com/johtani/apm-beats-kubernetes-demo/

Jun Ohtani

July 25, 2018
Tweet

More Decks by Jun Ohtani

Other Decks in Technology

Transcript

  1. !1
    Jun Ohtani
    Community Engineer @Elastic

    Twitter: @johtani
    Elastic StackͰ࢝ΊΔJavaΞϓϦͷ
    ύϑΥʔϚϯε؂ࢹ

    View full-size slide

  2. !2
    about
    • Me, Jun Ohtani / Developer Advocate
    ‒ lucene-gosenίϛολʔ
    ‒ σʔλ෼ੳج൫ߏஙೖ໳ ڞஶ
    ‒ http://blog.johtani.info

    • Elastic, founded in 2012
    ‒ Products: Elasticsearch, Logstash, Kibana, Beats 

    Elastic APM, 

    X-Pack, Elastic Cloud, Swiftype 

    Professional services: Support & development subscriptions

    Trainings, Consulting, SaaS

    View full-size slide

  3. !3
    ΞδΣϯμ
    • Elastic Stackͱ͸ʁ
    • Elastic APMͱ͸ʁ
    • Elastic APM Java Agentͷ࢖͍ํ

    View full-size slide

  4. !4
    Elastic Stack

    View full-size slide

  5. 5
    Elastic Stack
    100% Φʔϓϯιʔε
    ʮΤϯλʔϓϥΠζ൛ʯ͸ແ͠
    όʔδϣϯ 5.0Ͱ׬શ౷Ұ

    View full-size slide

  6. 7
    Beats
    ܰྔσʔλγούʔ
    ιʔε͔ΒσʔλΛసૹ సૹ͠Elasticsearchʹू໿ ม׵ͱύʔεͷͨΊ
    Logstashʹసૹ
    Elastic Cloudʹసૹ
    Libbeat: ΧελϜbeatsͷͨ
    ΊͷAPIϑϨʔϜϫʔΫ
    30Ҏ্ͷίϛϡχςΟbeats

    View full-size slide

  7. The Beats family
    Heartbeat
    Uptime monitoring
    Filebeat
    Log files
    Winlogbeat
    Windows Event Logs
    Packetbeat
    Network data
    +40
    community
    Beats
    Metricbeat
    Metrics
    Auditbeat
    Audit data

    View full-size slide

  8. 10
    Logstash
    σʔλՃ޻ύΠϓϥΠϯ
    શͯͷܗࣜɺαΠζͱσʔλιʔ
    εͷ౤ೖ
    ύʔεͱಈతͳ
    σʔλม׵
    ͋ΒΏΔग़ྗʹ
    σʔλసૹ
    ҆શͰ҉߸Խ͞Εͨ

    σʔλೖྗ
    ಠࣗͷύΠϓϥΠϯॲཧ
    ͷ࡞੒
    200Ҏ্ͷϓϥάΠϯ

    View full-size slide

  9. 12
    Elasticsearch
    Heart of the Elastic Stack
    ෼ࢄܕɺεέʔϥϒϧ ߴՄ༻ੑ Ϛϧνςφϯτ
    ։ൃऀϑϨϯυϦʔ ϦΞϧλΠϜɺશจݕࡧ ΞάϦήʔγϣϯ

    View full-size slide

  10. 14
    Kibana
    Window into the Elastic Stack
    ՄࢹԽͱ෼ੳ ஍ཧۭؒ ΧελϚΠζͱ
    Ϩϙʔτͷڞ༗
    άϥϑ୳ࡧ Elastic Stack΁ͷ
    ηΩϡΞͳΞΫηεͱ؅ཧ
    ΧελϜAppsͷ࡞੒

    View full-size slide

  11. !16
    Elastic APM

    View full-size slide

  12. !17
    Full-stack monitoring with Elastic
    APM adds end-user experience and application-level monitoring to the stack

    View full-size slide

  13. APM Architecture
    APM data is just another Index

    View full-size slide

  14. !19
    Supported agents
    - Python (https://github.com/elastic/apm-agent-python)
    - Node.js (https://github.com/elastic/apm-agent-nodejs)
    - Ruby (https://github.com/elastic/apm-agent-ruby)
    - JS Beta (https://github.com/elastic/apm-agent-js-base)
    - Go Beta (https://github.com/elastic/apm-agent-go)
    - Java Beta (https://github.com/elastic/apm-agent-java)
    All agents are Open Source and available on GitHub

    View full-size slide

  15. !20
    Java agent is now in
    beta!

    View full-size slide

  16. !21
    Download the agent
    • Download jar from Maven Central
    • Don't declare a dependency

    View full-size slide

  17. !22
    Start application with Java agent enabled
    java -javaagent:/path/to/elastic-apm-agent-.jar \
    -Delastic.apm.service_name=my-application \
    -Delastic.apm.server_url=http://localhost:8200 \
    -jar my-spring-boot-application.jar

    View full-size slide

  18. Deployment:
    nginx

    Pod
    Deployment:
    app

    Pod
    Deployment:

    mysql

    Pod
    Service:
    nginx


    LoadBalancer
    Metrics
    Network Analytics Logs
    Application Performance Monitoring

    View full-size slide

  19. !25
    Supported Technologies
    • Java 7+
    • Frameworks/APIs/Libraries
    ‒ Servlet API
    ‒ Spring Web MVC/Spring Boot
    ‒ JDBC
    • Application Servers/Servlet Containers
    ‒ Tomcat
    ‒ WildFly
    ‒ Jetty
    ‒ WebSphere
    ‒ Spring Boot with embedded Tomcat, Jetty and Undertow
    • Participate in the survey

    View full-size slide

  20. How does it work?
    !29

    View full-size slide

  21. !30
    Instrumenting Servlets
    Request
    Response
    Agent
    Agent
    Servlet.s
    ervice
    • Java agents can modify classes when they are loaded
    • When Java load a Servlet class
    ‒ Agents adds code before and after Servlet#service
    ‒ Record Transactions (URL, parameters, response code)
    ‒ Send to APM Server

    View full-size slide

  22. !31
    Automatic + Manual Instrumentation
    • Automatically records requests
    ‒ HTTP traffic for Servlet API-based applications
    ‒ JDBC queries
    • Offers API for customization
    ‒ Application specific metadata
    ‒ Custom transactions
    ‒ OpenTracing integration
    The best of both worlds

    View full-size slide

  23. !33
    Future
    • Distributed Tracing
    ‒ Troubleshoot latency issues and errors in (micro-) service architectures
    ‒ Correlates the interaction of the services by passing correlation IDs
    • Better integration of APM/logging/metrics
    • Support for more frameworks and application servers
    ‒ Spring Web Reactive
    ‒ Tell us what you want support for: participate in the survey

    View full-size slide

  24. !34
    bit.ly/EnqEsMeetup

    View full-size slide

  25. Thank you!
    ● Documentation : https://www.elastic.co/guide/en/apm/agent/java
    ● GitHub : https://github.com/elastic/apm-agent-java
    ● Forums : https://discuss.elastic.co/apm
    ● Survey : https://discuss.elastic.co/t/apm-agent-surveys/132808
    ● Sample : https://github.com/johtani/apm-beats-kubernetes-demo
    ● Twitter : @johtani

    View full-size slide