Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Goでパイプライン/Pipeline_with_Go
Search
shiro seike
PRO
June 10, 2021
Programming
0
150
Goでパイプライン/Pipeline_with_Go
Fukuoka.go#17
https://fukuokago.connpass.com/event/202570/
shiro seike
PRO
June 10, 2021
Tweet
Share
More Decks by shiro seike
See All by shiro seike
なぜ適用するか、移行して理解するClean Architecture 〜構造を超えて設計を継承する〜 / Why Apply, Migrate and Understand Clean Architecture - Inherit Design Beyond Structure
seike460
PRO
0
220
生成AIコーディングとの向き合い方、AIと共創するという考え方 / How to deal with generative AI coding and the concept of co-creating with AI
seike460
PRO
1
320
地方のPHPerもクラウドを使う理由 ~コストの最適化とチームに向き合う~ / Why even local PHPers use the cloud ~optimize costs and face the team
seike460
PRO
0
62
OpenTelemetryで始めるベンダーフリーなobservability / Vendor-free observability starting with OpenTelemetry
seike460
PRO
0
160
AIコーディングの本質は“コード“ではなく“構造“だった / The essence of AI coding is not “code” but "structure
seike460
PRO
2
970
OpenTelemetryを活用したObservability入門 / Introduction to Observability with OpenTelemetry
seike460
PRO
1
630
Amazon Q Developer Proで効率化するAPI開発入門
seike460
PRO
0
300
Amazon Aurora DSQLパフォーマンスチェック / Amazon Aurora DSQL Performance Check
seike460
PRO
0
10
(再)ひとり技術広報からの脱却 / Re:Breaking away from one-man technical public relations
seike460
PRO
1
220
Other Decks in Programming
See All in Programming
コード書くの好きな人向けAIコーディング活用tips #orestudy
77web
3
320
エンジニア向け採用ピッチ資料
inusan
0
140
統一感のある Go コードを生成 AI の力で手にいれる
otakakot
0
3k
Gleamという選択肢
comamoca
6
740
型付きアクターモデルがもたらす分散シミュレーションの未来
piyo7
0
800
FormFlow - Build Stunning Multistep Forms
yceruto
1
190
XSLTで作るBrainfuck処理系
makki_d
0
210
カクヨムAndroidアプリのリブート
numeroanddev
0
430
第9回 情シス転職ミートアップ 株式会社IVRy(アイブリー)の紹介
ivry_presentationmaterials
1
190
プロダクト開発でも使おう 関数のオーバーロード
yoiwamoto
0
160
既存デザインを変更せずにタップ領域を広げる方法
tahia910
1
240
Railsアプリケーションと パフォーマンスチューニング ー 秒間5万リクエストの モバイルオーダーシステムを支える事例 ー Rubyセミナー 大阪
falcon8823
1
470
Featured
See All Featured
Scaling GitHub
holman
459
140k
Git: the NoSQL Database
bkeepers
PRO
430
65k
Testing 201, or: Great Expectations
jmmastey
42
7.5k
Building Flexible Design Systems
yeseniaperezcruz
328
39k
How to Ace a Technical Interview
jacobian
277
23k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
48
5.4k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
357
30k
A Modern Web Designer's Workflow
chriscoyier
693
190k
VelocityConf: Rendering Performance Case Studies
addyosmani
330
24k
Balancing Empowerment & Direction
lara
1
340
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
20
1.3k
The Invisible Side of Design
smashingmag
299
51k
Transcript
Goでパイプライン Fukuoka.go #17 2021.06.10 清家 史郎 1
自己紹介 清家 史郎 seike460 - ID - Github:seike460 - Twitter:@seike460
- Work at - 株式会社 Fusic (フュージック) 技術開発本部/技術開発第一部門 ▪ エバンジェリスト ▪ チームリーダー ▪ プリンシパルエンジニア - Skill - PHP - Go - AWS 2
パイプライン
パイプライン パイプライン データストリームやバッチ処理を行う際等に、 データを受け取って何らかの処理を行って、どこかに渡す一連の作業 これらの操作をパイプラインのステージと呼びます。 ステージには以下の性質があります。
- 前段ステージの戻り値の型と 後段ステージの入力の型が一致している - 引き回せる様に具体化されている (Goは関数の形で具体化されている) 4
kat-co/concurrency-in-go-src Goでパイプラインを作るぞ!
パイプライン処理の例 6 fig-functional-pipeline-combination.go int sliceと intを引数に int sliceを戻り値に取る関数
ステージの追加例 7 fig-adding-additional-stage-to-pipeline.go int sliceと intを引数に int sliceを戻り値に取る関数
パイプラインの利点 ステージ自体を変更する事なく、簡単にステージを組み合わせる事が出来る パイプラインの利点を理解したところで、Goならではのパイプラインを考えます。 チャネルを利用して、パイプラインを構築することで、 並列処理をパイプラインにて処理する事が出来るようになります。
8
チャネルを利用したパイプライン処理 9 fig-pipelines-chan-stream-processing.go generatorで可変長引数のint slice 整数バッファ付きチャネルを作成し
作成したチャネルを返す
数字ストリームを受けた multiply 10 数字ストリームを受け、 2倍したチャネルを返す
数字ストリームを受けた add 11 数字のストリームを受け、 引数の整数を足したチャネルを返す
パイプラインを利用した例 (ストリーム型) 12 fig-pipelines-func-stream-processing.go 各ステージでは前段の戻り値と 後段の入力値が一致しており、 安全に並列処理が行える
パイプラインが構築出来る
まとめ Point 3 「Go言語による並行処理」はいい本なのでぜひ読みましょう 13 ステージを介する事で簡単にパイプラインを構築する事が出来る Point 1
Goのチャネルをつかうと、パイプラインパターンを利用しながら並列処理が可能になる Point 2
ご清聴いただきありがとうございました Thank You We are Hiring ! https://recruit.fusic.co.jp/