minneͷΞϓϦέʔγϣϯߏ֓ཁ
browser
mobile
app
Web UI
Rails
Next.js
Rails API
ϞϊϦεߏͳRails
※ਤ্Rails͕̎ͭ͋ΔΑ͏ʹݟ͑·͕͢ɺͦΕ૾Ͱ͋Γɺ࣮ࡍ1ϦϙδτϦͰಉ͡ίʔυͰ͢ɻ
WEB UIͷϨϯμϦϯάͱɺAPIͷෛՙɺτϥϑΟοΫ͕ҟͳΔͨΊɺϦιʔε͍ͯ͠·͢ɻ
Slide 9
Slide 9 text
minneͷγεςϜߏ֓ཁ
ΦϯϓϨϛεͱAWSͷϚϧνΫϥυߏ
on premises AWS
NKE(k8s)
OpenStack
Web Web API API
EKS(k8s)
EC2
Batch
Direct
Connect
RDS
Elastic
xxx
ѹతͳίετ͕ͩɺ
ϓϥοτϑΥʔϜͷཧίετ͕͋Δ
ίετֻ͔Δ͕ɺσʔλετΞͷ
ϚωʔδυɾαʔϏεͳͲӡ༻ෛՙܰݮ
Web API
https://
fi
nance.yahoo.co.jpΑΓҾ༻
ݮΓଓ͚Δۚ
Կͯ͠ͳ͍ͷʹ
རӹݮͬͨΜͰ͚͢Ͳɾɾɾʁ
Slide 13
Slide 13 text
???????????????????????????
Slide 14
Slide 14 text
!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?
Slide 15
Slide 15 text
͍ͭ͜ɺN+5000͡ΌͶ͔͐ʂʂʂ
Slide 16
Slide 16 text
ͲͷΑ͏ʹ
վળ͔ͨ͠
Slide 17
Slide 17 text
ͲͷΑ͏ʹվળ͔ͨ͠ʁ
query {
orders {
id
customer {
name
}
}
}
select * from orders;
select * from customers where customers_id = 1;
select * from customers where customers_id = 2;
select * from customers where customers_id = 3;
…
select * from customers where customers_id = 5000;
GraphQLͰΑ͋͘ΔN+1ͳΫΤϦ
Slide 18
Slide 18 text
ͲͷΑ͏ʹվળ͔ͨ͠ʁ
• lookaheadΛར༻͢Δ
• όονϩʔυΛར༻͢Δ
• Shopify/graphql-batch
• GraphQL::Dataloader
select * from orders;
select * from … where customers_id in(1, 2…5000);
select * from orders;
select * from customers where customers_id = 1;
select * from customers where customers_id = 2;
select * from customers where customers_id = 3;
…
select * from customers where customers_id = 5000;
Ͳ͜ΛԆ࣮ߦͤ͞Δ͔ʁ
ID͚ͩઌʹूΊͱ͍ͯɺ
ΫΤϦ͋ͱ͔ΒԆ࣮ߦͯ͠
·ͱΊ͍ͯ͛ͨ
in۟ʹ5000Ҿ͢ͳॾઆ͋Δ
select * from orders;
select * from … where customers_id in(1, 2…5000);
ActiveRecord::Associations::PreloaderͰ
in۟ʹ·ͱΊΒΕΔ
Slide 27
Slide 27 text
࣮ફ/ղফ
Slide 28
Slide 28 text
Πϯελϯεϝιου
query {
orders {
id
customer {
name
isLoyal
}
}
}
select 1 As one from sales where customers_id = 1;
select 1 As one from sales where customers_id = 2;
select 1 As one from sales where customers_id = 3;
…
ഁ໓ϩυϦήεʂʂʂʂʂ