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
Java 27新機能 / Java 27 new features
kishida
2
190
Embedded Swiftで作る自作USBデバイス によるiOSデバイスの自動テスト / iOSDC Japan 2026 glassfiber
glassfiber
0
280
スマートフォンでモールス信号を送受信する 〜スマートフォンのLEDとカメラで作る光通信の設計と実装〜
atsuki_seo
0
230
モジュールの視点からSwiftを読み解く #iosdc
s_shimotori
0
310
IBM Bob Dojo #1 仕様駆動開発入門
oniak3ibm
PRO
0
330
AI が書く Go コードの品質を劇的に向上させる Linter: “declscope”
mpyw
0
480
すこし踏み込む CancellationToken
htkym
2
1.6k
AHC070解法紹介
eijirou
0
150
iOS 27でニュースアプリはどう変わる!? 〜日経電子版の新機能対応と、開発事例から〜
lynnswap
7
13k
AWS CDKのカスタムリソースでContinuum(旧Security Agent)を実装した話 | Implementing Continuum (formerly Security Agent) via AWS CDK Custom Resource
akihisaikeda
2
120
Are APIs Still Relevant in the AI Era?
soyuka
0
410
iOSDC2026登壇資料.pdf
riofujimon
0
200
Featured
See All Featured
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
1
410
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.5k
Designing for Timeless Needs
cassininazir
1
520
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.6k
Navigating Team Friction
lara
192
16k
GraphQLとの向き合い方2022年版
quramy
50
15k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.9k
Code Reviewing Like a Champion
maltzj
528
40k
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
4.4k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
Imperfection Machines: The Place of Print at Facebook
scottboms
270
14k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
203
76k
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