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
250
perl for shell, awk and sed programmers
mackee
2
1.7k
今更GoのWebフレームワークを作ろうとしているワケ / Why am I trying to create a Go web framework now?
mackee
1
180
database/sqlでNullを扱う歴史とsql.Null[T]の登場 / sql.Null[T] history
mackee
0
110
マイクロサービス化を利用した Goへの移行事例
mackee
0
230
PerlでつくるフルスクラッチWebAuthn/パスキー認証 / Demonstration of full-scratch WebAuthn/Passkey Authentication written in Perl
mackee
3
3.6k
SRE定例やその辺の取り組みをアプリケーションエンジニア目線で語る / "Observe" about SRE Meeting by Application Engineer
mackee
0
1.8k
TinyGoで使えるORM sqllaの 紹介とTinyGoで使えるようにするための工夫
mackee
0
1.3k
Go向けORM sqllaの紹介と JOINやUNIONを含んだクエリの扱い方
mackee
0
4.7k
Other Decks in Programming
See All in Programming
Package Traits
ikesyo
2
220
ファインディの テックブログ爆誕までの軌跡
starfish719
1
550
Linux && Docker 研修/Linux && Docker training
forrep
12
2.2k
CloudNativePGがCNCF Sandboxプロジェクトになったぞ! 〜CloudNativePGの仕組みの紹介〜
nnaka2992
0
130
PHPUnitしか使ってこなかった 一般PHPerがPestに乗り換えた実録
mashirou1234
0
450
いりゃあせ、PHPカンファレンス名古屋2025 / Welcome to PHP Conference Nagoya 2025
ttskch
1
220
サーバーゆる勉強会 DBMS の仕組み編
kj455
1
320
asdf-ecspresso作って 友達が増えた話 / Fujiwara Tech Conference 2025
koluku
0
1.5k
アクターシステムに頼らずEvent Sourcingする方法について
j5ik2o
6
720
2024年のkintone API振り返りと2025年 / kintone API look back in 2024
tasshi
0
150
為你自己學 Python
eddie
0
530
“あなた” の開発を支援する AI エージェント Bedrock Engineer / introducing-bedrock-engineer
gawa
9
990
Featured
See All Featured
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
127
18k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
45
2.3k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.4k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
27
1.9k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
52k
Producing Creativity
orderedlist
PRO
343
39k
VelocityConf: Rendering Performance Case Studies
addyosmani
327
24k
Statistics for Hackers
jakevdp
797
220k
Adopting Sorbet at Scale
ufuk
74
9.2k
How to Think Like a Performance Engineer
csswizardry
22
1.3k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
3
360
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Ͱ͕͢ࣄಉ͡Α͏ͳײ͡+ͷΞϨ ϯδͱݴ͏ײ͡Ͱ͢ɻڵຯ͕͋ΕͲ͏ͧɻ ͋ͱͰ্͛Δ