SlideShare a Scribd company logo
1 of 17
現役高校生が実装するSkip Graph with Erlang 千々和 大輝 ( @_daiki )
自己紹介 ,[object Object]
P2P を応用した分散処理 ,[object Object]
key-value store ,[object Object]
Skip Graph Erlang
Skip Graph Erlang
P2P ,[object Object]
分散ハッシュテーブルや Skip Graph など ,[object Object],[object Object]
Gnutella や Winny など
分散ハッシュテーブル(DHT) ,[object Object]
ハッシュ値を利用して探索 / 挿入する
範囲検索が不可能
Skip Graphとは? ,[object Object]
DHT とは異なり,キーはそのまま利用される ,[object Object]
-> キーによる範囲検索が可能に! ,[object Object]
Skip List
Skip Graph Erlang

More Related Content

Featured

AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 

Featured (20)

AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 

Editor's Notes

  1.  Skip Graph written in Erlangというテーマで発表させて頂きます.よろしくお願いします.
  2.  僕について知らない人がほとんどだと思いますので,少し自己紹介をしたいと思います.  僕は以前から,P2Pを応用した分散処理システムに興味を持っておりまして,P2P匿名掲示板などを作ったことがあります.最近は,クラウドコンピューティングの基盤技術として注目されているキーバリュー型データストアの実装に取り組んでいます.
  3.  今回は Erlang による Skip Graph の実装を紹介するつもりなのですが,その前に,この二つについて簡単に説明したいと思います.
  4. まず, P2P 構造化オーバーレイのひとつである SkipGraph から先に説明します.
  5.  ピュアP2Pは一般に,構造化オーバーレイと非構造化オーバーレイの二つに分類されています.  構造化オーバーレイとは,ある規則に従って構造化されたP2Pネットワークのことで,代表的なものには分散ハッシュテーブルやSkip Graphなどがあります.  対して非構造化オーバーレイは構造化オーバーレイではないP2Pネットワークを指す言葉で,初期のP2Pネットワーク,代表的なものとしてはGnutellaやWinnyのネットワークがこれにあたります.
  6.  Skip Graphの利点を理解するには,分散ハッシュテーブルについて知っておく必要があります.これはその名の通り「分散化されたハッシュテーブル」で,一般的なハッシュテーブルアルゴリズムと同じように,ハッシュ値を利用して値の探索や挿入を行います.  実行効率については申し分ないこのDHTですが,欠点の一つに,範囲検索が不可能である点が挙げられます.  これはハッシュ値の性質上仕方の無いことなのですが,この欠点を克服することができるシステムが,今から紹介するSkip Graphなのです.
  7.  スキップリストアルゴリズムが元となっているこのSkip Graphの場合,キーはハッシュ値などに変換されることなくそのまま利用されるので,範囲検索が可能になっています.  また,挿入や探索の速度は,DHTと比べて全く劣っていません.
  8.  これはスキップリストアルゴリズムの図なのですが,Skip Graphもこのような感じだと捉えていただければ結構です.  見て分かる通りルーティングが階層で分けられており,上にいくほど粒度が大きくなっているという特徴を持っています.  この特徴のおかげで,キーに特別な操作を加えないまま,DHTに劣らない速度を実現することができているのです.
  9.  一通り Skip Graph について説明したところで,次は Erlang について説明しようと思います.
  10.  Erlangとは,エリクソン社が開発した並行指向の関数型言語で,OSから独立した軽量プロセスを大量に生成することができます.  これらのプロセスは,ネットワーク先のノード上で動作しているモノとローカルで動作しているモノを区別することなく,透過的にメッセージング処理を行うことができるという特徴を持っています.  さらに,Erlangを使う上での最も大きな利点として,OTPの存在があります.
  11.  OTP,Open Telecom Platformとは,似たようなコードの簡略化を目的とする,汎用的な動作をまとめたライブラリです.煩わしい処理などはこのライブラリによってブラックボックス化されており,開発者は特に意識しなくとも,読みやすく実用性のあるシステムを実装することができます.  supervisorビヘイビアやgeneric serverビヘイビアなど,様々な目的に合わせたものが用意されているので,自分の実装したいものに最適なのを選択すれば,強力な道具となるだろうと思います.
  12.    具体的なコード例を見てみましょう. これは,クイックソートの単純な実装例です.  Erlangの最大の特徴である軽量プロセスは利用されていないものの,大体のイメージは掴めると思います.
  13.  さて,Skip GraphとErlangについての簡単な説明が終わったところで,実装の紹介に入ろうかと思います.
  14.  Erlangで実装するにあたって,OTPのひとつである,generic serverビヘイビアがとても役に立ちました.  このgeneric serverビヘイビアを利用して実装されたプログラムは,監視ツリーに追加されたサーバプロセスを生成します.これにより,プログラムのバグなどで障害が発生しても,すぐに再起動させるなどの復旧処理の実装を簡単に行えるようになります.  さらに先程説明したように,Erlangでのプロセス間通信は,たとえ分散環境であろうと透過的に行うことが可能なため,このサーバプロセスを受け渡しすることにより,メッセージング処理を用意に行うことができました.  また,generic serverを利用する際は予め決められたコールバック関数を定義するので,他の開発者が見ても人目で構造がわかるようになっています.
  15.  次にSkip Graph実装にあたって苦労した部分は,Concurrent Joinです.  まず第一に,複雑でバグが入り込みやすい,というのがあります.これは,見落としていた条件があるなどが原因であることが多いです.  第二に,不整合の発生をなるべく防ぐ必要があります.これはネットワーク負荷をできるだけ小さくするためです.これを防ぐにあたって,generic serverビヘイビアが一度に一つしか処理を行わない,つまりJoin処理中は他のJoin処理がロックされるという特徴を利用して実装を行いました.  最後にデッドロックの恐れアリ,というのも,generic serverビヘイビアのこの性質に起因するものです.これは,自ノードと他ノードを区別することで解決しましたが,まだ完全ではありません.
  16.  最後に,今後の課題をまとめてみました.  「Concurrent Joinの改良」  「あるノードがいきなり死んだ場合の対処」  「より多くのkey-valueペアの保持を可能に」  「C++へ移植」  とりあえずはこれらの達成を目標にして日々精進していきたいと思います.
  17.  長い間ご清聴いただきありがとうございました.僕も懇親会に参加する予定なので,質問やツッコミがある方は気軽に話しかけてほしいと思います.