This document discusses Yarn and its advantages over npm. It notes that Yarn uses yarn.lock files instead of npm-shrinkwrap.json files to lock down dependency versions. Yarn is also described as being faster, able to work offline by caching dependencies, and potentially more secure than npm with features like flat mode and module folders. The document suggests Yarn may handle dependencies and devDependencies differently than npm, and questions whether the yarn.lock file should be committed to source control.
This document discusses messaging queues and platforms. It begins with an introduction to messaging queues and their core components. It then provides a table comparing 8 popular open source messaging platforms: Apache Kafka, ActiveMQ, RabbitMQ, NATS, NSQ, Redis, ZeroMQ, and Nanomsg. The document discusses using Apache Kafka for streaming and integration with Google Pub/Sub, Dataflow, and BigQuery. It also covers benchmark testing of these platforms, comparing throughput and latency. Finally, it emphasizes that messaging queues can help applications by allowing producers and consumers to communicate asynchronously.
This document discusses messaging queues and platforms. It begins with an introduction to messaging queues and their core components. It then provides a table comparing 8 popular open source messaging platforms: Apache Kafka, ActiveMQ, RabbitMQ, NATS, NSQ, Redis, ZeroMQ, and Nanomsg. The document discusses using Apache Kafka for streaming and integration with Google Pub/Sub, Dataflow, and BigQuery. It also covers benchmark testing of these platforms, comparing throughput and latency. Finally, it emphasizes that messaging queues can help applications by allowing producers and consumers to communicate asynchronously.
2022/3/24に開催した「オンプレML基盤 on Kubernetes」の資料です。機械学習モデルの開発者が、よりモデルの開発にのみ集中できるようにすることを目指して開発している「LakeTahoe(レイクタホ)」について紹介します。
https://ml-kubernetes.connpass.com/event/239859/
IoT Devices Compliant with JC-STAR Using Linux as a Container OSTomohiro Saneyoshi
?
Security requirements for IoT devices are becoming more defined, as seen with the EU Cyber Resilience Act and Japan’s JC-STAR.
It's common for IoT devices to run Linux as their operating system. However, adopting general-purpose Linux distributions like Ubuntu or Debian, or Yocto-based Linux, presents certain difficulties. This article outlines those difficulties.
It also, it highlights the security benefits of using a Linux-based container OS and explains how to adopt it with JC-STAR, using the "Armadillo Base OS" as an example.
Feb.25.2025@JAWS-UG IoT
1. Co p yrig ht ? 2 0 1 7 Yaho o Jap an Co rp o ratio n. All Rig hts Reserved .
祖父江 翔
実運用して分かったRabbitMQの
良いところ?気をつけること
2017年9月27日
2. Co p yrig ht ? 2 0 1 7 Yaho o Jap an Co rp o ratio n. All Rig hts Reserved .
自己紹介
祖父江 翔(そぶえ しょう)
マーケティングソリューションズカンパニー開発本部
新卒入社7年目
配属されてからずっと広告関連の開発
入稿→アカウント→開発基盤
2
3. Co p yrig ht ? 2 0 1 7 Yaho o Jap an Co rp o ratio n. All Rig hts Reserved .
本日の内容
? Rabbit MQとは
? 広告システム内でのRabbit MQ
? 導入前の課題
? 動機
? 良いところ
? 気をつけること
? 構成
? プロビジョニング
? 保守?運用
? まとめ
3
4. Co p yrig ht ? 2 0 1 7 Yaho o Jap an Co rp o ratio n. All Rig hts Reserved .
RabbitMQとは
5. Co p yrig ht ? 2 0 1 7 Yaho o Jap an Co rp o ratio n. All Rig hts Reserved .
RabbitMQ
RabbitMQ is the most widely deployed open source message broker.
With more than 35,000 production deployments of RabbitMQ world-wide at small
startups and large enterprises, RabbitMQ is the most popular open source message
broker.
RabbitMQ is lightweight and easy to deploy on premises and in the cloud. It
supports multiple messaging protocols. RabbitMQ can be deployed in distributed
and federated configurations to meet high-scale, high-availability requirements.
5
RabbitMQ - Messaging that just works, https://www.rabbitmq.com/
トップページより引用
6. Co p yrig ht ? 2 0 1 7 Yaho o Jap an Co rp o ratio n. All Rig hts Reserved .
要はRabbitMQとは
? オープンソースのメッセージブローカー
? 軽量でデプロイをオンプレミスでも
クラウドでも利用可能
? 複数のメッセージプロトコル対応
? スタンドアローンでもクラスタでも構築可能
6
7. Co p yrig ht ? 2 0 1 7 Yaho o Jap an Co rp o ratio n. All Rig hts Reserved .
多言語サポート
? 公式で用意されているのは
Erlang, Java, C#のみ
? Ruby, Python, PHPなど提供
7
Clients & Developer Tools, https://www.rabbitmq.com/devtools.html
8. Co p yrig ht ? 2 0 1 7 Yaho o Jap an Co rp o ratio n. All Rig hts Reserved .
PluginやAPI
? Pluginが豊富
? 基本機能以外の付け足しが可能
? プロトコルや認証機能の追加が可能
? 管理画面の導入で運用負荷の軽減も可能
? APIが用意されている
? リソースやトラフィックの監視が可能
8
Plugins, https://www.rabbitmq.com/plugins.html
9. Co p yrig ht ? 2 0 1 7 Yaho o Jap an Co rp o ratio n. All Rig hts Reserved .
Management Plugin
9
10. Co p yrig ht ? 2 0 1 7 Yaho o Jap an Co rp o ratio n. All Rig hts Reserved .
広告システム内での
Rabbit MQ
11. Co p yrig ht ? 2 0 1 7 Yaho o Jap an Co rp o ratio n. All Rig hts Reserved .
広告システム
11
FE
BEサーバ群
広告配信システム
広告主が出稿
配信面
非同期化部分
12. Co p yrig ht ? 2 0 1 7 Yaho o Jap an Co rp o ratio n. All Rig hts Reserved .
RabbitMQ導入前の課題
? ブローカーのないキュー管理の仕組みを利用
? 接続の管理が面倒
? 接続設定の修正が職人芸(気軽にできない)
? ProducerとConsumerを気軽に追加できない
12
13. Co p yrig ht ? 2 0 1 7 Yaho o Jap an Co rp o ratio n. All Rig hts Reserved .
導入前(設定つらい…)
13
BE APIサーバ 配信システム連携バッチ
14. Co p yrig ht ? 2 0 1 7 Yaho o Jap an Co rp o ratio n. All Rig hts Reserved .
キュー管理の仕組みに求めたこと
? PHPとJavaで同時に運用できること
? 耐障害性があること
? ConsumerやProducerを容易に追加できること
? スループットが高いこと
? 広告入稿のリクエストに耐えられること
? 処理単位でルーティングができること
14
15. Co p yrig ht ? 2 0 1 7 Yaho o Jap an Co rp o ratio n. All Rig hts Reserved .
RabbitMQを採用
? AMQPで動作する
? クライアントライブラリがある
? JavaでもPHPでも動作するため、並行期間を設けられる
? クラスタを容易に構築できる
? ブローカーのスケールアウトができる
? ProducerとConsumerが容易に追加できる
? トピックとキーでルーティングが可能
15
16. Co p yrig ht ? 2 0 1 7 Yaho o Jap an Co rp o ratio n. All Rig hts Reserved .
広告システム
16
FE
BEサーバ群
広告配信システム
広告主が出稿
配信面
17. Co p yrig ht ? 2 0 1 7 Yaho o Jap an Co rp o ratio n. All Rig hts Reserved .
BEサーバ群の構成
17
BE APIサーバ RabbitMQクラスタ
(3台構成)
配信システム連携バッチ
18. Co p yrig ht ? 2 0 1 7 Yaho o Jap an Co rp o ratio n. All Rig hts Reserved .
良いところ
19. Co p yrig ht ? 2 0 1 7 Yaho o Jap an Co rp o ratio n. All Rig hts Reserved .
言語が混在しても問題なく動作
? JavaからPHPへメッセージの受け渡し
? 並行運用しても問題なく動作
19
20. Co p yrig ht ? 2 0 1 7 Yaho o Jap an Co rp o ratio n. All Rig hts Reserved .
耐障害性、クライアント設定
? クラスタのノードが1台ダウンしても
サービス継続
? クライアントはRabbitMQクラスタを
接続先にすればいい
20
21. Co p yrig ht ? 2 0 1 7 Yaho o Jap an Co rp o ratio n. All Rig hts Reserved .
高いスループット
? VM3台で1クラスタの構成
? vCPU: 8
? Mem: 16G
? Disc: 120G
? 1000万msg/dayをConsumerが処理
21
22. Co p yrig ht ? 2 0 1 7 Yaho o Jap an Co rp o ratio n. All Rig hts Reserved .
気をつけること
23. Co p yrig ht ? 2 0 1 7 Yaho o Jap an Co rp o ratio n. All Rig hts Reserved .
構成
24. Co p yrig ht ? 2 0 1 7 Yaho o Jap an Co rp o ratio n. All Rig hts Reserved .
LBを使った構成の罠
25. Co p yrig ht ? 2 0 1 7 Yaho o Jap an Co rp o ratio n. All Rig hts Reserved .
複数ノード構成なのでLBを配備してみた
? HTTPサーバみたいに
LB経由でバランシングする構成に
25
BE APIサーバ RabbitMQクラスタ
LB
26. Co p yrig ht ? 2 0 1 7 Yaho o Jap an Co rp o ratio n. All Rig hts Reserved .
メッセージが見つからない
? システム内で整合性が取れない
? ただ、何が消えたのかわからない
? リカバリ頑張る、運用でカバー
26
27. Co p yrig ht ? 2 0 1 7 Yaho o Jap an Co rp o ratio n. All Rig hts Reserved .
LBを入れてリッチな構成にしたことが仇
? LBがセッション維持しない設定(変更不可)
? LBがセッションを定期的に破棄していることが発覚
? JavaのRabbitMQクライアントで
LBを使わなくてもクラスタを考慮した接続や
障害時の接続のリカバリが実装されていた
27
28. Co p yrig ht ? 2 0 1 7 Yaho o Jap an Co rp o ratio n. All Rig hts Reserved .
LBいらない
? ノードを全部列挙する
28
BE APIサーバ RabbitMQクラスタ
Host1,Host2,Host3
29. Co p yrig ht ? 2 0 1 7 Yaho o Jap an Co rp o ratio n. All Rig hts Reserved .
プロビジョニング
30. Co p yrig ht ? 2 0 1 7 Yaho o Jap an Co rp o ratio n. All Rig hts Reserved .
クラスタ止まった
31. Co p yrig ht ? 2 0 1 7 Yaho o Jap an Co rp o ratio n. All Rig hts Reserved .
クラスタが応答しなくなった
大量のメッセージがあると応答しない
PublishもConsumeもできない状態
処理が遅延してシステムが止まるような事態に…
31
32. Co p yrig ht ? 2 0 1 7 Yaho o Jap an Co rp o ratio n. All Rig hts Reserved .
原因その1: ディスクI/O
メモリ上で扱わず
すべてディスクに書き込む設定 (デフォルト)
設定変更してメモリで扱うように
32
信頼性よりパフォーマンスを重視した設定
※マスタ1台のみディスク、スレーブ2台をメモリ
33. Co p yrig ht ? 2 0 1 7 Yaho o Jap an Co rp o ratio n. All Rig hts Reserved .
ただし、通常はディスク推奨
→通常はディスクのみ、メモリは特殊ケース
33
Clustering Guide: https://www.rabbitmq.com/clustering.html
A node can be a disk node or a RAM node. (Note: disk and disc are used
interchangeably).
In most cases you want all your nodes to be disk nodes; RAM nodes are a
special case that can be used to improve the performance clusters with
high queue, exchange, or binding churn.
When in doubt, use disk nodes only.
Clustering Guideより引用
34. Co p yrig ht ? 2 0 1 7 Yaho o Jap an Co rp o ratio n. All Rig hts Reserved .
原因その2:トラッフィク統計の設定
? Message ratesの設定(rates_mode)
? 管理プラグインを入れるとデフォルトBasicモード
? メッセージの転送レートを表示するための設定
? メッセージの流量を観測するには有用な設定
34
Management Plugin: https://www.rabbitmq.com/management.html
35. Co p yrig ht ? 2 0 1 7 Yaho o Jap an Co rp o ratio n. All Rig hts Reserved .
Message ratesの設定あり
35
36. Co p yrig ht ? 2 0 1 7 Yaho o Jap an Co rp o ratio n. All Rig hts Reserved .
Message ratesの設定なし
36
37. Co p yrig ht ? 2 0 1 7 Yaho o Jap an Co rp o ratio n. All Rig hts Reserved .
高スループット環境では無効にするべき
? このオプションを無効にした途端に
スループットが向上
? メトリック監視とパフォーマンスはトレードオフ
? 公式でも
37
Alternatively, the message rates can be disabled altogether.
This can help get the best possible performance out of a CPU-bound server.
Management Plugin: https://www.rabbitmq.com/management.html
Management Pluginより引用
38. Co p yrig ht ? 2 0 1 7 Yaho o Jap an Co rp o ratio n. All Rig hts Reserved .
保守?運用
39. Co p yrig ht ? 2 0 1 7 Yaho o Jap an Co rp o ratio n. All Rig hts Reserved .
無停止で
バージョンアップする
40. Co p yrig ht ? 2 0 1 7 Yaho o Jap an Co rp o ratio n. All Rig hts Reserved .
サービス停止するわけにいかない
? 24時間絶え間なく広告入稿のリクエスト
? ミドルウェアのバージョンアップで
サービス停止できない
40
41. Co p yrig ht ? 2 0 1 7 Yaho o Jap an Co rp o ratio n. All Rig hts Reserved .
切り替え Step1
41
広告配信システム
FE
Consumer
旧RabbitMQクラスタ
BE
42. Co p yrig ht ? 2 0 1 7 Yaho o Jap an Co rp o ratio n. All Rig hts Reserved .
切り替え Step2
42
広告配信システム
FE
Consumer
旧RabbitMQクラスタ
BE
新RabbitMQクラスタ
43. Co p yrig ht ? 2 0 1 7 Yaho o Jap an Co rp o ratio n. All Rig hts Reserved .
切り替え Step3
43
広告配信システム
FE
Consumer
旧RabbitMQクラスタ
BE
新RabbitMQクラスタ
メッセージを
捌き切る
44. Co p yrig ht ? 2 0 1 7 Yaho o Jap an Co rp o ratio n. All Rig hts Reserved .
切り替え Step4
44
広告配信システム
FE
旧RabbitMQクラスタ
BE
新RabbitMQクラスタ
Consumer
45. Co p yrig ht ? 2 0 1 7 Yaho o Jap an Co rp o ratio n. All Rig hts Reserved .
ネットワーク
パーティション
46. Co p yrig ht ? 2 0 1 7 Yaho o Jap an Co rp o ratio n. All Rig hts Reserved .
ネットワーク障害!
? ある日、ネットワーク障害発生
? 管理画面開くと…
46
47. Co p yrig ht ? 2 0 1 7 Yaho o Jap an Co rp o ratio n. All Rig hts Reserved .
再起動するしかない
47
? 公式のドキュメントによると…
Clustering and Network Partitions: https://www.rabbitmq.com/partitions.html
It may be simpler to stop the whole cluster and start it again; if
so make sure that the first node you start is from the trusted
partition.
Clustering and Network Partitionsより引用
48. Co p yrig ht ? 2 0 1 7 Yaho o Jap an Co rp o ratio n. All Rig hts Reserved .
まとめ
49. Co p yrig ht ? 2 0 1 7 Yaho o Jap an Co rp o ratio n. All Rig hts Reserved .
まとめ
? 良いところ
? 高スループット
? 耐障害性があり、クライアント設定はシンプル
? 多言語対応していて、混在でも並行運用可
? 気をつけること
? 特に高スループットが要求される場合は
プロビジョニングに注意
? 公式ドキュメントは読み込むべし
49