Upgrade to Pro — share decks privately, control downloads, hide ads and more …

OpenSearch Full-Indexing : 予期せぬ挑戦とその解決策 / OpenSearch Full-Indexing : Unexpected Challenges and Solutions

freee
June 06, 2024
770

OpenSearch Full-Indexing : 予期せぬ挑戦とその解決策 / OpenSearch Full-Indexing : Unexpected Challenges and Solutions

freee

June 06, 2024
Tweet

More Decks by freee

Transcript

  1. Full-Indexing の話 Index とは? id name age … 10 John

    Smith 37 11 Sally Smith 35 … 24 Dan Smith 12 user id street city state user_id 1 123 Main St Boston MA 10 2 617-123-4567 35 EMPTY 11 … 15 EMPTY EMPTY EMPTY 21 … address SELECT * FROM users JOIN address ON users.id = address.user_id WHERE users.id = 10
 取得したい情報が複雑になると増える (JOIN の数、Run Time) id 以外の条件で絞るためには別設定が必要 (検索条件の対象 Column Indexing)
  2. Full-Indexing の話 Index とは? curl -X GET "http://localhost:9200/your_index/_search" -H 'Content-Type:

    application/json' -d ' { "query": { "match": { "Name": "John Smith" } } }' * Source : https://www.instaclustr.com/blog/opensearch-and-elasticsearch-architecture/
  3. Full-Indexing の話 どう実施したのか? reports_v202305 
 ← 切り替え以前 * Source :

    https://dev.to/jei/how-to-set-up-an-index-alias-that-points-to-multiple-indices-in-elasticsearch-4g7g
  4. 新規 Index Alias * Source : https://sematext.com/blog/elasticsearch-unassigned-shards/ Retry close_index ???

    OpenSearch Cluster 全体が 不安定な状態になってしまう 迷⼦ 予期せぬ挑戦とその解決策の話(その①) 原因:Node との疎通失敗で新規 Index の Primary Shard が割り当てられなかった
  5. 予期せぬ挑戦とその解決策の話(その②) 原因:ASG による AZ rebalancing で Node が調整され Pod が

    Killed 24-02-09 19:45 Task 実⾏開始 * Source : https://kubernetes.io/ko/docs/tutorials/kubernetes-basics/explore/explore-intro/
  6. Scale Down Auto Scaling 24-02-09 20:07 24-02-09 19:45 Launch Auto

    Scaling An instance was launched to aid in balancing the group's zones * Source : https://kubernetes.io/ko/docs/tutorials/kubernetes-basics/explore/explore-intro/ 予期せぬ挑戦とその解決策の話(その②) 原因:ASG による AZ rebalancing で Node が調整され Pod が Killed Availability Zone rebalancing (Reference) After certain actions occur, your Auto Scaling group can become unbalanced between Availability Zones. Amazon EC2 Auto Scaling compensates by rebalancing the Availability Zones.
  7. 予期せぬ挑戦とその解決策の話(その②) SIGTERM 原因:ASG による AZ rebalancing で Node が調整され Pod

    が Killed 24-02-09 20:07 24-02-09 19:45 24-02-09 20:14 kubelet sigterm * Source : https://kubernetes.io/ko/docs/tutorials/kubernetes-basics/explore/explore-intro/
  8. 予期せぬ挑戦とその解決策の話(その②) 原因:ASG による AZ rebalancing で Node が調整され Pod が

    Killed 24-02-09 20:07 24-02-09 19:45 24-02-09 20:14 terminationGracePeriodSeconds : 7200 24-02-09 22:14 kubelet sigkill * Source : https://kubernetes.io/ko/docs/tutorials/kubernetes-basics/explore/explore-intro/ SIGKILL
  9. task (1) import (1) mailer (1) task (2) task (3)

    予期せぬ挑戦とその解決策の話(その③) 挑戦:件数多くて予想される実⾏時間がながいのに、並列実⾏ができない freee-invoice-worker ruby/rake resque task-runner import-runner mailer-runner
  10. task (2) task (3) task (1) import (1) mailer (1)

    予期せぬ挑戦とその解決策の話(その③) 挑戦:件数多くて予想される実⾏時間がながいのに、並列実⾏ができない freee-invoice-worker ruby/rake resque task-runner import-runner mailer-runner
  11. task (2) task (3) task (1) import (1) mailer (1)

    Task が溜まっていて、hpa の設定があっても スケールして並列実⾏されない 予期せぬ挑戦とその解決策の話(その③) 挑戦:件数多くて予想される実⾏時間がながいのに、並列実⾏ができない freee-invoice-worker ruby/rake resque task-runner import-runner mailer-runner