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
perl for shell, awk and sed programmers
mackee
2
1.3k
今更GoのWebフレームワークを作ろうとしているワケ / Why am I trying to create a Go web framework now?
mackee
1
63
マイクロサービス化を利用した Goへの移行事例
mackee
0
100
PerlでつくるフルスクラッチWebAuthn/パスキー認証 / Demonstration of full-scratch WebAuthn/Passkey Authentication written in Perl
mackee
3
3.2k
SRE定例やその辺の取り組みをアプリケーションエンジニア目線で語る / "Observe" about SRE Meeting by Application Engineer
mackee
0
1.8k
TinyGoで使えるORM sqllaの 紹介とTinyGoで使えるようにするための工夫
mackee
0
1.1k
Go向けORM sqllaの紹介と JOINやUNIONを含んだクエリの扱い方
mackee
0
4.4k
デプロイ今昔物語 〜CGIからサーバーレスまで〜 / The deployment technics
mackee
10
12k
E2Eテストから負荷試験シナリオを作ってみた / Why do we make a scenario of load testing from E2E testing scenarios
mackee
3
5.4k
Other Decks in Programming
See All in Programming
Duckdb-Wasmでローカルダッシュボードを作ってみた
nkforwork
0
120
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
0
100
AWS IaCの注目アップデート 2024年10月版
konokenj
3
3.3k
見せてあげますよ、「本物のLaravel批判」ってやつを。
77web
7
7.7k
【Kaigi on Rails 2024】YOUTRUST スポンサーLT
krpk1900
1
330
RubyLSPのマルチバイト文字対応
notfounds
0
120
Kaigi on Rails 2024 〜運営の裏側〜
krpk1900
1
190
初めてDefinitelyTypedにPRを出した話
syumai
0
400
Generative AI Use Cases JP (略称:GenU)奮闘記
hideg
1
290
ActiveSupport::Notifications supporting instrumentation of Rails apps with OpenTelemetry
ymtdzzz
1
230
A Journey of Contribution and Collaboration in Open Source
ivargrimstad
0
890
Outline View in SwiftUI
1024jp
1
320
Featured
See All Featured
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
6
410
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
126
18k
Optimising Largest Contentful Paint
csswizardry
33
2.9k
Unsuck your backbone
ammeep
668
57k
How STYLIGHT went responsive
nonsquared
95
5.2k
GitHub's CSS Performance
jonrohan
1030
460k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
Building an army of robots
kneath
302
43k
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
The Cost Of JavaScript in 2023
addyosmani
45
6.7k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
169
50k
Build your cross-platform service in a week with App Engine
jlugia
229
18k
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Ͱ͕͢ࣄಉ͡Α͏ͳײ͡+ͷΞϨ ϯδͱݴ͏ײ͡Ͱ͢ɻڵຯ͕͋ΕͲ͏ͧɻ ͋ͱͰ্͛Δ