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.3k
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.8k
@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
430
ブロックチェーンアプリのトランザクションに対するデータ分析 / PyCon-JP-2019
odanado
0
470
スマートコントラクトに対する既知の攻撃とその対策 / bc.tokyo-21
odanado
0
300
最近のweb3.js事情 / bc.tokyo-19
odanado
2
590
YAPC::Tokyo 2019に スタッフ参加してみて / kichijojipm-18
odanado
1
2.4k
Other Decks in Programming
See All in Programming
contenteditable と日本語入力に向き合う
colorful12
0
230
Compiling a real-world CLI tool to native with Static Hermes
tmikov2023
0
140
Event is what happens
moro
2
2.2k
動画プレイヤーはなぜカクつくのか 〜Flutterのレンダリングとネイティブの境界を解剖する〜
naruogram
0
310
AIがコードを書いてくれる時代、我々は何を確かめるのか
yosuke_furukawa
PRO
13
5.3k
Modernizing iOS Apps
seyfoyun
0
140
[Dev Group Paris Octobre 26] Agentforce, SIforce, Claudeforce, Slackbot… on s'y retrouve ?
nabondance
0
120
Spec-driven Development with AI
simas
PRO
0
2.2k
オーケストレーション記述言語 Katari
yukikurage
0
210
Kotlinize Is Not Just Converting to Kotlin
chigichan24
1
200
AI時代のFlutter品質設計 — アプリ品質を守るQuality Layers
omatty198
0
320
AIが生成したコードは読むべきか?抽象化設計とコードの品質保証 / abstraction-design-and-quality
minodriven
12
7.7k
Featured
See All Featured
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.4k
Leading Effective Engineering Teams in the AI Era
addyosmani
9
2.8k
HU Berlin: Industrial-Strength Natural Language Processing with spaCy and Prodigy
inesmontani
PRO
0
780
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
550
Google's AI Overviews - The New Search
badams
0
1.6k
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
590
Making the Leap to Tech Lead
cromwellryan
135
10k
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
12k
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
750
Designing for humans not robots
tammielis
254
26k
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