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.3k
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
290
最近の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
Family mrubyの進捗
kishima
1
100
XHTMLが残したもの
yosuke_furukawa
PRO
2
470
Can LLMs Replicate 4 Years of Compose Migration? Exploring the boundaries of automation with 279 XML files from a real product
makun
0
130
ハーネス設計入門 〜プロンプト、コンテキストの次〜
kinopeee
55
36k
tsc.rip を支える技術 / Kyoto.なんか #8
susisu
0
4.4k
WebMCP Challenge に星空観察アプリで参加した話
okajun35
0
120
GKE で Pod の見方を変えたら、スケールアウト時の挙動を真に捉えられた話
stkk
0
100
LLMは4年分のCompose移行を再現できるのか?実プロダクト279件のXMLで探る自動化の境界線
makun
0
450
まだ間に合う!今年の夏こそSchemeのマクロ展開器を完全理解!
omasanori
0
640
「AI時代、配布するPythonコードをどう守るか: 難読化の実験と判断軸」 #PyconJP2026
pkshadeck
PRO
2
180
AI時代に学ぶ 好きなルール 嫌いなルール Linter編
shorty5121
0
890
AWS Step Functions 大規模並列の壁を越える / jaws-sonic-2026-niigata-step-functions
kasacchiful
PRO
1
420
Featured
See All Featured
From π to Pie charts
rasagy
0
360
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
Git: the NoSQL Database
bkeepers
PRO
432
67k
The Invisible Side of Design
smashingmag
301
52k
Abbi's Birthday
coloredviolet
3
9.9k
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
520
Money Talks: Using Revenue to Get Sh*t Done
nikkihalliwell
0
490
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Tell your own story through comics
letsgokoyo
1
1.1k
How to train your dragon (web standard)
notwaldorf
97
6.8k
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
450
First, design no harm
axbom
PRO
2
1.3k
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