<?xml version="1.0" encoding="utf-8"?><html xml:lang="ja" xmlns="http://www.w3.org/1999/html" xmlns:epub="http://www.idpf.org/2007/opf">
    <head>
        <meta name="viewport" content="target-densitydpi=device-dpi, width=device-width, maximum-scale=1.0, user-scalable=yes" />
<meta charset="UTF-8"/>
        
        <meta content="book3" name="CAS-UB-Publication-Class"/>
        <meta content="CAS-UB Backend System Installed on 2013-11-27" name="Generator-Signature"/>
        <title>知識の森　マイクロサービスと分散トレーシング</title>
        <link href="themes/cas-common_epub.css" rel="stylesheet" type="text/css"/>
        <link href="themes/plain2/common.css" rel="stylesheet" type="text/css"/>
        <link href="styles/style.css" rel="stylesheet" type="text/css"/>
<script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');

  ga('create', 'UA-88485500-1', 'auto');
  ga('send', 'pageview');

</script>
        </head>
    <body style="-webkit-text-size-adjust: 100%;" class="wrapper chapter level2" id="e_2e0000_2e_E7_9F_A5_E8_AD_98_E3_81_AE_E6_A3_AE_E3_80_80_E3_83_9E_E3_82_A4_E3_82_AF_E3_83_AD_E3_82_B5_E3_83_BC_E3_83_93_E3_82_B9_E3_81_A8_E5_88_86_E6_95_A3_E3_83_88_E3_83_AC_E3_83_BC_E3_82_B7_E3_83_B3_E3_82_B0"><h1 class="sys-hidden" style="display:none">知識の森　マイクロサービスと分散トレーシング</h1>
<div class="header">
<table class="header-in" align="center" valign="middle">
<tr>
<td class="left-table">
<a class="" href="https://www.ieice.org/jpn/"><img class="ieice-logo" src="../../img/logo.png" /></a>
</td>
<td class="right-table" align="center">
<a href="../../index.html" class="top_link" align="center"><b align="center">電子情報通信学会 - IEICE会誌 試し読みサイト</b></a>
<div class="copyright">© Copyright IEICE. All rights reserved.</div>
</td>
</tr>
</table></div>
<div class="header-border"></div>
<div class="contents">
<div class="contents-in">
<form name="number_post" method="POST" action="../../index.php">
<input type="hidden" name="index-page" value="108_7" />
</form>
<a href="javascript:document.number_post.submit()" class="index-number-link" style="float: right;">Vol.108 No.7 (2025/7)　目次へ</a><br /><br />
<div class="article-navigation"><a href="../k108_7_689/index.html" style="float: left;">前の記事へ</a><a href="../k108_7_694/index.html" style="float: right;">次の記事へ</a></div><br /><br />


<p class="lft margin-bottom-4em"><img alt="知識の森" src="images/fig_4.png" style="width: 8em"/></p>
<p class="right left7em"><strong class="en">情報通信マネジメント研究<span class="gext not-separates">専門委員会</span></strong></p>
<p class="title-ja lft"><strong>マイクロサービスと分散トレーシング</strong></p>
<p class="title_author left4em">酒井　優，<span class="gext not-separates">高橋謙輔</span><span class="gext not-separates">（NTT株式会社）</span></p>
<div class="gext author_detail"><p>本会ハンドブック「知識の森」
<a class="wrap" href="https://www.ieice-hbkb.org/portal/doc_index.html">https://www.ieice-hbkb.org/portal/doc_index.html</a></p>
</div>
<div class="wrapper level3" id="h_2e0000_2e1_EF_BC_8E_E3_83_9E_E3_82_A4_E3_82_AF_E3_83_AD_E3_82_B5_E3_83_BC_E3_83_93_E3_82_B9_E3_81_A8_E3_81_AF"><h1>1．マイクロサービスとは</h1>
<p>　マイクロサービスとは，単一の大規模なアプリケーション（モノリス）を，独立して開発・デプロイ・スケーリング可能な小さなサービス群に分割するソフトウェアアーキテクチャの手法である<a href="#u_2e0000_2eref01"><sup>(1)</sup></a>．<a href="index.html#u_2e0000_2efig-1">図1</a>では，従来のモノリシックアーキテクチャとマイクロサービスアーキテクチャの例を示している．マイクロサービスは，各サービスが特定のビジネス機能に特化し，明確に定義されたAPIを通じて他のサービスと通信するという特徴を持っている．</p>
<div id="u_2e0000_2efig-1"><div class="gext fig" id="fig_1"><p><img alt="図1　モノリシックアーキテクチャとマイクロサービスアーキテクチャ" src="images/fig_1.png"/></p>
</div>
</div>
<p>　このアーキテクチャが注目を集めた背景には，2000年代後半からのクラウドコンピューティングの普及と，アジャイル開発の浸透がある．特に，NetflixやAmazonといった大規模Webサービスが採用し，その知見を共有したことで広く認知されるようになった．</p>
<p>　マイクロサービスの主なメリットとして以下が挙げられる．</p>
<p class="line-gap"> </p>
<p class="left1em li-2em0"><span class="gext width2em">1．</span>開発の独立性：各チームが独自のサービスを担当し，他チームの影響を受けずに開発可能</p>
<p class="left1em li-2em0"><span class="gext width2em">2．</span>技術の柔軟性：サービスごとに最適な技術スタックを選択可能</p>
<p class="left1em li-2em0"><span class="gext width2em">3．</span>スケーラビリティ：必要なサービスのみを個別にスケールアウト可能</p>
<p class="left1em li-2em0"><span class="gext width2em">4．</span>障害の局所化：一部のサービスの障害が全体に波及することを防止</p>
<p class="line-gap"> </p>
<p>　マイクロサービスは多くのメリットをもたらすが，サービス数が多くなると，サービス間の連携や管理が複雑になることや，サービス間通信が増えることによるネットワーク負荷の上昇といった課題が存在する．適切な設計と運用を行うことで，システムの柔軟性，拡張性，可用性を高めることができるアーキテクチャではあるが，導入にあたっては，適切な対策を講じることが重要となる．特に，多数のサービスを監視・運用するためには，各サービスの状態を把握するための可観測性の向上が重要となる．以降では，可観測性を向上するための技術の一つである分散トレーシングについて解説する．</p>
</div>
<div class="wrapper level3" id="h_2e0000_2e2_EF_BC_8E_E5_88_86_E6_95_A3_E3_83_88_E3_83_AC_E3_83_BC_E3_82_B7_E3_83_B3_E3_82_B0_E3_81_A8_E3_81_AF"><h1>2．分散トレーシングとは</h1>
<p>　マイクロサービスにおけるトレースとは，サービスへの単一の要求とそれを処理するための全体的なパスを意味する<a href="#u_2e0000_2eref02"><sup>(2)</sup></a>．分散トレーシングは，サービスへの単一の要求ごとに発生する処理を追跡し，様々なコンポーネントでの処理履歴をひも付け，一つのパスとして監視できるようにすることで可観測性を向上させる技術である<a href="#u_2e0000_2eref03"><sup>(3)</sup></a>．</p>
<div class="wrapper level4" id="h_2e0000_2e2_2e1_E3_80_80_E5_88_86_E6_95_A3_E3_83_88_E3_83_AC_E3_83_BC_E3_82_B7_E3_83_B3_E3_82_B0_E3_81_AE_E3_83_87_E3_83_BC_E3_82_BF_E3_83_A2_E3_83_87_E3_83_AB"><h2>2.1　分散トレーシングのデータモデル</h2>
<p>　分散トレーシングの概念はGoogleの分散トレーシング基盤であるDapperについて公表された文献で広く知られるようになった<a href="#u_2e0000_2eref04"><sup>(4)</sup></a>．これに基づいて，Opentracingプロジェクト<a href="#u_2e0000_2eref05"><sup>(5)</sup></a>は，分散トレースのための言語中立なデータモデルを提供している．</p>
<p>　<a href="index.html#u_2e0000_2efig-2">図2</a>はOpentracingにおけるトレースとスパンのイメージを示している．</p>
<div id="u_2e0000_2efig-2"><div class="gext fig" id="fig_2"><p><img alt="図2　トレースのイメージ" src="images/fig_2.png"/></p>
</div>
</div>
<p>　スパンの実行履歴であるスパンログは，操作名，開始タイムスタンプ，終了タイムスタンプ，スパンコンテキスト，他のスパンへの参照，任意のデータ，を持つ構造体である．スパンコンテキストは自身のスパンID，トレースIDを持つ構造体である．自身のスパンIDは，スパンログとして記録される処理を開始する際に生成する一意のIDであり，トレースIDはマイクロサービスへリクエストが到着して最初に処理を開始する際に生成するトランザクション全体を識別するための一意のIDである．他のスパンへの参照は，そのスパンの呼び出し元（親）のスパンIDである．各スパンは，別のスパンの呼出しの際にトレースIDと自身のスパンIDを受け渡す．スパン間でトレースIDが伝搬され記録されることで，別個に収集されたスパンログを後からひも付けることができる．</p>
</div>
<div class="wrapper level4" id="h_2e0000_2e2_2e2_E3_80_80_E5_88_86_E6_95_A3_E3_83_88_E3_83_AC_E3_83_BC_E3_82_B7_E3_83_B3_E3_82_B0_E3_81_AE_E4_BB_95_E7_B5_84_E3_81_BF"><h2>2.2　分散トレーシングの仕組み</h2>
<p>　分散トレーシングは様々な実装が存在するが，その大まかな流れは共通しており<a href="#u_2e0000_2eref06"><sup>(6)</sup></a>，<a href="index.html#u_2e0000_2efig-3">図3</a>は，分散トレーシングがLogging, Collection, Preprocessing, Storage, Analysisの五つの処理によって実現されている様子を示している．</p>
<div id="u_2e0000_2efig-3"><div class="gext fig" id="fig_3"><p><img alt="図3　分散トレーシングの流れ" src="images/fig_3.png"/></p>
</div>
</div>
<p>　Loggingはマイクロサービスの各サービスインスタンス内で実施される．スパンの処理名や，処理開始，終了のタイムスタンプに加え，自身のスパンIDや親スパンのID，トレースIDを記録し，スパンログを生成する．</p>
<p>　Collectionは各サービスインスタンスに配置されたエージェントを経由してLoggingで記録されたスパンログをマネージャに集める処理である．</p>
<p>　PreprocessingはCollectionによって各サービスインスタンスから収集されたスパンログの前処理であるトレースID，親のスパンIDを参照しスパンログをひも付け，エンドユーザからリクエストを受けてレスポンスを返すまでのトランザクション全体を表すスパンのツリー（すなわちトレース）を構成する．</p>
<p>　StorageはPreprocessingで構成されたトレースをデータベースに保管する処理である．</p>
<p>　AnalysisはStorageで蓄積されたトレースを利用して行われる様々な分析処理である．例としては，同一のリクエストパスを持つトレース同士を比較し異常のあるスパンを発見するトレース差分分析や，サービス間の呼出しの回数をカウントしサービス間の依存関係を示す有向グラフを作成するサービス依存性分析などが挙げられる．</p>
</div>
</div>
<div class="wrapper level3" id="h_2e0000_2e3_EF_BC_8E_E5_88_86_E6_95_A3_E3_83_88_E3_83_AC_E3_83_BC_E3_82_B7_E3_83_B3_E3_82_B0_E3_81_AE_E5_8B_95_E5_90_91"><h1>3．分散トレーシングの動向</h1>
<p>　本章では，分散トレーシングの研究開発動向を説明する．</p>
<p>　文献<a href="#u_2e0000_2eref06">（6）</a>によれば，大規模なマイクロサービスの場合は，そのマイクロサービスのために社内独自の分散トレーシングのシステムを開発して運用する場合が多く，中小規模なマイクロサービスの場合は他社，若しくはオープンソースの分散トレーシングシステムを導入する場合が多い．</p>
<p>　近年，分散トレーシングの機能を持つソフトウェアやサービスは増加してきており，Jaeger<a href="#u_2e0000_2eref07"><sup>(7)</sup></a>，AWS : X-ray<a href="#u_2e0000_2eref08"><sup>(8)</sup></a>，Alibaba : ARMS<a href="#u_2e0000_2eref09"><sup>(9)</sup></a>，Dynatrace<a href="#u_2e0000_2eref10"><sup>(10)</sup></a>，Splunk<a href="#u_2e0000_2eref11"><sup>(11)</sup></a>，Apache Skywalking<a href="#u_2e0000_2eref12"><sup>(12)</sup></a>，Zipkin<a href="#u_2e0000_2eref13"><sup>(13)</sup></a>などが存在する．このような既存実装を利用することにより，分散トレーシングの導入が容易になる．</p>
<p>　文献<a href="#u_2e0000_2eref06">（6）</a>では，トレースデータの分析手法の高度化は発展途上にあると述べている．トレースデータの分析については，異常検知や根本原因特定を目的として様々な研究が行われている．</p>
<p>　文献<a href="#u_2e0000_2eref14">（14）</a>は，ベイジアンネットワークを利用してトレースデータに対して定期的にオフライントレーニングを行うことで，学習したパターンから逸脱するトレースを発見する手法を提案している．文献<a href="#u_2e0000_2eref15">（15）</a>は，平均値と標準偏差に基づく外れ値検出によってレイテンシの大きいトレースを検出した後，PageRankとスペクトル分析を活用してレイテンシの原因となるサービスを絞り込む手法を提案している．文献<a href="#u_2e0000_2eref16">（16）</a>は，マイクロサービスにおけるコンセプトドリフトを課題とし，トレースデータに対しデータストリームクラスタリングを用いた異常箇所特定手法を提案している．</p>
</div>
<div class="wrapper level3" id="h_2e0000_2e4_EF_BC_8E_E3_81_BE_E3_81_A8_E3_82_81"><h1>4．まとめ</h1>
<p>　マイクロサービスはアプリケーション開発において多くのメリットをもたらすが，規模が大きくなると可観測性の確保が従来のアーキテクチャより難しくなるというデメリットがある．分散トレーシングは，マイクロサービスの可観測性の確保のために欠かせない技術で現在まで様々な検討がなされてきており，今後も更なる発展が期待される．</p>
</div>
<div class="wrapper level3" id="h_2e0000_2e_E6_96_87_E3_80_80_E3_80_80_E3_80_80_E3_80_80_E3_80_80_E7_8C_AE"><h1>文　　　　　献</h1>
<div class="gext references"><p class="li" id="u_2e0000_2eref01"><span class="gext listmark">(1) </span>M. Fowler, “Microservices.”<br/><a class="wrap" href="https://martinfowler.com/articles/microservices.html">https://martinfowler.com/articles/microservices.html</a> （2025年2月確認）</p>
<p class="li" id="u_2e0000_2eref02"><span class="gext listmark">(2) </span>CNCF, “Observability Whitepaper.”<br/><a class="wrap" href="https://github.com/cncf/tag-observability/blob/main/whitepaper.md">https://github.com/cncf/tag-observability/blob/main/whitepaper.md</a>（2025年2月確認）</p>
<p class="li" id="u_2e0000_2eref03"><span class="gext listmark">(3) </span>C. Richardson, “Microservices patterns : With examples in java,” Manning Publications Co., 2019.</p>
<p class="li" id="u_2e0000_2eref04"><span class="gext listmark">(4) </span>B.H. Sigelman, L.A. Barroso, M. Burrows, P. Stephenson, M. Plakal, D. Beaver, S. Jaspan, and C. Shanbhag, “Dapper a large-scale distributed systems tracing infrastructure,”2010.</p>
<p class="li" id="u_2e0000_2eref05"><span class="gext listmark">(5) </span>Opentracing. Io, “Opentracing.”<br/><a class="wrap" href="https://opentracing.io/.">https://opentracing.io/.</a> （2025年2月確認）</p>
<p class="li" id="u_2e0000_2eref06"><span class="gext listmark">(6) </span>B. Li, X. Peng, Q. Xiang, H. Wang, T. Xie, J. Sun, and X. Liu., “Enjoy your observability : an industrial survey of microservice tracing and analysis,” Empirical Software Engineering, pp.1-28, 2022.</p>
<p class="li" id="u_2e0000_2eref07"><span class="gext listmark">(7) </span>Jaegertracing. Io, “Jaegertracing.”<br/><a class="wrap" href="https://www.jaegertracing.io/.">https://www.jaegertracing.io/.</a> （2025年2月確認）</p>
<p class="li" id="u_2e0000_2eref08"><span class="gext listmark">(8) </span>Aws. Amazon. Com, “AWS.”<br/><a class="wrap" href="https://aws.amazon.com/xray/">https://aws.amazon.com/xray/</a> （2025年2月確認）</p>
<p class="li" id="u_2e0000_2eref09"><span class="gext listmark">(9) </span>Alibabacloud. Com, “Alibabacloud.”<br/><a class="wrap" href="https://www.alibabacloud.com/en/product/arms?_p_lc=1">https://www.alibabacloud.com/en/product/arms?_p_lc=1</a> （2025年2月確認）</p>
<p class="li" id="u_2e0000_2eref10"><span class="gext listmark">(10) </span>Dynatrace. Com, “Dynatrace.”<br/><a class="wrap" href="https://www.dynatrace.com/solutions/distributed-tracing/">https://www.dynatrace.com/solutions/distributed-tracing/</a> （2025年2月確認）</p>
<p class="li" id="u_2e0000_2eref11"><span class="gext listmark">(11) </span>Splunk. Com, “Splunk observability.”<br/><a class="wrap" href="https://www.splunk.com/">https://www.splunk.com/</a> （2025年2月確認）</p>
<p class="li" id="u_2e0000_2eref12"><span class="gext listmark">(12) </span>Skywalking. Org, “Apache Skywalking.”<br/><a class="wrap" href="https://skywalking.apache.org/">https://skywalking.apache.org/</a> （2025年2月確認）</p>
<p class="li" id="u_2e0000_2eref13"><span class="gext listmark">(13) </span>Zipkin. Io, “Zipkin.”<br/><a class="wrap" href="https://zipkin.io/">https://zipkin.io/</a> （2025年2月確認）</p>
<p class="li" id="u_2e0000_2eref14"><span class="gext listmark">(14) </span>P. Liu, H. Xu, Q. Ouyang, R. Jiao, Z. Chen, and S. Zhang, et al., “Unsupervised detection of microservice trace anomalies through service-level deep bayesian networks,” 31st IEEE Int. Symp. Software Reliability Engineering （ISSRE）, pp.48-58, 2020.</p>
<p class="li" id="u_2e0000_2eref15"><span class="gext listmark">(15) </span>G. Yu, P. Chen, H. Chen, Z. Guan, Z. Huang, and L. Jing, et al., “Microrank : End-to-end latency issue localization with extended spectrum analysis in microservice environments,” Proc. the Web Conf., pp.3087-3098, 2021.</p>
<p class="li" id="u_2e0000_2eref16"><span class="gext listmark">(16) </span>T. Zhou, et al., “TraceStream : Anomalous service localization based on trace stream clustering with online feedback,” 34th IEEE Int. Symp. Software Reliability Engineering （ISSRE）, Florence, Italy, pp.601-611, 2023.</p>
</div>
<p class="date">（2025年2月20日受付） </p>
<p> </p>
</div><div class="continue-point">
	<p style="clear: both;"> </p>
	<hr/>
<p>オープンアクセス以外の記事を読みたい方は、以下のリンクより電子情報通信学会の学会誌の購読もしくは学会に入会登録することで読めるようになります。
また、会員になると豊富な豪華特典が付いてきます。</p>
    <br />
    <p><a href="https://www.journal.ieice.org/bin/pdf_link.php?fname=k108_7_691&amp;lang=J&amp;year=2025" target="_blank">続きを読む(PDF)</a>　　　<a href="https://www.ieice.org/jpn/books/backnumber.html" target="_blank">バックナンバーを購入する</a>　　　　<a href="https://www.ieice.org/jpn/join/index.html" target="_blank">入会登録</a></p>  
    <a href="https://twitter.com/share" class="twitter-share-button" data-url="https://app.journal.ieice.org/trial/108_7/k108_7_691/index.html" data-lang="ja" data-size="large" data-hashtags="IEICE">ツイート</a>　　
    <div class="fb-share-button" data-href="https://app.journal.ieice.org/trial/108_7/k108_7_691/index.html" data-layout="button" data-size="large"></div> <div id="fb-root"></div>
    <script>
        !function(d,s,id){
            var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';
            if(!d.getElementById(id)){
                js=d.createElement(s);
                js.id=id;js.src=p+'://platform.twitter.com/widgets.js';
                fjs.parentNode.insertBefore(js,fjs);
            }
        }(document, 'script', 'twitter-wjs');
   </script> 
   <script>
       //<![CDATA[
       (function(d, s, id) {
       var js, fjs = d.getElementsByTagName(s)[0];
       if (d.getElementById(id)) return;
       js = d.createElement(s); js.id = id;
       js.src = "//connect.facebook.net/ja_JP/sdk.js#xfbml=1&version=v4.0";
       fjs.parentNode.insertBefore(js, fjs);
       }(document, 'script', 'facebook-jssdk'));
       //]]>
   </script>   <p>電子情報通信学会 - IEICE会誌はモバイルでお読みいただけます。</p>   <p><a href="https://app.journal.ieice.org/">電子情報通信学会誌 会誌アプリのお知らせ</a></p>    <p></p>    <p><b>電子情報通信学会 - IEICE会誌アプリをダウンロード</b></p>
    <p><a href="https://itunes.apple.com/jp/app/dian-zi-qing-bao-tong-xin/id957695896?mt=8"><img src="../../img/App_Store_JP.svg" style="width:165px; height:50px" /></a>　　<a href='https://play.google.com/store/apps/details?id=org.ieice.journal.app.ieice&amp;hl=ja'><img alt='Google Play で手に入れよう' src='../../img/google-play-badge_web.png' style="width:165px; height:49px" /></a></p>
        </div>
</div> 
</div> 
<div class="caution">本サイトでは会誌記事の一部を試し読み用として提供しています。</div>
</body>
</html>
