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/

657aeeff3fc467567dacebf8a1ea0b23?s=128

Jun Ohtani

July 25, 2018
Tweet

Transcript

  1. !1 Jun Ohtani Community Engineer @Elastic
 Twitter: @johtani Elastic StackͰ࢝ΊΔJavaΞϓϦͷ

    ύϑΥʔϚϯε؂ࢹ
  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
  3. !3 ΞδΣϯμ • Elastic Stackͱ͸ʁ • Elastic APMͱ͸ʁ • Elastic

    APM Java Agentͷ࢖͍ํ
  4. !4 Elastic Stack

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

  6. !6

  7. 7 Beats ܰྔσʔλγούʔ ιʔε͔ΒσʔλΛసૹ సૹ͠Elasticsearchʹू໿ ม׵ͱύʔεͷͨΊ Logstashʹసૹ Elastic Cloudʹసૹ Libbeat:

    ΧελϜbeatsͷͨ ΊͷAPIϑϨʔϜϫʔΫ 30Ҏ্ͷίϛϡχςΟbeats
  8. The Beats family Heartbeat Uptime monitoring Filebeat Log files Winlogbeat

    Windows Event Logs Packetbeat Network data +40 community Beats Metricbeat Metrics Auditbeat Audit data
  9. !9

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


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

  12. 12 Elasticsearch Heart of the Elastic Stack ෼ࢄܕɺεέʔϥϒϧ ߴՄ༻ੑ Ϛϧνςφϯτ

    ։ൃऀϑϨϯυϦʔ ϦΞϧλΠϜɺશจݕࡧ ΞάϦήʔγϣϯ
  13. !13

  14. 14 Kibana Window into the Elastic Stack ՄࢹԽͱ෼ੳ ஍ཧۭؒ ΧελϚΠζͱ

    Ϩϙʔτͷڞ༗ άϥϑ୳ࡧ Elastic Stack΁ͷ ηΩϡΞͳΞΫηεͱ؅ཧ ΧελϜAppsͷ࡞੒
  15. !15

  16. !16 Elastic APM

  17. !17 Full-stack monitoring with Elastic APM adds end-user experience and

    application-level monitoring to the stack
  18. APM Architecture APM data is just another Index

  19. !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
  20. !20 Java agent is now in beta!

  21. !21 Download the agent • Download jar from Maven Central

    • Don't declare a dependency
  22. !22 Start application with Java agent enabled java -javaagent:/path/to/elastic-apm-agent-<version>.jar \

    -Delastic.apm.service_name=my-application \ -Delastic.apm.server_url=http://localhost:8200 \ -jar my-spring-boot-application.jar
  23. !23 Demo!

  24. Deployment: nginx 
 Pod Deployment: app 
 Pod Deployment:
 mysql

    
 Pod Service: nginx
 
 LoadBalancer Metrics Network Analytics Logs Application Performance Monitoring
  25. !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
  26. !26

  27. !27

  28. !28

  29. How does it work? !29

  30. !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
  31. !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
  32. Future? !32

  33. !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
  34. !34 bit.ly/EnqEsMeetup

  35. 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