Skip to Content
スパーク定義ガイド
book

スパーク定義ガイド

by Bill Chambers, Matei Zaharia
March 2025
Intermediate to advanced
606 pages
9h
Japanese
O'Reilly Media, Inc.
Content preview from スパーク定義ガイド

第20章. ストリーム処理の基礎

この作品はAIを使って翻訳されている。ご意見、ご感想をお待ちしている:translation-feedback@oreilly.com

ストリーム 処理は、多くのビッグデータ・アプリケーションにおいて重要な要件である。アプリケーションが何か価値のあるもの、例えば顧客の動きに関するレポートや新しいマシンラーニングモデルを計算するとすぐに、組織はこの結果を本番環境で継続的に計算したいと思うだろう。その結果、あらゆる規模の組織がストリーム処理を取り入れ始めており、多くの場合、新しいアプリケーションの最初のバージョンでさえも、ストリーム処理を取り入れている。

幸いなことに、Apache Sparkにはストリーミングを高レベルでサポートしてきた長い歴史がある。2012年、このプロジェクトは Spark StreamingとそのDStreams APIを組み込んだ。DStreams APIは、mapreduce のような高レベルの関数演算子を使ったストリーム処理を可能にする最初のAPIの1つである。現在、何百もの組織が大規模なリアルタイムアプリケーションの本番環境でDStreamsを使用しており、多くの場合、1時間あたりテラバイトのデータを処理している。しかし、RDD(Resilient Distributed Dataset)APIと同様に、DStreams APIはJava/Pythonオブジェクトに対する比較的低レベルの演算子に基づいており、より高度な最適化の機会が制限されている。そこで2016年、Sparkプロジェクトは、DataFrame上に直接構築された新しいストリーミングAPIであるStructured Streamingを追加した。このAPIは、豊富な最適化と、他のDataFrameやDatasetコードとの統合を大幅に簡素化することの両方をサポートする。Structured Streaming APIはApache Spark 2.2で安定版としてマークされ、Sparkコミュニティ全体で迅速に採用された。

本書では、Structured Streaming APIのみに焦点を当てる。このAPIは、本書の前半で説明したDataFrame APIやDataset APIとディレクトリ統合されており、新しいストリーミング・アプリケーションを書く際に選択されるフレームワークである。もしDStreamsに興味があるのであれば、Francois GarillotとGerard MaasのLearning Spark Streaming(O'Reilly, 2017)のようなSpark Streamingだけに特化した本を含め、他の多くの本がこのAPIをカバーしている。しかし、RDDとDataFramesの違いと同様に、Structured StreamingはDStreamsの大部分の機能のスーパーセットを提供し、コード生成とCatalystオプティマイザによって、しばしばパフォーマンスが向上する。

SparkのストリーミングAPIについて説明する前に、ストリーミングとバッチ処理をより正式に定義しておこう。この章では、本書のこの部分で必要となる、この分野の中核概念について説明する。このトピックに関する学位論文にはならないが、この分野のシステムを理解するのに十分な概念をカバーする。

ストリーム処理とは何か?

ストリーム処理とは、 、結果を計算するために新しいデータを継続的に取り込むことである。ストリーム処理では、入力データは無制限であり、あらかじめ決められた始まりも終わりもない。単純に、ストリーム処理システムに到着する一連のイベント(例えば、クレジットカード取引、Webサイトのクリック、モノのインターネット(IoT)デバイスからのセンサー読み取り)を形成する。ユーザ・アプリケーションは、このイベントのストリームに対して様々なクエリを計算することができる(例えば、各種イベントの実行カウントを追跡したり、1時間ごとのウィンドウに集約したりする)。アプリケーションは、実行中に結果の複数のバージョンを出力するか、キーバリューストアなどの外部「シンク」システムで最新の状態に保つ。 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

高性能Spark

高性能Spark

Holden Karau, Rachel Warren
生成AIの可視化

生成AIの可視化

Priyanka Vergadia, Valliappa Lakshmanan
ソフトウェア工学の基礎

ソフトウェア工学の基礎

Nathaniel Schutta, Dan Vega

Publisher Resources

ISBN: 9798341627567