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
rng-apiをサーバレス化した時の話 / rng-api-Serverless
Search
odanado
April 16, 2018
Programming
1.2k
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
rng-apiをサーバレス化した時の話 / rng-api-Serverless
odanado
April 16, 2018
More Decks by odanado
See All by odanado
Vitest Browser Mode への期待 / Vitest Browser Mode
odanado
3
5.6k
@nestjs/bull の活用について
odanado
0
1.6k
クラウド KMS の活用 / TOKYO BLOCKCHAIN TECH MEETUP 2022
odanado
0
1.3k
Vue.observable で状態管理 / vue-observable-state-management
odanado
4
2.1k
nuxtjs-axios-error-handling
odanado
0
420
ブロックチェーンアプリのトランザクションに対するデータ分析 / PyCon-JP-2019
odanado
0
460
スマートコントラクトに対する既知の攻撃とその対策 / bc.tokyo-21
odanado
0
290
最近のweb3.js事情 / bc.tokyo-19
odanado
2
570
YAPC::Tokyo 2019に スタッフ参加してみて / kichijojipm-18
odanado
1
2.4k
Other Decks in Programming
See All in Programming
高専、大学編入、そして未踏へ〜プロダクト開発とキャリアの歩み - Technical College, University Transfer, and On to “Mitou” / My Journey in Product Development and Career
pkmiya
0
120
Cloudflare is Agents
chimame
0
190
仕様駆動開発の消費期限
watany
20
9.2k
Go を使い始めて 2 ヶ月の学び / My first two months with Go
contour_gara
0
400
Go 1.27 における memory allocation の高速化
andpad
0
370
[DroidKaigi 26] How We Moved from Android Studio to Slack
thisaay
0
140
私のClaude Code活用法 (個人開発編) - PHPerKaigi mini #4(2026/08/24)
panda_program
1
200
AIに既存システムを理解させる技術 ~レガシーを見捨てないハーネスエンジニアリング入門~
ochtum
0
190
Hono + Inertia + React で LP を構築した話
oukayuka
2
190
数年滞っていたダークモード対応をおよそ2週間で完了させる
chigichan24
0
200
PHPプロジェクトの結合バランスを可視化する #php_night
kajitack
0
190
高専キャリア LT 発表内容
crysta1221
6
5.4k
Featured
See All Featured
Prompt Engineering for Job Search
mfonobong
0
430
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
230
Unsuck your backbone
ammeep
672
58k
Ethics towards AI in product and experience design
skipperchong
2
360
AI Search: Implications for SEO and How to Move Forward - #ShenzhenSEOConference
aleyda
1
1.4k
Thoughts on Productivity
jonyablonski
76
5.3k
[RailsConf 2023] Rails as a piece of cake
palkan
59
6.9k
Skip the Path - Find Your Career Trail
mkilby
1
210
What does AI have to do with Human Rights?
axbom
PRO
1
2.3k
Side Projects
sachag
455
43k
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
460
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
400
Transcript
rng-apiΛ αʔόϨεԽͨ࣌͠ͷ Gotanda.pm #17
ҙ Perlͱؔͳ͍Λ͠·͢
ࣗݾհ • Twitter @odan3240 • Perlྺ 1 • ීஈϙέϞϯʹؔ͢ΔπʔϧΛݸਓ։ൃ •
ࠓճͦΕʹؔ͢Δͷ • ࠷ۙͯͳϒοΫϚʔΫͷςΫϊϩδʔͰਓؾΤϯτϦೖΓ • poke2vec Ͱݕࡧ 2
rng-api ͱ • ϙέϞϯͷήʔϜͷٖࣅཚͷ ॳظγʔυΛಛఆ͢ΔREST API • ؒͰ60ສճୟ͔ΕͨAPIΛެ։ͨ͠ / rng-api
• ݩʑ͘͞ΒVPSͰӡ༻ • ҰͰ400ສճར༻͞Εͨ • ٖࣅཚͷॳظγʔυΛಛఆ→ཚௐΛߦ͏ͨΊ • ϙέϞϯͷରઓΨν ڧ͍ϙέϞϯΛٻΊͯཚௐΛߦ͏ • ͜Ε͕ͨΓલͷੈք͕͋Δ 3
ॳظγʔυಛఆͷΈ • ಛఆ͢Δͷʹඞཁͳલఏ • ٖࣅཚΞϧΰϦζϜಛఆࡁΈ (આ໌ॻʹϥΠηϯεදه) • ٖࣅཚͷॳظγʔυ32bit (࣮ݧతʹ໌Β͔ʹ) •
࿈ଓ͢ΔཚྻΛ؍ଌ͢Δํ๏ཱ֬ࡁΈ • ཚྻΛ؍ଌ͢Δํ๏ • ήʔϜதͷϩʔσΟϯάը໘ʹ༻͞ΕΔ ࣌ܭͷͷ։࢝Ґஔ͕ཚʹΑܾͬͯఆ͞Ε͍ͯΔ 4 0 1 16 ɾɾɾ
ॳظγʔυಛఆͷΈ • ࿈ଓ͢Δ8ݸͷΛ؍ଌ͢ΕॳظγʔυΛಛఆՄೳ • 2 ** 32 < 17
** 8 • ಛఆͷͨΊʹ࣍ͷલॲཧΛߦ͏ 1. [ॳظγʔυ, ରԠ͢Δ8ݸͷྻ] Λ2**32௨Γܭࢉ 2. ↑ͷϖΞΛ ”ରԠ͢Δ8ݸͷྻ” Ͱιʔτ • ͜ΕʹΑΓɺݕࡧ࣌ʹೋ୳ࡧͰݕࡧՄೳ • ൺֱճߴʑ32ճ • ྫ • https://rng-api.odanado.com/usm/sfmt/seed? needle=9,10,7,11,12,15,7,7 • {"results": [{"seed": "c31a2f06", "encoded_needle": "0dd53f07", "step": 477}]} 5
αʔόϨεԽͷಈػ • ͘͞ΒVPSΛղ͍ͨ͠ • αʔόӡ༻͢Δͷ໘ • ӡ༻ίετΛ͍͑ͨ • αʔόϨεʹṖͷಌΕ 6
αʔόϨεԽͰͷ • DB (όΠφϦϑΝΠϧ) ͷαΠζ͕32GBͱڊେ • aws lambda5ඵͷ੍࣌ؒݶ͕͋Γ S3͔Βͷσʔλͷసૹ࣌ؒͰͦΕ͕ऴΘΔ •
DynamoDB Ͱ͍ • DB࡞࣌ʹ 2**32ճͷ write ͕ඞཁ 7
͜Ε·ͰͷΛཧ͢Δͱ…
ղܾ͍ͨ͠ Read Onlyͳkey-valueͷ Έ߹ΘͤΛAWS Lambda͔Β ݕࡧ͍ͨ͠ 9 • σʔλαΠζ͕32GBͱڊେ
• S3͔Βͷసૹ͕5ඵҎʹऴΘΒͳ͍ • ࡞࣌ʹେྔͷWrite͕ൃੜ →DynamoDBͷ՝ۚྔ orz
࠷ऴతͳղܾࡦ • γϯϓϧ • ํ๏ • ͷྻΛʹΤϯίʔυ • 9,10,7,11,12,15,7,7 ->
0x0dd53f07 • Τϯίʔυͨ͠ͷmod 16 ͰϑΝΠϧׂΛ4ճߦ͏ • LinuxͰಉ࣌ʹ։͚ΔϑΝΠϧ100ݸ·Ͱ • ͜ΕʹΑΓ1ͭͷϑΝΠϧͷαΠζ͕ ߴʑ256KBʹͳΔ • ݕࡧ࣌ରϑΝΠϧΛಛఆͨ͠ޙʹೋ୳ࡧ • ಛఆϑΝΠϧύεͰߦ͑Δ 10 32GB ͷBD (όΠφϦϑΝΠϧ) Λ 16**4ʹׂͯ͠S3ʹஔ͢Δ
͜ΕʹΑΓAWS Lambdaʹ ҠߦͰ͖ͨ Ҡߦͯ͠1ϲ݄ա͚͗ͨͲ ࠓͷͱ͜Ζͳ͠
·ͱΊ • ϙέϞϯͷήʔϜதͷٖࣅཚͷॳظγʔυΛ ಛఆ͢ΔAPIΛ͘͞ΒVPS͔ΒAWS LambdaʹҠߦͨ͠ • DBͷαΠζ͕ڊେ (32GB) ͳͷ͕ʹͳͬͨ •
S3 -> Lambdaͷసૹʹ5ඵҎ্͔͔Δ • DynamoDB ʹஔ͢ΔͱDB࡞࣌ͷ Writeճ͕େྔʹൃੜ͠՝ۚࢮ • DBΛࡉΕʹ͢Δ͜ͱͰసૹ࣌ؒͷΛղܾ • 16**4ݸͷϑΝΠϧʹׂ • ϑΝΠϧύεͰରϑΝΠϧΛಛఆ • ϑΝΠϧ1ͭߴʑ256KB 12