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
3
780
生成AIコーディングとの向き合い方、AIと共創するという考え方 / How to deal with generative AI coding and the concept of co-creating with AI
seike460
PRO
1
370
地方のPHPerもクラウドを使う理由 ~コストの最適化とチームに向き合う~ / Why even local PHPers use the cloud ~optimize costs and face the team
seike460
PRO
0
64
OpenTelemetryで始めるベンダーフリーなobservability / Vendor-free observability starting with OpenTelemetry
seike460
PRO
0
170
AIコーディングの本質は“コード“ではなく“構造“だった / The essence of AI coding is not “code” but "structure
seike460
PRO
2
1k
OpenTelemetryを活用したObservability入門 / Introduction to Observability with OpenTelemetry
seike460
PRO
1
650
Amazon Q Developer Proで効率化するAPI開発入門
seike460
PRO
0
310
Amazon Aurora DSQLパフォーマンスチェック / Amazon Aurora DSQL Performance Check
seike460
PRO
0
14
(再)ひとり技術広報からの脱却 / Re:Breaking away from one-man technical public relations
seike460
PRO
1
220
Other Decks in Programming
See All in Programming
たった 1 枚の PHP ファイルで実装する MCP サーバ / MCP Server with Vanilla PHP
okashoi
1
260
Railsアプリケーションと パフォーマンスチューニング ー 秒間5万リクエストの モバイルオーダーシステムを支える事例 ー Rubyセミナー 大阪
falcon8823
5
1.1k
XP, Testing and ninja testing
m_seki
3
250
Node-RED を(HTTP で)つなげる MCP サーバーを作ってみた
highu
0
120
設計やレビューに悩んでいるPHPerに贈る、クリーンなオブジェクト設計の指針たち
panda_program
6
2.2k
dbt民主化とLLMによる開発ブースト ~ AI Readyな分析サイクルを目指して ~
yoshyum
3
1k
Porting a visionOS App to Android XR
akkeylab
0
480
Blazing Fast UI Development with Compose Hot Reload (droidcon New York 2025)
zsmb
1
300
初学者でも今すぐできる、Claude Codeの生産性を10倍上げるTips
s4yuba
16
11k
Composerが「依存解決」のためにどんな工夫をしているか #phpcon
o0h
PRO
1
270
PicoRuby on Rails
makicamel
2
130
Startups on Rails in Past, Present and Future–Irina Nazarova, RailsConf 2025
irinanazarova
0
130
Featured
See All Featured
A Modern Web Designer's Workflow
chriscoyier
695
190k
Making the Leap to Tech Lead
cromwellryan
134
9.4k
BBQ
matthewcrist
89
9.7k
Git: the NoSQL Database
bkeepers
PRO
430
65k
How to Think Like a Performance Engineer
csswizardry
25
1.7k
Testing 201, or: Great Expectations
jmmastey
43
7.6k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
10
960
Thoughts on Productivity
jonyablonski
69
4.7k
Why Our Code Smells
bkeepers
PRO
336
57k
The Cost Of JavaScript in 2023
addyosmani
51
8.5k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
667
120k
Bootstrapping a Software Product
garrettdimon
PRO
307
110k
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/