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
某人気アプリのクローンをPerlで作る(予定
Search
mackee
July 12, 2014
Programming
0
1k
某人気アプリのクローンをPerlで作る(予定
Yop - Yo private -
kuiperbelt + Amon2
mackee
July 12, 2014
Tweet
Share
More Decks by mackee
See All by mackee
range over funcの使い道と非同期N+1リゾルバーの夢 / about a range over func
mackee
0
110
perl for shell, awk and sed programmers
mackee
2
1.5k
今更GoのWebフレームワークを作ろうとしているワケ / Why am I trying to create a Go web framework now?
mackee
1
69
マイクロサービス化を利用した Goへの移行事例
mackee
0
120
PerlでつくるフルスクラッチWebAuthn/パスキー認証 / Demonstration of full-scratch WebAuthn/Passkey Authentication written in Perl
mackee
3
3.4k
SRE定例やその辺の取り組みをアプリケーションエンジニア目線で語る / "Observe" about SRE Meeting by Application Engineer
mackee
0
1.8k
TinyGoで使えるORM sqllaの 紹介とTinyGoで使えるようにするための工夫
mackee
0
1.2k
Go向けORM sqllaの紹介と JOINやUNIONを含んだクエリの扱い方
mackee
0
4.5k
デプロイ今昔物語 〜CGIからサーバーレスまで〜 / The deployment technics
mackee
10
12k
Other Decks in Programming
See All in Programming
ドメインイベント増えすぎ問題
h0r15h0
1
100
KubeCon + CloudNativeCon NA 2024 Overviewat Kubernetes Meetup Tokyo #68 / amsy810_k8sjp68
masayaaoyama
0
250
Асинхронность неизбежна: как мы проектировали сервис уведомлений
lamodatech
0
640
Go の GC の不得意な部分を克服したい
taiyow
2
760
nekko cloudにおけるProxmox VE利用事例
irumaru
3
420
快速入門可觀測性
blueswen
0
320
Symfony Mapper Component
soyuka
2
730
MCP with Cloudflare Workers
yusukebe
2
220
テスト自動化失敗から再挑戦しチームにオーナーシップを委譲した話/STAC2024 macho
ma_cho29
1
1.3k
StarlingMonkeyを触ってみた話 - 2024冬
syumai
3
270
コンテナをたくさん詰め込んだシステムとランタイムの変化
makihiro
1
120
.NET 9アプリをCGIとして レンタルサーバーで動かす
mayuki
1
770
Featured
See All Featured
A designer walks into a library…
pauljervisheath
204
24k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
169
50k
KATA
mclloyd
29
14k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
Being A Developer After 40
akosma
87
590k
Product Roadmaps are Hard
iamctodd
PRO
49
11k
How STYLIGHT went responsive
nonsquared
95
5.2k
Docker and Python
trallard
41
3.1k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
159
15k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
0
94
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
17
2.2k
The Straight Up "How To Draw Better" Workshop
denniskardys
232
140k
Transcript
༗໊ΞϓϦͷΫϩʔϯΛ PerlͰ࡞Δʢ༧ఆ @mackee_w Mishima.pm 2014-07-12
୭ • @mackee_w / Ϛίϐʔ / ϑΝογϣϯϙΤϜ • Yokohama.pm ෭Ϧʔμʔ
• ໘ന๏ਓ ઌGoΛΔͱ͍͕ͬͨPerlΛ ΊΔͱݴ֮ͬͨ͑ͳ͍ͧͱ͍͏ࢥ͍
༗໊ΞϓϦͱ
͜Ε͔ͳʁ
͜Ε͔ͳʁ
͜Ε͔ͳʁ
͜ΕɾɾɾɾͰ͢
Yoͱ ໊લΛࢦఆͯ͠ʮYoʯͱૹΕΔΞϓϦ ϋΠίϯςΩετ͔ͭάϩʔόϧͰΦϙνϡχςΟͳίϛϡχέʔ γϣϯΛ࣮ݱ͢ΔࠓϋΠτΡΤϯςΟٴͼौ୩ք۾ʹਓؾͷSNS ΞϓϦέʔγϣϯ ࠓ͔ΒpapixʹૹΓ·͢
ͳͥYoΛͭ͘Δ͔ • ͷۈΊ͍ͯΔ໘ന๏ਓʹϓϥΠϕʔτ GyazoϓϥΠϕʔτGistͳͲطଘαʔϏεͷ ΦϯϓϨ൛ʢʁʣΈ͍ͨͳͷΛαΫοͱॻ͍ ͯஔ͍͍ͯ·͢ • YoͰίϛϡχέʔγϣϯऔΕΔͳΒΫϩʔζ υͳYoधཁ͕͋ΔͷͰʁ
Yo private
ུͯ͠Yop
·ͩදଆ࡞ͬͯΔͱ͜Ζ αʔόαΠυΛհ
Yoʹඞཁͳཁૉ • ໊લΛܾΊΔ(࠷ۙύεϫʔυೖͬͨ • ϓογϡ௨
໊લΛܾΊΔ • ͳΜ͔ೖྗͯ͠Β͍APIͳΓϑΥʔϜͳΓͰ ૹͬͯΒ͏ • ૹ͖ͬͯͯΒ໊ͬͨલΛόϦσʔγϣϯ͠ ͯDBʹಥͬࠐΉ • ͦΕΛΑ͠ͳʹҾ͚ΔΑ͏ʹ͢Δ
׳Ε͍ͯΔAmon2Ͱ ΜͰΈΔ
amon2-setup.pl Yop
Yop::Web::Dispather
Yop::Model::Member
t/model/member.t
͍ͬͯΔCPANϞδϡʔϧ • JSON::Types • Data::Validator • Time::Piece::Plus • Furl
ςετͷ΄͏ • Test::Time • Test::Fatal • Test::Mock::Guard • Path::Tiny
PerlͰϓογϡ௨ • Protocol::Websocket • Amon2ʹWebSocketϓϥάΠϯ͋Δ • PocketIO • Socket.IOͷผ࣮
Perl + ඇಉظ = AnyEvent • ίωΫγϣϯΛͭͳ͗ͬͺͳ͠ʹ͠ͳ͍ͱ͍ ͚ͳ͍ͷͰඇಉظඞਢ • ͦ͜ͰAnyEvent
• ͔͠͠AnyEventʹ᠘͕……
ίʔϧόοΫࠈ • AΛͬͨΒBΛͬͯͦΕ͕͓ΘͬͨΒCΛ ͬͯ…… • ίʔϧόοΫ͕ωετ͍ͯͬͯ͠Α͘Θ͔Β ͳ͍͜ͱʹͳΔʂ • Promise::Defferedͱ͍͏ճආํ๏͋Δ
AnyEvent + DBI = blocking… • DBIΛͦͷ··͏ͱϒϩοΩϯάIOͳͷͰ વΠϕϯτϧʔϓΛࢭΊΔ • WebSocketͩͱίωΫγϣϯҡ࣋Ͱ͖ͳ͔ͬ
ͨΓ͢Δ • ࣮ࡍͦΜͳʹͳΒͳ͍આ͋Δ
DBI on AnyEvent • AnyEvent::DBI • ͦͷ໊ͷ௨Γ • forkΛར༻ τϥϯβΫγϣϯ͕ࠞ͟Δ
• AnyEvent::DBI::MySQL • MySQLઐ༻ • txn͑ͳ͍ؾ͕͢ΔΜͰ͚͢ΕͲͲ͏ͳΜͰ͠ΐ͏͔
Gearmanͱ͔ʹͤΔ • Gearman δϣϒΩϡʔϫʔΧʔ • Gearman::ClientϒϩοΩϯάIO • AnyEvent::Gearman::ClientMooseͷґଘ࣋ ͪͳͷͰ͋Μ·Γ͍ͨ͘ͳ͍ײ͕͡க͠· ͢(࣋පͷMooseΞϨϧΪʔʁ
ඇಉظPerl͔Β͍ग़͢ʂ
Kuiperbelt Asyncronous Protocol Proxy
Kuiperbeltͱ • ಉظϞσϧ(preforkϞσϧ)ͷΞϓϦέʔγϣ ϯͱ࿈ܞ͢Δ͜ͱΛఆͨ͠ඇಉظϓϩτί ϧͷίωΫγϣϯϓʔϧ • ࠓͷͱ͜ΖHTTP Stream(Long polling/ Comet)ͷΈରԠ
• Golang github.com/mackee/kuiperbelt
ίωΫγϣϯ࣌
kuiperbelt Yop(Amon2) PAPIX
kuiperbelt Yop(Amon2) PAPIX ᶃTUSFBNDPOOFDU
kuiperbelt Yop(Amon2) PAPIX ᶃTUSFBNDPOOFDU ᶄ66*%ΛؚΜͩ+40/
kuiperbelt Yop(Amon2) PAPIX ᶃTUSFBNDPOOFDU ᶄ66*%ΛؚΜͩ+40/ ᶅKPJOVVJE66*%OBNF1"1*9
YopΛૹΔͱ͖
kuiperbelt Yop(Amon2) PAPIX MOZNION
kuiperbelt Yop(Amon2) PAPIX MOZNION ᶃTFOEUBSHFU@OBNF1"1*9
kuiperbelt Yop(Amon2) PAPIX MOZNION ᶃTFOEUBSHFU@OBNF1"1*9 ᶄTUSFBNTFOE66*%1"1*9ͷ66*%
kuiperbelt Yop(Amon2) PAPIX MOZNION ᶃTFOEUBSHFU@OBNF1"1*9 ᶄTUSFBNTFOE66*%1"1*9ͷ66*% ᶅDPOOFDUΛͬͯNFTTBHF:PQΛૹ৴
PerlͰॻ͖͍͢ͱ͜ΖPerl ͦͷଞؙ͛
σόοάڥ • ҎԼͷͷΛProcletͰଋͶΔ • Yop(Starlet) • kuiperbelt • Ҏ্ͷͷΛҰͭͷϙʔτͰड͚ΔͨΊʹ Plack::App::Proxy(Twiggy)
• ຊ൪ڥnginxͰଋͶΔ͔ͳ͋ • ଋͶΔͷΫϩεΦϦδϯରԠΊΜͲ͍ͷͰ
·ͱΊ • ϑϩϯτ͕શવ࡞Εͯͳ͍ͷͰؼͬͨΒຊؾ ग़͢ • Component / Vue.js / Polymerͱ͔͍͍ͨ
• Amon2Ͱ͕͢ࣄಉ͡Α͏ͳײ͡+ͷΞϨ ϯδͱݴ͏ײ͡Ͱ͢ɻڵຯ͕͋ΕͲ͏ͧɻ ͋ͱͰ্͛Δ