1
クローラ開発の舞台裏
スケーラブルなクローラに必要なもの
Koji Kawamura
Education Engineer
2
This presentation and the accompanying oral presentation contain forward-looking statements, including statements
concerning plans for future offerings; the expected strength, performance or benefits of our offerings; and our future
operations and expected performance. These forward-looking statements are subject to the safe harbor provisions
under the Private Securities Litigation Reform Act of 1995. Our expectations and beliefs in light of currently
available information regarding these matters may not materialize. Actual outcomes and results may differ materially
from those contemplated by these forward-looking statements due to uncertainties, risks, and changes in
circumstances, including, but not limited to those related to: the impact of the COVID-19 pandemic on our business
and our customers and partners; our ability to continue to deliver and improve our offerings and successfully
develop new offerings, including security-related product offerings and SaaS offerings; customer acceptance and
purchase of our existing offerings and new offerings, including the expansion and adoption of our SaaS offerings;
our ability to realize value from investments in the business, including R&D investments; our ability to maintain and
expand our user and customer base; our international expansion strategy; our ability to successfully execute our
go-to-market strategy and expand in our existing markets and into new markets, and our ability to forecast customer
retention and expansion; and general market, political, economic and business conditions.
Additional risks and uncertainties that could cause actual outcomes and results to differ materially are included in
our filings with the Securities and Exchange Commission (the “SEC”), including our Annual Report on Form 10-K for
the most recent fiscal year, our quarterly report on Form 10-Q for the most recent fiscal quarter, and any
subsequent reports filed with the SEC. SEC filings are available on the Investor Relations section of Elastic’s
website at ir.elastic.co and the SEC’s website at www.sec.gov.
Any features or functions of services or products referenced in this presentation, or in any presentations, press
releases or public statements, which are not currently available or not currently available as a general availability
release, may not be delivered on time or at all. The development, release, and timing of any features or functionality
described for our products remains at our sole discretion. Customers who purchase our products and services
should make the purchase decisions based upon services and product features and functions that are currently
available.
All statements are made only as of the date of the presentation, and Elastic assumes no obligation to, and does not
currently intend to, update any forward-looking statements or statements relating to features or functions of services
or products, except as required by law.
Forward-Looking Statements
本セッションの作者について
• Oleksiy Kovyrin
• 業界 20 年のキャリア(運用、性能、スケーラビリティにフォーカス)
• Swiftype 買収により、2017年に Elastic にジョイン
• Swiftype 初期エンジニアの一人
• Swiftype.com のインフラスケーラビリティと運用に注力
• Elastic ジョイン後は App Search プロダクトの Tech Lead に
What is Swiftype?
• 2012 年設立、良い検索を簡単
に
• とてもよくできた Site Search
プロダクト
• 2017 年に Enterprise Search
ソリューション構築のため
Elastic と合併
• Site Search プロダクトのコア
となるパワフルな Web クロー
ラ
Site Search クローラ
簡単な歴史
• 開始当初はシンプル、しかし
すぐにスケーラビリティの課
題に直面
• 20142015 年に全書替え
• 5年間本番運用
• 数千の Web サイトで月間 10
億超のリクエストを処理
Search everything,
everywhere
Bringing the web crawler to all
• Enterprise Search は App
Search と Workplace
Search もある
• 我々のゴールは web サイト
のコンテンツを、全ての
Enterprise Search にイン
ジェストする方法をユーザに
提供すること
• アクセス可能なあらゆるソー
スからコンテンツをインデック
ス
7
Lessons learned
8
Lessons learned
重複コンテンツ除去
Lessons learned: 重複コンテンツ除去
• ユーザの期待はさまざま:
– すでにユニークな Web ページ群をそのままインジェストするケースから
– 数百、数千の重複ページを持つサイトで重複を除去する非常に複雑なメカニズムまで
• 特定の Web サイト向けに重複コンテンツ除去をユーザで制御できるように数
年かけていくつもの機能を開発
• Enterprise Search クローラは、シンプルなクロール設定ルールでクロール処
理を制御する強力な機能を提供
Search results need to be unique
10
Lessons learned
コンテンツの ID
Lessons learned: コンテンツの ID
• 最も一般的なアプローチは URL をページの ID とする方法 Web 標準)
• 実際には、うまく機能しない:
– ページが移動 (名前変更) された際にコンテンツを維持する必要がある
– 複数のページを、インデックス内の単一のコンテンツにグルーピングする必要がある
• Enterprise Search クローラは、Swiftype で数年かけて開発された高度な
URL とコンテンツ正規化、ハッシュテクニックを適用し、これらの課題を解決
Web ページの特定に何を使う?
12
Lessons learned
標準への準拠
Lessons learned:
標準への準拠
• モダンなインターネットは、とてつもな
く巨大 550B pages)
• Web サイトや Web サーバ構築時に
発生しうるミスは全て、すでに実際に
起きている
• クローラもいつかこれらの問題に遭
遇する
標準に準拠している人などいない
Image by KC Green (kcgreendotcom.com)
Lessons learned: 標準への準拠
• 数百万のリンクを持つ、自動生成された巨大な HTML ページ
• 各ページに埋め込まれた数十 MB のインライン Javascript とCSS
• "Page not found" ページのレスポンスを HTTP 200 で返す、またはインデッ
クスすべき正しいページのコンテンツを 200 以外で返す
• コンテンツクローキング (ユーザごとに異なるコンテンツ)
• ページ内の不正な Unicode、 HTTP ヘッダ、 HTML リンク
• 極端に誤った SEO 誤った meta タグ、canonical URL、リダイレクトなど)
• Javascript ベースのレンダリングなどなど
どんだけ壊れているの? いくつかの例
15
Lessons Learned: 標準への準拠
新しい Enterprise Search クローラはさまざまなビルトインのディフェン
シブなメカニズムを備えていて、デフォルトで多くの問題に対応できるよう
な設定となっているので、設定変更は不要、もしくは最小の変更で web
サイトをインデックスできる。
16
Lessons learned
クロールのライフサイクルと期間
Lessons learned: クロールのライフサイクルと期間
• HTTP session state を URL に保持しているサイト (old forums, J2EE
– サイト内の全リンクがユニークなリンクとなり、クロールキューのユニーク化に URL を使ってい
たクローラに無限のタスクを生成していた
• "Page not found" エラーページ上の相対リンクとエラーページが HTTP 200
レスポンスで返されるコンボ
– 全てのリンク切れがインデックスしなければならない正当なコンテンツに、またコンテンツベー
スでの重複除去テクニックで削除の対象に
• プロダクトカタログのコンテンツフィルタ/ソートにURL 部分を利用
– フィルタの組み合わせによりユニークに見える URL が大量に
(e.g., /dresses/color/red/size/small vs. /dresses/size/small/color/red, etc.)
遭遇した問題
Lessons learned: クロールのライフサイクルと期間
• 現実世界は非常に複雑、 "クロール終了" の定義を複数回改訂する必要があっ
た
– 最も明らかな定義 ("全てのページを閲覧 ") は多くの場合、非現実的
– 今日の最新の定義は : "クロールに関するメトリックを元に、サイト内のユニークな web ページ
の大多数を収集済と考えられ、クロールを継続するとリソースの無駄遣いばかりで新しいコン
テンツが見つからない " (そう、長いんです!
• 新しい Enterprise Search クローラは複数のヒューリスティックと設定によりク
ローラの振る舞いを実用に適しユーザが調整可能
– 浅い vs 深い クロール
– クロール期間と深さの上限、 URL 長と深さの上限 など
– コンテンツベースの重複排除
"クロールの終了" を正しく定義することがカギ
19
Lessons learned
オブザーバビリティ
Lessons learned: オブザーバビリティ
• 大規模、または特定のページにおける、Swiftype クローラの動作に関して詳
細なインサイトを得るために大変苦労した
• Elastic ベースのオブザーバビリティ向上に投資を決断
– クローラのヘルスメトリックを Elasticsearch に記録し、 Kibana でダッシュボードに
– Kibana で閲覧する End-to-end の詳細なクロールログから特定ページへとドリルダウン
• 結果のデータセットはクローラのサポートに不可欠であると確証を得た
• 新しい Enterprise Search クローラはこれら全てをビルトイン!
– クローラの判断、アクティビティログは ECS スキーマに準拠
– 詳細なヘルス、パフォーマンスメトリック
– これら全ては Kibana で即座に利用可能
クローラの動作を確認し理解しなければならない
21
Thank You!

クローラーを迅速に入手:効果的なWebクローラーの作成方法

  • 1.
  • 2.
    2 This presentation andthe accompanying oral presentation contain forward-looking statements, including statements concerning plans for future offerings; the expected strength, performance or benefits of our offerings; and our future operations and expected performance. These forward-looking statements are subject to the safe harbor provisions under the Private Securities Litigation Reform Act of 1995. Our expectations and beliefs in light of currently available information regarding these matters may not materialize. Actual outcomes and results may differ materially from those contemplated by these forward-looking statements due to uncertainties, risks, and changes in circumstances, including, but not limited to those related to: the impact of the COVID-19 pandemic on our business and our customers and partners; our ability to continue to deliver and improve our offerings and successfully develop new offerings, including security-related product offerings and SaaS offerings; customer acceptance and purchase of our existing offerings and new offerings, including the expansion and adoption of our SaaS offerings; our ability to realize value from investments in the business, including R&D investments; our ability to maintain and expand our user and customer base; our international expansion strategy; our ability to successfully execute our go-to-market strategy and expand in our existing markets and into new markets, and our ability to forecast customer retention and expansion; and general market, political, economic and business conditions. Additional risks and uncertainties that could cause actual outcomes and results to differ materially are included in our filings with the Securities and Exchange Commission (the “SEC”), including our Annual Report on Form 10-K for the most recent fiscal year, our quarterly report on Form 10-Q for the most recent fiscal quarter, and any subsequent reports filed with the SEC. SEC filings are available on the Investor Relations section of Elastic’s website at ir.elastic.co and the SEC’s website at www.sec.gov. Any features or functions of services or products referenced in this presentation, or in any presentations, press releases or public statements, which are not currently available or not currently available as a general availability release, may not be delivered on time or at all. The development, release, and timing of any features or functionality described for our products remains at our sole discretion. Customers who purchase our products and services should make the purchase decisions based upon services and product features and functions that are currently available. All statements are made only as of the date of the presentation, and Elastic assumes no obligation to, and does not currently intend to, update any forward-looking statements or statements relating to features or functions of services or products, except as required by law. Forward-Looking Statements
  • 3.
    本セッションの作者について • Oleksiy Kovyrin •業界 20 年のキャリア(運用、性能、スケーラビリティにフォーカス) • Swiftype 買収により、2017年に Elastic にジョイン • Swiftype 初期エンジニアの一人 • Swiftype.com のインフラスケーラビリティと運用に注力 • Elastic ジョイン後は App Search プロダクトの Tech Lead に
  • 4.
    What is Swiftype? •2012 年設立、良い検索を簡単 に • とてもよくできた Site Search プロダクト • 2017 年に Enterprise Search ソリューション構築のため Elastic と合併 • Site Search プロダクトのコア となるパワフルな Web クロー ラ
  • 5.
    Site Search クローラ 簡単な歴史 •開始当初はシンプル、しかし すぐにスケーラビリティの課 題に直面 • 20142015 年に全書替え • 5年間本番運用 • 数千の Web サイトで月間 10 億超のリクエストを処理
  • 6.
    Search everything, everywhere Bringing theweb crawler to all • Enterprise Search は App Search と Workplace Search もある • 我々のゴールは web サイト のコンテンツを、全ての Enterprise Search にイン ジェストする方法をユーザに 提供すること • アクセス可能なあらゆるソー スからコンテンツをインデック ス
  • 7.
  • 8.
  • 9.
    Lessons learned: 重複コンテンツ除去 •ユーザの期待はさまざま: – すでにユニークな Web ページ群をそのままインジェストするケースから – 数百、数千の重複ページを持つサイトで重複を除去する非常に複雑なメカニズムまで • 特定の Web サイト向けに重複コンテンツ除去をユーザで制御できるように数 年かけていくつもの機能を開発 • Enterprise Search クローラは、シンプルなクロール設定ルールでクロール処 理を制御する強力な機能を提供 Search results need to be unique
  • 10.
  • 11.
    Lessons learned: コンテンツのID • 最も一般的なアプローチは URL をページの ID とする方法 Web 標準) • 実際には、うまく機能しない: – ページが移動 (名前変更) された際にコンテンツを維持する必要がある – 複数のページを、インデックス内の単一のコンテンツにグルーピングする必要がある • Enterprise Search クローラは、Swiftype で数年かけて開発された高度な URL とコンテンツ正規化、ハッシュテクニックを適用し、これらの課題を解決 Web ページの特定に何を使う?
  • 12.
  • 13.
    Lessons learned: 標準への準拠 • モダンなインターネットは、とてつもな く巨大550B pages) • Web サイトや Web サーバ構築時に 発生しうるミスは全て、すでに実際に 起きている • クローラもいつかこれらの問題に遭 遇する 標準に準拠している人などいない Image by KC Green (kcgreendotcom.com)
  • 14.
    Lessons learned: 標準への準拠 •数百万のリンクを持つ、自動生成された巨大な HTML ページ • 各ページに埋め込まれた数十 MB のインライン Javascript とCSS • "Page not found" ページのレスポンスを HTTP 200 で返す、またはインデッ クスすべき正しいページのコンテンツを 200 以外で返す • コンテンツクローキング (ユーザごとに異なるコンテンツ) • ページ内の不正な Unicode、 HTTP ヘッダ、 HTML リンク • 極端に誤った SEO 誤った meta タグ、canonical URL、リダイレクトなど) • Javascript ベースのレンダリングなどなど どんだけ壊れているの? いくつかの例
  • 15.
    15 Lessons Learned: 標準への準拠 新しいEnterprise Search クローラはさまざまなビルトインのディフェン シブなメカニズムを備えていて、デフォルトで多くの問題に対応できるよう な設定となっているので、設定変更は不要、もしくは最小の変更で web サイトをインデックスできる。
  • 16.
  • 17.
    Lessons learned: クロールのライフサイクルと期間 •HTTP session state を URL に保持しているサイト (old forums, J2EE – サイト内の全リンクがユニークなリンクとなり、クロールキューのユニーク化に URL を使ってい たクローラに無限のタスクを生成していた • "Page not found" エラーページ上の相対リンクとエラーページが HTTP 200 レスポンスで返されるコンボ – 全てのリンク切れがインデックスしなければならない正当なコンテンツに、またコンテンツベー スでの重複除去テクニックで削除の対象に • プロダクトカタログのコンテンツフィルタ/ソートにURL 部分を利用 – フィルタの組み合わせによりユニークに見える URL が大量に (e.g., /dresses/color/red/size/small vs. /dresses/size/small/color/red, etc.) 遭遇した問題
  • 18.
    Lessons learned: クロールのライフサイクルと期間 •現実世界は非常に複雑、 "クロール終了" の定義を複数回改訂する必要があっ た – 最も明らかな定義 ("全てのページを閲覧 ") は多くの場合、非現実的 – 今日の最新の定義は : "クロールに関するメトリックを元に、サイト内のユニークな web ページ の大多数を収集済と考えられ、クロールを継続するとリソースの無駄遣いばかりで新しいコン テンツが見つからない " (そう、長いんです! • 新しい Enterprise Search クローラは複数のヒューリスティックと設定によりク ローラの振る舞いを実用に適しユーザが調整可能 – 浅い vs 深い クロール – クロール期間と深さの上限、 URL 長と深さの上限 など – コンテンツベースの重複排除 "クロールの終了" を正しく定義することがカギ
  • 19.
  • 20.
    Lessons learned: オブザーバビリティ •大規模、または特定のページにおける、Swiftype クローラの動作に関して詳 細なインサイトを得るために大変苦労した • Elastic ベースのオブザーバビリティ向上に投資を決断 – クローラのヘルスメトリックを Elasticsearch に記録し、 Kibana でダッシュボードに – Kibana で閲覧する End-to-end の詳細なクロールログから特定ページへとドリルダウン • 結果のデータセットはクローラのサポートに不可欠であると確証を得た • 新しい Enterprise Search クローラはこれら全てをビルトイン! – クローラの判断、アクティビティログは ECS スキーマに準拠 – 詳細なヘルス、パフォーマンスメトリック – これら全ては Kibana で即座に利用可能 クローラの動作を確認し理解しなければならない
  • 21.