Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
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.7k
@nestjs/bull の活用について
odanado
0
1.6k
クラウド KMS の活用 / TOKYO BLOCKCHAIN TECH MEETUP 2022
odanado
0
1.4k
Vue.observable で状態管理 / vue-observable-state-management
odanado
4
2.2k
nuxtjs-axios-error-handling
odanado
0
420
ブロックチェーンアプリのトランザクションに対するデータ分析 / PyCon-JP-2019
odanado
0
460
スマートコントラクトに対する既知の攻撃とその対策 / bc.tokyo-21
odanado
0
300
最近のweb3.js事情 / bc.tokyo-19
odanado
2
580
YAPC::Tokyo 2019に スタッフ参加してみて / kichijojipm-18
odanado
1
2.4k
Other Decks in Programming
See All in Programming
The Good Stuff, Not the Slop: Engineering High-Quality Android Apps with Modern AI Tooling
danybony
1
260
マイコン向けの軽量Ruby「PicoRuby」で各種デバイスを制御するネイティブアプリの実現手法
bash0c7
0
440
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
510
仕様駆動開発による爆速プロダクト開発 / Bakusoku Spec Driven Development
kobakei
0
130
動作中のプログラムの中身をリアルタイムに覗く / Realtime Debugger for CSharp with Roslyn
prota
1
1k
【高い買い物LT会】初任給で話題の国産フィジカルAIを買った話
akagami
PRO
0
170
世界の中心で、AI(App Intents)をさけぶ ー App Intents中心設計の実践ガイド
touyou
0
650
市販E-Readerを乗っ取れ 〜Embedded Swiftで電子ペーパーガジェットを制御する〜
trickart
0
200
UnityでSystem.Net.WebSocketsなWebSocketサーバが動かないのでUnity Monoのコードを覗いてみた / about implementing websocket server with unity mono
drumath2237
1
320
LoopHub - ローカルで動く GitHub で、AI と共同開発
jugyo
1
570
iOSDC2026登壇資料.pdf
riofujimon
0
180
The Rails Doctrine Decade
koic
2
330
Featured
See All Featured
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
1
560
Building the Perfect Custom Keyboard
takai
2
880
Site-Speed That Sticks
csswizardry
13
1.5k
Fashionably flexible responsive web design (full day workshop)
malarkey
409
67k
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
520
Scaling GitHub
holman
464
140k
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
6
1.2k
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
0
250
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
340
Digital Ethics as a Driver of Design Innovation
axbom
PRO
1
430
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
0
200
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