Slide 1

Slide 1 text

4QSJOH0OF1MBUGPSNใࠂձ
 %JTUSJCVUFE5SBDJOHVTJOH
 4MFVUIBOE;JQLJO Acroquest Technology Co., LTD.
 Shin Tanimoto (@cero_t)

Slide 2

Slide 2 text

Copyright © Acroquest Technology Co., Ltd. All rights reserved. @cero_t #jsug sli.do #4923 8IPBN* • ୩ຊ ৺ (Shin Tanimoto) • Acroquest Technologyגࣜձࣾ • ೔ຊJavaϢʔβάϧʔϓ (JJUG) • JavaOneεϐʔΧʔ • Microservices, Elasticsearch • twitter: @cero_t • facebook: shin.tanimoto 2

Slide 3

Slide 3 text

@cero_t #jsug sli.do #4923 Copyright © Acroquest Technology Co., Ltd. All rights reserved. ࣭໰ͳͲ ࣭໰͸ɺTwitter / slido Ͱ΋ड͚෇͚·͢ • Twitter : @cero_t or #jsug • http://sli.do/ : event code #4923 3

Slide 4

Slide 4 text

Copyright © Acroquest Technology Co., Ltd. All rights reserved. @cero_t #jsug sli.do #4923 4 ·࣭ͣ໰

Slide 5

Slide 5 text

Copyright © Acroquest Technology Co., Ltd. All rights reserved. @cero_t #jsug sli.do #4923 5 ΨνʹϚΠΫϩαʔϏεͰ
 ։ൃɺӡ༻Λ͍ͯ͠Δਓʁ

Slide 6

Slide 6 text

Copyright © Acroquest Technology Co., Ltd. All rights reserved. @cero_t #jsug sli.do #4923 6 ϚΠΫϩαʔϏεͰͳ͘ͱ΋
 )551ɺ+.4ɺ".21ɺ,BGLB
 ͳͲͰෳ਺ͷαʔϏεΛ
 ௨৴ͤͯ͞γεςϜΛ૊ΜͰΔਓʁ

Slide 7

Slide 7 text

Copyright © Acroquest Technology Co., Ltd. All rights reserved. @cero_t #jsug sli.do #4923 7 গͳ͘ͱ΋͍͔ͭ͸ ͦ͏͍͏γεςϜΛ૊Ήඞཁ͕ ͋ΔͩΖ͏ͳͱࢥ͏ਓʁ

Slide 8

Slide 8 text

Copyright © Acroquest Technology Co., Ltd. All rights reserved. @cero_t #jsug sli.do #4923 8 ͍·खΛڍ͛ͳ͔ͬͨਓ͸
 Կ͠ʹདྷͨʂ

Slide 9

Slide 9 text

Copyright © Acroquest Technology Co., Ltd. All rights reserved. @cero_t #jsug sli.do #4923 9 ౖͬͯͳ͍Α☺

Slide 10

Slide 10 text

Copyright © Acroquest Technology Co., Ltd. All rights reserved. @cero_t #jsug sli.do #4923 10 ෼ࢄγεςϜΛ૊Ήͱ͖ʹ
 ඞͣ௚໘͢Δ໰୊ͷ࿩

Slide 11

Slide 11 text

Copyright © Acroquest Technology Co., Ltd. All rights reserved. @cero_t #jsug sli.do #4923 11 Ͳ͜Ͱ໰୊͕ى͖ͨͷ͔ʁ
 Ͳ͕͜ϘτϧωοΫͳͷ͔ʁ

Slide 12

Slide 12 text

Copyright © Acroquest Technology Co., Ltd. All rights reserved. @cero_t #jsug sli.do #4923 12 Service architecture isn’t this simple anymore Single-server scenarios aren’t realistic or don’t fully explain latency. David Vignoni Gnome-fs-server.svg

Slide 13

Slide 13 text

Copyright © Acroquest Technology Co., Ltd. All rights reserved. @cero_t #jsug sli.do #4923 13 Can we make troubleshooting wizard-free? We no longer need wizards to deploy complex architectures. We shouldn’t need wizards to troubleshoot them, either!

Slide 14

Slide 14 text

Copyright © Acroquest Technology Co., Ltd. All rights reserved. @cero_t #jsug sli.do #4923 14 © 2016 Pivotal !1 An introduction to Distributed Tracing and Zipkin Adrian Cole, Pivotal @adrianfcole How to Properly Blame Things for Causing Latency

Slide 15

Slide 15 text

Copyright © Acroquest Technology Co., Ltd. All rights reserved. @cero_t #jsug sli.do #4923 15 Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Implementing Microservices Tracing with Spring Cloud and Zipkin By Reshmi Krishna @reshmi9k By Marcin Grzejszczak @mgrzejszczak

Slide 16

Slide 16 text

Copyright © Acroquest Technology Co., Ltd. All rights reserved. @cero_t #jsug sli.do #4923 5BCMFPGDPOUFOUT 1. ໰୊ൃੜՕॴΛϩά͔Βௐ΂Δ 2. αʔϏεͷߏ଄ΛՄࢹԽ͢Δ 3. SleuthͱZipkinͷ࢝Ίํ 16

Slide 17

Slide 17 text

Copyright © Acroquest Technology Co., Ltd. All rights reserved. @cero_t #jsug sli.do #4923 ໰୊ൃੜՕॴΛϩά͔Βௐ΂Δ #1 17

Slide 18

Slide 18 text

Copyright © Acroquest Technology Co., Ltd. All rights reserved. @cero_t #jsug sli.do #4923 18 Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ It doesn’t look like this

Slide 19

Slide 19 text

Copyright © Acroquest Technology Co., Ltd. All rights reserved. @cero_t #jsug sli.do #4923 19 Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ More like this

Slide 20

Slide 20 text

Copyright © Acroquest Technology Co., Ltd. All rights reserved. @cero_t #jsug sli.do #4923 20 Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ More like this

Slide 21

Slide 21 text

Copyright © Acroquest Technology Co., Ltd. All rights reserved. @cero_t #jsug sli.do #4923 21 ϩά͸શ෦&MBTUJDTFBSDIʹ
 Ϳͬ͜ΜͰ͍ͨͱͯ͠
 Ͳ͏΍ͬͯ໰୊ՕॴΛ୳͢ʁ ໰୊ൃੜՕॴΛϩά͔Βௐ΂Δ

Slide 22

Slide 22 text

Copyright © Acroquest Technology Co., Ltd. All rights reserved. @cero_t #jsug sli.do #4923 22 ʮ͜ͷ͔࣌ؒΒ͜ͷ࣌ؒͷϩάʯ Λβʔοͱݕࡧ͢Δʁ ໰୊ൃੜՕॴΛϩά͔Βௐ΂Δ

Slide 23

Slide 23 text

Copyright © Acroquest Technology Co., Ltd. All rights reserved. @cero_t #jsug sli.do #4923 23 ͨ͘͞ΜΤϥʔ͕ى͖ͯͨΒ
 Ͳ͏͢Μͷʁ ໰୊ൃੜՕॴΛϩά͔Βௐ΂Δ

Slide 24

Slide 24 text

Copyright © Acroquest Technology Co., Ltd. All rights reserved. @cero_t #jsug sli.do #4923 24 ϦΫΤετʹରͯ͠*%Λൃߦ͠
 ͦΕΛڞ༗͢Ε͹ྑ͘Ͷʁ ໰୊ൃੜՕॴΛϩά͔Βௐ΂Δ

Slide 25

Slide 25 text

Copyright © Acroquest Technology Co., Ltd. All rights reserved. @cero_t #jsug sli.do #4923 25 4QSJOH$MPVE4MFVUI ໰୊ൃੜՕॴΛϩά͔Βௐ΂Δ

Slide 26

Slide 26 text

Copyright © Acroquest Technology Co., Ltd. All rights reserved. @cero_t #jsug sli.do #4923 26 Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ org.springframework.cloud spring-cloud-dependencies Brixton.SR4 pom import org.springframework.cloud spring-cloud-starter-sleuth Spring Cloud Sleuth with Maven

Slide 27

Slide 27 text

Copyright © Acroquest Technology Co., Ltd. All rights reserved. @cero_t #jsug sli.do #4923 27 ϦΫΤετશମ5SBDF ݸผϦΫΤετ4QBO ໰୊ൃੜՕॴΛϩά͔Βௐ΂Δ

Slide 28

Slide 28 text

Copyright © Acroquest Technology Co., Ltd. All rights reserved. @cero_t #jsug sli.do #4923 28 )551".21ϔομʹ*%ΛຒΊΔ
 ड͚औͬͯ5ISFBE-PDBMʹೖΕΔ
 ࣍ʹ౉͢ɾɾɾͷ܁Γฦ͠ ໰୊ൃੜՕॴΛϩά͔Βௐ΂Δ

Slide 29

Slide 29 text

Copyright © Acroquest Technology Co., Ltd. All rights reserved. @cero_t #jsug sli.do #4923 29 Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/

Slide 30

Slide 30 text

Copyright © Acroquest Technology Co., Ltd. All rights reserved. @cero_t #jsug sli.do #4923 30 Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/

Slide 31

Slide 31 text

Copyright © Acroquest Technology Co., Ltd. All rights reserved. @cero_t #jsug sli.do #4923 31 ϦΫΤετͷ*%ΛΩʔʹͯ͠
 ෳ਺αʔόͷϩάΛݕࡧͰ͖Δ ໰୊ൃੜՕॴΛϩά͔Βௐ΂Δ

Slide 32

Slide 32 text

Copyright © Acroquest Technology Co., Ltd. All rights reserved. @cero_t #jsug sli.do #4923 32 ͳΔ΄Ͳ

Slide 33

Slide 33 text

Copyright © Acroquest Technology Co., Ltd. All rights reserved. @cero_t #jsug sli.do #4923 33 ͦΕΛ࢖ͬͯ
 ՄࢹԽͰ͖ΔͷͰ͸ʁ

Slide 34

Slide 34 text

Copyright © Acroquest Technology Co., Ltd. All rights reserved. @cero_t #jsug sli.do #4923 αʔϏεͷߏ଄ΛՄࢹԽ͢Δ #2 34

Slide 35

Slide 35 text

Copyright © Acroquest Technology Co., Ltd. All rights reserved. @cero_t #jsug sli.do #4923 35 4MFVUIͰूΊͨ৘ใΛ࢖ͬͯ
 ஗͍ͱ͜ΖΛ୳ͨ͠Γ
 αʔϏεͷؔ࿈Λݟ͍ͨ αʔϏεͷߏ଄ΛՄࢹԽ͢Δ

Slide 36

Slide 36 text

Copyright © Acroquest Technology Co., Ltd. All rights reserved. @cero_t #jsug sli.do #4923 36 Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ The answer is: ZIPKIN

Slide 37

Slide 37 text

Copyright © Acroquest Technology Co., Ltd. All rights reserved. @cero_t #jsug sli.do #4923 37 Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ SPANS SENT TO COLLECTORS SPANS SENT TO COLLECTORS STORE IN DB APP APP UI QUERIES FOR TRACE INFO VIA API How does Zipkin work?

Slide 38

Slide 38 text

Copyright © Acroquest Technology Co., Ltd. All rights reserved. @cero_t #jsug sli.do #4923 38 Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Spring Cloud Sleuth Zipkin with Maven org.springframework.cloud spring-cloud-dependencies Brixton.SR4 pom import org.springframework.cloud spring-cloud-starter-zipkin

Slide 39

Slide 39 text

Copyright © Acroquest Technology Co., Ltd. All rights reserved. @cero_t #jsug sli.do #4923 39 %FNP αʔϏεͷߏ଄ΛՄࢹԽ͢Δ

Slide 40

Slide 40 text

Copyright © Acroquest Technology Co., Ltd. All rights reserved. @cero_t #jsug sli.do #4923 SleuthͱZipkinͷ࢝Ίํ #3 40

Slide 41

Slide 41 text

-FUT7JTVBMJ[F:PVS
 4QSJOH#PPU"QQMJDBUJPOT Acroquest Technology Co., LTD.
 Shin Tanimoto (@cero_t)

Slide 42

Slide 42 text

Copyright © Acroquest Technology Co., Ltd. All rights reserved. @cero_t #jsug sli.do #4923 42 4MFVUIͱ;JQLJOͷ࢝Ίํ • JavaOneʹ͸Α͘ࢀՃ͢ΔΜ͚ͩͲ
 ΞδΣϯμΛݟͯΔͱ໌Β͔ʹ
 SpringOneͷ΄͏ָ͕ͦ͠͏ɻ
 • ͦ͏ͩCfPΛग़ͦ͏ɻ • ͋ɺड͔ͬͨɻ΍͹͍ɻ

Slide 43

Slide 43 text

Copyright © Acroquest Technology Co., Ltd. All rights reserved. @cero_t #jsug sli.do #4923 4MFVUIͱ;JQLJOͷ࢝Ίํ • How to do? (1) Spring InitializrͰ “sleuth” and “zipkin” Λ୳͢
 https://start.spring.io/
 (2) ϚΠΫϩαʔϏεʹsleuthͷdependenciesΛ௥Ճ
 (3) zipkinͷdependenciesΛ࢖ͬͯZipkinαʔόΛ࡞Δ 43

Slide 44

Slide 44 text

Copyright © Acroquest Technology Co., Ltd. All rights reserved. @cero_t #jsug sli.do #4923 4MFVUIͱ;JQLJOͷ࢝Ίํ 44

Slide 45

Slide 45 text

Copyright © Acroquest Technology Co., Ltd. All rights reserved. @cero_t #jsug sli.do #4923 4MFVUIͱ;JQLJOͷ࢝Ίํ 45

Slide 46

Slide 46 text

Copyright © Acroquest Technology Co., Ltd. All rights reserved. @cero_t #jsug sli.do #4923 4MFVUIͱ;JQLJOͷ࢝Ίํ Sleuth and Zipkin dependencies 46 Name on Initializr artifactId Sleuth spring-cloud-starter-sleuth Sleuth Stream spring-cloud-sleuth-stream Zipkin Client spring-cloud-starter-zipkin Zipkin Stream spring-cloud-sleuth-zipkin-stream Zipkin UI spring-boot-starter
 zipkin-autoconfigure-ui Zipkin Server spring-boot-starter
 zipkin-server

Slide 47

Slide 47 text

Copyright © Acroquest Technology Co., Ltd. All rights reserved. @cero_t #jsug sli.do #4923 4MFVUIͱ;JQLJOͷ࢝Ίํ 47 Microservice Microservice Zipkin Server HTTP Zipkin UI Server To start simply:

Slide 48

Slide 48 text

Copyright © Acroquest Technology Co., Ltd. All rights reserved. @cero_t #jsug sli.do #4923 4MFVUIͱ;JQLJOͷ࢝Ίํ To start simply: 48 Microservice Microservice Zipkin Server HTTP Zipkin UI Server Zipkin Client 
 (spring-cloud-starter-zipkin) Zipkin UI (zipkin-autoconfigure-ui)
 Zipkin Server (zipkin-server)

Slide 49

Slide 49 text

Copyright © Acroquest Technology Co., Ltd. All rights reserved. @cero_t #jsug sli.do #4923 4MFVUIͱ;JQLJOͷ࢝Ίํ 49 Microservice AMQP Zipkin UI Server
 Zipkin Server RabbitMQ AMQP To use RabbitMQ as a middle buffer:

Slide 50

Slide 50 text

Copyright © Acroquest Technology Co., Ltd. All rights reserved. @cero_t #jsug sli.do #4923 4MFVUIͱ;JQLJOͷ࢝Ίํ 50 Microservice AMQP Zipkin UI Server
 Zipkin Server RabbitMQ AMQP Zipkin UI
 (zipkin-autoconfigure-ui)
 Zipkin Stream
 (spring-cloud-sleuth-zipkin-stream)
 Stream Rabbit
 (spring-cloud-starter-stream-rabbit) Sleuth Stream
 (spring-cloud-sleuth-stream)
 Stream Rabbit
 (spring-cloud-starter-stream-rabbit) To use RabbitMQ as a middle buffer:

Slide 51

Slide 51 text

Copyright © Acroquest Technology Co., Ltd. All rights reserved. @cero_t #jsug sli.do #4923 4MFVUIͱ;JQLJOͷ࢝Ίํ 51 Microservice AMQP Zipkin UI Server
 Zipkin Server RabbitMQ AMQP Zipkin UI
 (zipkin-autoconfigure-ui)
 Zipkin Stream
 (spring-cloud-sleuth-zipkin-stream)
 
 spring-cloud-stream-binder-rabbit Sleuth Stream
 (spring-cloud-sleuth-stream)
 
 spring-cloud-stream-binder-rabbit To use RabbitMQ as a middle buffer:

Slide 52

Slide 52 text

Copyright © Acroquest Technology Co., Ltd. All rights reserved. @cero_t #jsug sli.do #4923 4MFVUIͱ;JQLJOͷ࢝Ίํ 52 Microservice AMQP Zipkin UI Server
 Zipkin Server RabbitMQ AMQP The exchange and the queue are created and bound automatically. Exchange:
 sleuth Queue:
 sleuth.sleuth

Slide 53

Slide 53 text

Copyright © Acroquest Technology Co., Ltd. All rights reserved. @cero_t #jsug sli.do #4923 4MFVUIͱ;JQLJOͷ࢝Ίํ Sleuth and Zipkin dependencies 53 Name on Initializr artifactId Log HTTP AMQP Sleuth spring-cloud-starter-sleuth Service Sleuth Stream spring-cloud-sleuth-stream Service Zipkin Client spring-cloud-starter-zipkin Service Zipkin Stream spring-cloud-sleuth-zipkin-stream Zipkin Zipkin UI spring-boot-starter
 zipkin-autoconfigure-ui Zipkin Zipkin Zipkin Server spring-boot-starter
 zipkin-server Zipkin Stream Rabbit spring-cloud-starter-stream-rabbit Both

Slide 54

Slide 54 text

Copyright © Acroquest Technology Co., Ltd. All rights reserved. @cero_t #jsug sli.do #4923 4MFVUIͱ;JQLJOͷ࢝Ίํ 54 Zipkin server application (HTTP): @SpringBootApplication @EnableZipkinServer public class ZipkinApplication { public static void main(String[] args) { SpringApplication.run(ZipkinApplication.class, args); } }

Slide 55

Slide 55 text

Copyright © Acroquest Technology Co., Ltd. All rights reserved. @cero_t #jsug sli.do #4923 4MFVUIͱ;JQLJOͷ࢝Ίํ 55 Zipkin server application (Stream): @SpringBootApplication @EnableZipkinStreamServer public class ZipkinApplication { public static void main(String[] args) { SpringApplication.run(ZipkinApplication.class, args); } }

Slide 56

Slide 56 text

Copyright © Acroquest Technology Co., Ltd. All rights reserved. @cero_t #jsug sli.do #4923 4MFVUIͱ;JQLJOͷ࢝Ίํ 56 No source code modification in microservices!

Slide 57

Slide 57 text

Copyright © Acroquest Technology Co., Ltd. All rights reserved. @cero_t #jsug sli.do #4923 4MFVUIͱ;JQLJOͷ࢝Ίํ • Note (1) Spring Cloud Sleuth͸
 RabbitTemplateΛαϙʔτ͍ͯ͠ͳ͍
 (spring-boot-starter-amqp).
 (2) Stream Rabbit͸αϙʔτ͞Ε͍ͯΔ
 (spring-cloud-starter-stream-rabbit). 57

Slide 58

Slide 58 text

Copyright © Acroquest Technology Co., Ltd. All rights reserved. @cero_t #jsug sli.do #4923 58 ͳΜ͍ͯ͏εϥΠυΛ४උͯͨ͠લ೔ #ZUIFXBZ

Slide 59

Slide 59 text

Copyright © Acroquest Technology Co., Ltd. All rights reserved. @cero_t #jsug sli.do #4923 59 5IF/FUqJY5FDI#MPH7J[DFSBM0QFO4PVSDF IUUQUFDICMPHOFUqJYDPNWJ[DFSBM PQFOTPVSDFIUNM #ZUIFXBZ

Slide 60

Slide 60 text

Copyright © Acroquest Technology Co., Ltd. All rights reserved. @cero_t #jsug sli.do #4923 60 Infrastructures Evolution -FUTIBWFGVOWJTVBMJ[BUJPOZPVSNJDSPTFSWJDFT

Slide 61

Slide 61 text

Copyright © Acroquest Technology Co., Ltd. All rights reserved. @cero_t #jsug sli.do #4923 8SBQVQ • Sample code: https://github.com/cero-t/e-commerce-example • Clip arts: http://www.irasutoya.com/ 61