$30 off During Our Annual Pro Sale. View Details »
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
200万ドメインを超えるレンタルサーバのコンテンツキャッシュ機能の裏側/2_million_m...
Search
Takuma Kume
July 29, 2018
Technology
9
3.1k
200万ドメインを超えるレンタルサーバのコンテンツキャッシュ機能の裏側/2_million_more_than_the_domain_the_back_of_the_rental_server_content_cache
July Tech Festa 2018 (
https://2018.techfesta.jp/
)
Takuma Kume
July 29, 2018
Tweet
Share
More Decks by Takuma Kume
See All by Takuma Kume
SRE/インフラエンジニアの市場価値とキャリアパス/Market value and career path for SRE-infrastructure engineers
takumakume
2
1.1k
【新卒研修】共通言語としてのSRE/SRE as a common language
takumakume
0
190
DDoSとの終わりなき戦い2025/endless_battle_with_ddos_attack_2025
takumakume
3
130
事業部CTOの現在地(パネルディスカッション)/Current-location-of-Division-CTO
takumakume
0
150
ロリポップ! for Gamersを支えるインフラ/lolipop for gamers infrastructure
takumakume
0
1.1k
ロリポップ! for Gamersの立ち上げ/lolipop for gamers launch
takumakume
0
2.6k
ホモグラフドメインを検出してみた/detect homograph domain
takumakume
0
650
ソフトウェアの継続的アップデートをコンテナ化によって加速させる/Accelerate continuous software updates with containerization
takumakume
0
5.3k
KubernetesにおけるSBOMを利用した脆弱性管理/Vulnerability_Management_with_SBOM_in_Kubernetes
takumakume
2
2.7k
Other Decks in Technology
See All in Technology
段階的に進める、 挫折しない自宅サーバ入門
yu_kod
4
1.8k
20251127 BigQueryリモート関数で作る、お手軽AIバッチ実行環境
daimatz
0
340
Introduction to Sansan, inc / Sansan Global Development Center, Inc.
sansan33
PRO
0
2.9k
AWS re:Invent 2025 で頻出の 生成 AI サービスをおさらい
komakichi
3
260
Pandocでmd→pptx便利すぎワロタwww
meow_noisy
2
1k
機械学習を「社会実装」するということ 2025年冬版 / Social Implementation of Machine Learning November 2025 Version
moepy_stats
4
890
その意思決定、まだ続けるんですか? ~痛みを超えて未来を作る、AI時代の撤退とピボットの技術~
applism118
45
24k
経営から紐解くデータマネジメント
pacocat
8
1.7k
小規模チームによる衛星管制システムの開発とスケーラビリティの実現
sankichi92
0
160
【保存版】「ガチャ」からの脱却:Gemini × Veoで作る、意図を反映するAI動画制作ワークフロー
nekoailab
0
120
事業状況で変化する最適解。進化し続ける開発組織とアーキテクチャ
caddi_eng
1
8.9k
Active Directory 勉強会 第 6 回目 Active Directory セキュリティについて学ぶ回
eurekaberry
10
4k
Featured
See All Featured
Docker and Python
trallard
46
3.7k
Balancing Empowerment & Direction
lara
5
770
RailsConf 2023
tenderlove
30
1.3k
YesSQL, Process and Tooling at Scale
rocio
174
15k
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
Producing Creativity
orderedlist
PRO
348
40k
Building Adaptive Systems
keathley
44
2.8k
Fireside Chat
paigeccino
41
3.7k
KATA
mclloyd
PRO
32
15k
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
350
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
2.6k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
48
9.8k
Transcript
!UBLVNBLVNF(.01FQBCP *OD +VMZ5FDI'FTUB ສυϝΠϯΛ͑ΔϨϯλϧαʔόͷ ίϯςϯπΩϟογϡػೳͷཪଆ
(.0ϖύϘϗεςΟϯάࣄۀ෦ ΠϯϑϥΤϯδχΞ ٱถഅ!UBLVNBLVNF
None
ֹ݄ԁ͔Βར༻Ͱ͖Δʂ
ֹ݄ԁ͔Βར༻Ͱ͖Δʂ ඵؒສઍϦΫΤετΛॲཧʂ
ֹ݄ԁ͔Βར༻Ͱ͖Δʂ ສαΠτҎ্ӡ༻தʂ ඵؒສઍϦΫΤετΛॲཧʂ
None
ίϯςϯπΩϟογϡػೳ 3FWFSTF1SPYZ 8FSWFS ௨ৗ
ίϯςϯπΩϟογϡػೳ 3FWFSTF1SPYZ 8FSWFS 3FWFSTF1SPYZ $BDIF4FSWFS 8FSWFS Ωϟογϡ ίϯςϯπΩϟογϡ͋Γ
ίϯςϯπΩϟογϡػೳ 3FWFSTF1SPYZ $BDIF4FSWFS 8FSWFS Ωϟογϡ ίϯςϯπΩϟογϡ͋Γ 8FSWFSͷલஈͰΩϟογϡͯ͠ ߴʹԠ͢Δɻ
ίϯςϯπΩϟογϡػೳ 3FWFSTF1SPYZ $BDIF4FSWFS 8FSWFS Ωϟογϡ ίϯςϯπΩϟογϡ͋Γ OHJOY IUUQE ύϑΥʔϚϯεͷߴ͍OHJOYͰϦΫΤετ Λॲཧ͢Δɻ
8FSWFSͷલஈͰΩϟογϡͯ͠ ߴʹԠ͢Δɻ
ίϯςϯπΩϟογϡػೳ 3FWFSTF1SPYZ $BDIF4FSWFS 8FSWFS Ωϟογϡ ίϯςϯπΩϟογϡ͋Γ OHJOY IUUQE ύϑΥʔϚϯεͷߴ͍OHJOYͰϦΫΤετ Λॲཧ͢Δɻ
1)1ͷॲཧͰߴෛՙʹͳΓ͍͢ 8&#αʔόͷෛՙݮ 8FSWFSͷલஈͰΩϟογϡͯ͠ ߴʹԠ͢Δɻ
ฒྻສϦΫΤετ #FODI.BSLFS "QBDIF#FODI 3FWFSTF1SPYZ 8FSWFS 3FWFSTF1SPYZ $BDIF4FSWFS 8FSWFS Ωϟογϡ 8PSE1SFTTαΠτ
8PSE1SFTTαΠτ
3FWFSTF1SPYZ 8FSWFS 3FWFSTF1SPYZ $BDIF4FSWFS 8FSWFS Ωϟογϡ 8PSE1SFTTαΠτ 8PSE1SFTTαΠτ ύϑΥʔϚϯεഒʂ
3FWFSTF1SPYZ 8FSWFS 3FWFSTF1SPYZ $BDIF4FSWFS 8FSWFS Ωϟογϡ 8PSE1SFTTαΠτ 8PSE1SFTTαΠτ ύϑΥʔϚϯεഒʂ ແྉఏڙ
ͳͥ࡞ͬͨͷ͔ʁ
ࠃ࠷ Ϩϯαό ࠷
ੈͷதʹଟ͘ͷ $%/ࣄۀऀ͕ଘࡏ͢Δ ίϯςϯπΩϟογϡͱ͍͑$%/
ϩϦϙοϓʂͰ֎෦$%/αʔϏε͏ *OUFSOFU 3FWFSTF1SPYZ $BDIF4FSWFS 8FSWFS $%/ࣄۀऀ%$ ΞΫηε ϩϦϙοϓʂ
*OUFSOFU 3FWFSTF1SPYZ $BDIF4FSWFS 8FSWFS $%/ࣄۀऀ%$ ΞΫηε ΦϦδϯͷαʔόʹΞΫηε Ωϟογϡର֎ͷίϯςϯπ ΩϟογϡظݶΕ ϩϦϙοϓʂ
ϩϦϙοϓʂͰ֎෦$%/αʔϏε͏
*OUFSOFU 3FWFSTF1SPYZ $BDIF4FSWFS 8FSWFS $%/ࣄۀऀ%$ ΞΫηε ϩϦϙοϓʂ ΠϯλʔωοτΛߦ͖དྷ͢Δඞཁ͕͋Δ ϩϦϙοϓʂͰ֎෦$%/αʔϏε͏
ίϯςϯπΩϟογϡػೳͷ߹ *OUFSOFU 3FWFSTF1SPYZ $BDIF4FSWFS 8FSWFS ΞΫηε ϩϦϙοϓʂ
ίϯςϯπΩϟογϡػೳͷ߹ *OUFSOFU 3FWFSTF1SPYZ $BDIF4FSWFS 8FSWFS ΞΫηε ߴ ϩϦϙοϓʂ
$%/োน͕ߴ͍
$%/োน͕ߴ͍ υϝΠϯΛ$%/ʹ͚ΔͨΊͷ%/4ͷઃఆ ͦͦ%/4ͱʁ $%/ػೳ͕ଟ͘ઃఆ͕ෳࡶ ඇΤϯδχΞͷํʹͱ͍ͬͯ͠ αʔϏεʹΑͬͯར༻ྉ͕ۚൃੜ͢Δ ϩϦϙοϓʂΤϯδχΞҎ֎ͷํʑ͔Β ଟ͘͝ར༻͍͍ͯΔ
ίϯςϯπΩϟογϡػೳʁ
None
Άͪͬ
Άͪͬ ଟػೳΑΓ؆୯Λ༏ઌ
͜͜·Ͱͷ͓͞Β͍ ίϯςϯπΩϟογϡػೳΛϦϦʔε ࠃ࠷ϨϯαόΛࢦ͢ʂ ֎෦$%/Λซ༻͢ΔΑΓɺંฦ͠ ͷ௨৴Ͱ݁͢Δɻ ୭Ͱ؆୯ʹઃఆͰ͖Δʂ $%/͕͍͠ͱײ͡Δ͓٬༷Ͱ؆୯ ʹઃఆ͕Մೳɻ
͜͜·Ͱ໘ന͘ͳ͍Ͷʁ
ຊ େنϗεςΟϯάͳΒͰͷ ίϯςϯπΩϟογϡػೳΛ ࢧ͑ΔΠϯϑϥٕज़ʹ͍ͭͯ ͓͠·͢ʂ
ઃܭ લఏ ࣮ ·ͱΊ ຊͷྲྀΕ ίϯςϯπΩϟογϡͷ֓ཁɾ։ൃܦҢ ࠓίί ίϯςϯπΩϟογϡͷػೳͱΠϯϑϥʹٻΊͨ͜ͱ
ઃܭ લఏ ࣮ ·ͱΊ ίϯςϯπΩϟογϡͷػೳͱ ΠϯϑϥʹٻΊͨ͜ͱ
ΩϟογϡϞʔυ
ΩϟογϡϞʔυ 81Ωϟογϡػೳ ੩తΩϟογϡػೳ
81Ωϟογϡػೳ 8PSE1SFTT༻ʹ࠷దԽͨ͠Ωϟογϡػೳ ϩϦϙοϓʂͷ͓٬༷ͷଟ͘8PSE1SFTTΛ ར༻͍ͯ͠Δ ੩తΩϟογϡػೳ ը૾+4 $44ͳͲͷ੩తίϯςϯπΛରʹ ͨ͠Ωϟογϡػೳ 8PSE1SFTTҎ֎Λར༻͍ͯ͠Δํ͚ ҆ఆͨ͠αΠτදࣔʹد༩
ΩϟογϡϞʔυ
ͯ͢ͷίϯςϯπΛΩϟογϡͨ͠߹ɿ 8PSE1SFTTͷϩάΠϯޙͷཧը໘͕Ωϟο γϡ͞Εͨ߹ʹҙਤ͠ͳ͍ใ͕࿙ΕΔ ಠࣗձһ੍8&#ΞϓϦέʔγϣϯͰɺผͷ ձһͷϖʔδ͕ݟ͑ͯ͠·͏ ϚωʔδυͳΩϟογϡػೳΛఏڙ ΩϟογϡϞʔυ ͳͥΩϟογϡϞʔυΛ͚Δඞཁ͕͋Δʁ
υϝΠϯͷઃఆʹԠͨ͡ ػೳͷϋϯυϦϯά
طଘͷߏ 3FWFSTF1SPYZ 8FSWFS *OUFSOFU 8FSWFS 4JUF" 4JUF# 4JUF$ 4JUF% ͓٬༷ͷίϯςϯπ
طଘͷߏ 3FWFSTF1SPYZ 8FSWFS *OUFSOFU 8FSWFS 4JUF" 4JUF# 4JUF$ 4JUF% ͓٬༷ͷίϯςϯπ
ສαΠτ
υϝΠϯͷઃఆʹԠͯ͡ϓϩΩγઌΛมߋ͍ͨ͠ 3FWFSTF1SPYZ 8FSWFS *OUFSOFU 8FSWFS IUUQTTJUFBDPN 4JUF" 4JUF#
4JUF$ 4JUF% ͓٬༷ͷίϯςϯπ $BDIF4FSWFS PS ίϯςϯπΩϟογϡػೳ 0/ʁ0''ʁ
3FWFSTF1SPYZ 8FSWFS *OUFSOFU 8FSWFS IUUQTTJUFBDPN 4JUF" 4JUF# 4JUF$
4JUF% ͓٬༷ͷίϯςϯπ $BDIF4FSWFS PS ΩϟογϡͷϞʔυ 81Ωϟογϡʁ ੩తΩϟογϡʁ υϝΠϯͷઃఆʹԠͯ͡ৼΔ͍Λ੍ޚ͍ͨ͠
εέʔϥϏϦςΟ
εέʔϥϏϦςΟ αʔόΛՃ͚ͨͩ͠Ͱউखʹػೳ͕εέʔϧ ͢ΔΠϯϑϥΞʔΩςΫνϟʹ͍ͨ͠ $BDIF4FSWFS $BDIF4FSWFS $BDIF4FSWFS 3FWFSTF1SPYZ
ߴՄ༻ੑ
ߴՄ༻ੑ αʔόյΕΔ յΕͯશࣗಈͰαʔϏεͷঢ়ଶ͕෮چ͢Δ ΠϯϑϥΞʔΩςΫνϟʹ͍ͨ͠ $BDIF4FSWFS $BDIF4FSWFS $BDIF4FSWFS 3FWFSTF1SPYZ
ޮతͳΩϟογϡ
ޮతͳΩϟογϡ ୯७ʹ$BDIF4FSWFSΛฒͯࢄ͢Δͱ 3FWFSTF1SPYZ $BDIF 4FSWFS $BDIF 4FSWFS $BDIF 4FSWFS $BDIF
4FSWFS $BDIF 4FSWFS $BDIF 4FSWFS 8FSWFS ΩϟογϡώοτԼ σΟεΫྖҬͷফඅ FYBNQMFDPN FYBNQMFDPN
ޮతͳΩϟογϡ υϝΠϯຖʹॲཧ͢Δ$BDIF4FSWFSΛݶఆ͍ͨ͠ 3FWFSTF1SPYZ $BDIF 4FSWFS $BDIF 4FSWFS $BDIF 4FSWFS $BDIF
4FSWFS $BDIF 4FSWFS $BDIF 4FSWFS 8FSWFS Ωϟογϡώοτ্ σΟεΫྖҬͷઅ FYBNQMFDPN FYBNQMFDPN
͜͜·Ͱͷ͓͞Β͍ ΩϟογϡϞʔυ 81 ੩తΩϟογϡ υϝΠϯͷઃఆʹԠͨ͡ػೳͷϋϯυϦϯά εέʔϥϏϦςΟ ߴՄ༻ੑ ޮతͳΩϟογϡ ίϯςϯπΩϟογϡͷػೳͱ
ɹɹɹɹɹɹɹɹΠϯϑϥʹٻΊͨ͜ͱ
͜ΕΒΛಉ࣌ʹຬͨ͢ ج൫Λ࣮͢Δඞཁ͕͋Δ
࣮ લఏ ઃܭ ·ͱΊ ίϯςϯπΩϟογϡػೳͷ࣮
͜͜Ͱ#FFS څਫ
ΩϟογϡϞʔυͷ࣮
ΩϟογϡϞʔυͷ࣮ http { : proxy_cache_path /var/cache/nginx/cache levels=1:2 \ keys_zone=zone1:1024m inactive=10m;
proxy_cache_valid 200 10m; proxy_cache_valid 404 1m; server { : proxy_cache zone1; proxy_cache_key $proxy_scheme://$host$ $is_args$args; proxy_pass $proxy_scheme://${Origin Server}; } } OHJOYඪ४ͷOHY@IUUQ@QSPYZ@NPEVMFΛར༻
http { : proxy_cache_path /var/cache/nginx/cache levels=1:2 \ keys_zone=zone1:1024m inactive=10m; proxy_cache_valid
200 10m; proxy_cache_valid 404 1m; server { : proxy_cache zone1; proxy_cache_key $proxy_scheme://$host$request_uri$is_args$args; proxy_pass $proxy_scheme://${Origin Server}; } } OHJOYඪ४ͷOHY@IUUQ@QSPYZ@NPEVMFΛར༻ DBDIFͷอଘઌαΠζɺ༗ޮظؒ ΩϟογϡϞʔυͷ࣮
http { : proxy_cache_path /var/cache/nginx/cache levels=1:2 \ keys_zone=zone1:1024m inactive=10m; proxy_cache_valid
200 10m; proxy_cache_valid 404 1m; server { : proxy_cache zone1; proxy_cache_key $proxy_scheme://$host$request_uri$is_args$args; proxy_pass $proxy_scheme://${Origin Server}; } } OHJOYඪ४ͷOHY@IUUQ@QSPYZ@NPEVMFΛར༻ εςʔλείʔυʹ ΑͬͯอଘظؒΛม͑Δ ΩϟογϡϞʔυͷ࣮
http { : proxy_cache_path /var/cache/nginx/cache levels=1:2 \ keys_zone=zone1:1024m inactive=10m; proxy_cache_valid
200 10m; proxy_cache_valid 404 1m; server { : proxy_cache zone1; proxy_cache_key $proxy_scheme://$host$request_uri$is_args$args; proxy_pass $proxy_scheme://${Origin Server}; } } OHJOYඪ४ͷOHY@IUUQ@QSPYZ@NPEVMFΛར༻ [POFΛͬͯΩϟογϡ͢Δ ΩϟογϡϞʔυͷ࣮
http { : proxy_cache_path /var/cache/nginx/cache levels=1:2 \ keys_zone=zone1:1024m inactive=10m; proxy_cache_valid
200 10m; proxy_cache_valid 404 1m; server { : proxy_cache zone1; proxy_cache_key $proxy_scheme://$host$request_uri$is_args$args; proxy_pass $proxy_scheme://${Origin Server}; } } OHJOYඪ४ͷOHY@IUUQ@QSPYZ@NPEVMFΛར༻ Ωϟογϡͷอଘɾ୳ࡧͷΩʔ ΩϟογϡϞʔυͷ࣮
ΩϟογϡϞʔυͷ࣮ http { : proxy_cache_path /var/cache/nginx/cache levels=1:2 \ keys_zone=zone1:1024m inactive=10m;
proxy_cache_valid 200 10m; proxy_cache_valid 404 1m; server { : proxy_cache zone1; proxy_cache_key $proxy_scheme://$host$request_uri$is_args$args; proxy_pass $proxy_scheme://${Origin Server}; } } OHJOYඪ४ͷOHY@IUUQ@QSPYZ@NPEVMFΛར༻ Ωϟογϡ͕ͳ͍߹ɾ༗ޮظݶΕͷ߹ʹ ΞΫηε͢ΔΦϦδϯαʔό
ΩϟογϡϞʔυͷ࣮ http { : server { : location /login {
proxy_no_cache 1; proxy_cache_bypass 1; } } } OHJOYඪ४ͷOHY@IUUQ@QSPYZ@NPEVMFΛར༻ Ωϟογϡ͠ͳ͍ ΩϟογϡΛ୳ࡧ͠ͳ͍
Ωϟογϡػೳ : location / { : set $do_not_cache 0; if
($http_cookie ~ '(wordpress_|comment_author|wp-postpass)') { set $do_not_cache 1; } proxy_no_cache $do_not_cache; proxy_cache_bypass $do_not_cache; proxy_cache zone1; proxy_cache_key "$proxy_scheme://$host$request_uri$is_args$args"; proxy_pass $proxy_scheme://${Origin Server}; } DPPLJFʹಛఆͷจࣈྻ͕ ͋Δ࣌Ωϟογϡ͠ͳ͍ 81Ωϟογϡػೳͷྫ Ұ෦ ɿ
ͬͯΔ͠ ͋Μ·໘ന͘ͳ͍Ͱ͢ΑͶʂ
Ҏ߱ͰɺϨϯαόʹ͓͚Δ ՝Λόʔϯͱղܾ͢Δ ιϑτΣΞͷΛ ͍͖ͯ͠·͢
υϝΠϯʹԠͨ͡ ػೳͷϋϯυϦϯάͷ࣮
Γ͍ͨ͜ͱ 3FWFSTF1SPYZ 8FSWFS *OUFSOFU 8FSWFS IUUQTTJUFBDPN 4JUF" 4JUF#
4JUF$ 4JUF% ͓٬༷ͷίϯςϯπ $BDIF4FSWFS PS ίϯςϯπΩϟογϡػೳ 0/ʁ0''ʁ ΩϟογϡͷϞʔυ 81Ωϟογϡʁ ੩తΩϟογϡʁ
ͲͷΑ͏ʹ࣮͢Δ͔ʁ
طଘͷߏΛ͏গ͠ৄ͘͠ 3FWFSTF1SPYZ 8FSWFS *OUFSOFU 8FSWFS 4JUF" 4JUF# 4JUF$ 4JUF% ͓٬༷ͷίϯςϯπ
3FWFSTF1SPYZ 8FSWFS *OUFSOFU 8FSWFS 4JUF" 4JUF# 4JUF$ 4JUF% ͓٬༷ͷίϯςϯπ
ඦ طଘͷߏΛ͏গ͠ৄ͘͠
3FWFSTF1SPYZ 8FSWFS *OUFSOFU 8FSWFS 4JUF" 4JUF# 4JUF$ 4JUF% ͓٬༷ͷίϯςϯπ
ສαΠτ طଘͷߏΛ͏গ͠ৄ͘͠
3FWFSTF1SPYZ 8FSWFS *OUFSOFU 8FSWFS 4JUF" 4JUF# 4JUF$ 4JUF% ͓٬༷ͷίϯςϯπ
සൟʹ૿ݮ͢Δ طଘͷߏΛ͏গ͠ৄ͘͠
Ϩϯλϧαʔόͷ߹ 3FWFSTF1SPYZ 8FSWFS *OUFSOFU 8FSWFS 4JUF" 4JUF# 4JUF$ 4JUF%
େྔͷ૿ݮ͢ΔυϝΠϯΛ ͲͷΑ͏ʹϓϩΩγ͍ͯ͠Δ͔ʁ
େྔυϝΠϯͷϓϩΩγ 3FWFSTF1SPYZ 8FSWFS *OUFSOFU 8FSWFS IUUQTTJUFBDPN 4JUF" 4JUF#
4JUF$ 4JUF% ͓٬༷ͷίϯςϯπ ສαΠτҎ্ͷ ϓϩΩγͷઃఆΛ ॻ͘ͷݱ࣮తͰͳ͍
େྔυϝΠϯͷಈతͳϓϩΩγ 3FWFSTF1SPYZ 8FSWFS *OUFSOFU 8FSWFS IUUQTTJUFBDPN 4JUF" 4JUF#
4JUF$ 4JUF% ͓٬༷ͷίϯςϯπ OHJOY OHY@NSVCZ
ฐࣾͷ!NBUTVNPUPSZ͕։ൃ͍ͯ͠Δ OHJOYʹΈࠐΉ͜ͱͰϓϩηεͷىಈ ϦΫΤετͷλΠϛϯάͰNSVCZͷεΫϦ ϓτΛ࣮ߦͰ͖Δ NSVCZΈࠐΈ͚ͷܰྔ3VCZ࣮ OHY@NSVCZ
େྔυϝΠϯͷಈతͳϓϩΩγ 3FWFSTF1SPYZ 8FSWFS *OUFSOFU 8FSWFS IUUQTTJUFBDPN 4JUF" 4JUF#
4JUF$ 4JUF% ͓٬༷ͷίϯςϯπ OHJOY OHY@NSVCZ
େྔυϝΠϯͷಈతͳϓϩΩγ 3FWFSTF1SPYZ 8FSWFS *OUFSOFU 8FSWFS IUUQTTJUFBDPN 4JUF" 4JUF#
4JUF$ 4JUF% ͓٬༷ͷίϯςϯπ υϝΠϯͱ8FSWFSͷඥ͚ͮ σʔλϕʔε υϝΠϯTJUFBDPN αʔό8FSWFS OHJOY OHY@NSVCZ
େྔυϝΠϯͷಈతͳϓϩΩγ 3FWFSTF1SPYZ 8FSWFS *OUFSOFU 8FSWFS IUUQTTJUFBDPN 4JUF" 4JUF#
4JUF$ 4JUF% ͓٬༷ͷίϯςϯπ υϝΠϯͱ8FSWFSͷඥ͚ͮ σʔλϕʔε υϝΠϯTJUFBDPN αʔό8FSWFS OHJOY OHY@NSVCZ NSVCZΛͬͯ ίϯςϯπΩϟογϡػೳͷ ϋϯυϦϯάΛߦ͏ʂ
ػೳͷϋϯυϦϯά 3FWFSTF1SPYZ 8FSWFS *OUFSOFU 8FSWFS IUUQTTJUFBDPN 4JUF" 4JUF#
4JUF$ 4JUF% ͓٬༷ͷίϯςϯπ $BDIF4FSWFS PS ίϯςϯπΩϟογϡػೳ 0/ʁ0''ʁ ΩϟογϡͷϞʔυ 81Ωϟογϡʁ ੩తΩϟογϡʁ ίϯςϯπΩϟογϡػೳ 0/ʁ0''ʁ ΩϟογϡͷϞʔυ 81Ωϟογϡʁ ੩తΩϟογϡʁ 3FWFSTF1SPYZ 8FSWFS $BDIF4FSWFS
ػೳͷϋϯυϦϯά 3FWFSTF1SPYZ 8FSWFS *OUFSOFU 8FSWFS IUUQTTJUFBDPN 4JUF" 4JUF#
4JUF$ 4JUF% ͓٬༷ͷίϯςϯπ $BDIF4FSWFS σʔλϕʔε υϝΠϯTJUFBDPN αʔό8FSWFS ΩϟογϡPO ΩϟογϡλΠϓ81
ػೳͷϋϯυϦϯά 3FWFSTF1SPYZ 8FSWFS *OUFSOFU 8FSWFS IUUQTTJUFBDPN 4JUF" 4JUF#
4JUF$ 4JUF% ͓٬༷ͷίϯςϯπ $BDIF4FSWFS σʔλϕʔε υϝΠϯTJUFBDPN αʔό8FSWFS ΩϟογϡPO ΩϟογϡλΠϓ81 ΩϟογϡͷϞʔυ 81Ωϟογϡʁ ੩తΩϟογϡʁ ΩϟογϡͷϞʔυ 81Ωϟογϡʁ ੩తΩϟογϡʁ
ػೳͷϋϯυϦϯά 3FWFSTF1SPYZ 8FSWFS *OUFSOFU 8FSWFS IUUQTTJUFBDPN 4JUF" 4JUF#
4JUF$ 4JUF% ͓٬༷ͷίϯςϯπ $BDIF4FSWFS σʔλϕʔε ΩϟογϡͷϞʔυ 81PS੩త ʹΑͬͯڍಈΛม͍ͨ Ωϟογϡର֎ ظݶΕͷ߹ʹ ΞΫηε͢Δ ΦϦδϯαʔόͷใ υϝΠϯTJUFBDPN αʔό8FSWFS ΩϟογϡPO ΩϟογϡλΠϓ81
ػೳͷϋϯυϦϯά 3FWFSTF1SPYZ 8FSWFS *OUFSOFU 8FSWFS IUUQTTJUFBDPN 4JUF" 4JUF#
4JUF$ 4JUF% ͓٬༷ͷίϯςϯπ $BDIF4FSWFS σʔλϕʔε OHY@NSVCZ υϝΠϯTJUFBDPN αʔό8FSWFS ΩϟογϡPO ΩϟογϡλΠϓ81
ػೳͷϋϯυϦϯά 3FWFSTF1SPYZ 8FSWFS *OUFSOFU 8FSWFS IUUQTTJUFBDPN 4JUF" 4JUF#
4JUF$ 4JUF% ͓٬༷ͷίϯςϯπ $BDIF4FSWFS σʔλϕʔε υϝΠϯTJUFBDPN αʔό8FSWFS ΩϟογϡPO ΩϟογϡλΠϓ81 OHY@NSVCZ OHY@NSVCZΛ͑ ͬͱεϚʔτʹͰ͖Δ
ػೳͷϋϯυϦϯά 3FWFSTF1SPYZ 8FSWFS *OUFSOFU 8FSWFS IUUQTTJUFBDPN 4JUF" 4JUF#
4JUF$ 4JUF% ͓٬༷ͷίϯςϯπ $BDIF4FSWFS σʔλϕʔε OHY@NSVCZ υϝΠϯTJUFBDPN αʔό8FSWFS ΩϟογϡPO ΩϟογϡλΠϓ81 3FWFSTF1SPYZ σʔλϕʔε υϝΠϯTJUFBDPN αʔό8FSWFS ΩϟογϡPO ΩϟογϡλΠϓ81 %#͔Βऔಘͨ͠σʔλΛ
ػೳͷϋϯυϦϯά 3FWFSTF1SPYZ 8FSWFS *OUFSOFU 8FSWFS IUUQTTJUFBDPN 4JUF" 4JUF#
4JUF$ 4JUF% ͓٬༷ͷίϯςϯπ $BDIF4FSWFS σʔλϕʔε OHY@NSVCZ υϝΠϯTJUFBDPN αʔό8FSWFS ΩϟογϡPO ΩϟογϡλΠϓ81 σʔλϕʔε υϝΠϯTJUFBDPN αʔό8FSWFS ΩϟογϡPO ΩϟογϡλΠϓ81 3FWFSTF1SPYZ $BDIF4FSWFS %#͔Βऔಘͨ͠σʔλΛ NSVCZͰ IUUQϔομʹ ༩ͯ͠ൖ )551ϔομ
ػೳͷϋϯυϦϯά 3FWFSTF1SPYZ OHJOY OHY@NSVCZ 8FSWFS 8FSWFS 4JUF" 4JUF# 4JUF$ 4JUF%
$BDIF4FSWFS IUUQTTJUFBDPN σʔλϕʔε αʔό8FSWFS ΩϟογϡPO ΩϟογϡλΠϓ81
ػೳͷϋϯυϦϯά 3FWFSTF1SPYZ OHJOY OHY@NSVCZ 8FSWFS 8FSWFS 4JUF" 4JUF# 4JUF$ 4JUF%
$BDIF4FSWFS IUUQTTJUFBDPN σʔλϕʔε IUUQϔομΛՃ αʔό8FSWFS ΩϟογϡPO ΩϟογϡλΠϓ81 9-0-*10161453&".8FC4FSWFS 9-0-*101$"$)&5:1&81 h = Nginx::Headers_in.new h['X-LOLIPOP-UPSTREAM'] = 'Web Server1' h['X-LOLIPOP-CACHE-TYPE'] = 'WP' ࣮ࡍ%#͔Βऔಘͨ͠
ػೳͷϋϯυϦϯά 3FWFSTF1SPYZ OHJOY OHY@NSVCZ 8FSWFS 8FSWFS 4JUF" 4JUF# 4JUF$ 4JUF%
$BDIF4FSWFS IUUQTTJUFBDPN σʔλϕʔε αʔό8FSWFS ΩϟογϡPO ΩϟογϡλΠϓ81 9-0-*10161453&".8FC4FSWFS 9-0-*101$"$)&5:1&81 if ($http_x_lolipop_cache_type = "WP") { # WPΩϟογϡػೳͷڍಈ : } IUUQϔομΛՃ IUUQϔομΛͱʹ ΩϟογϡػೳͷڍಈΛมߋ
ػೳͷϋϯυϦϯά 3FWFSTF1SPYZ OHJOY OHY@NSVCZ 8FSWFS 8FSWFS 4JUF" 4JUF# 4JUF$ 4JUF%
$BDIF4FSWFS IUUQTTJUFBDPN σʔλϕʔε IUUQϔομΛͱʹϓϩΩγ αʔό8FSWFS ΩϟογϡPO ΩϟογϡλΠϓ81 9-0-*10161453&".8FC4FSWFS 9-0-*101$"$)&5:1&81 IUUQϔομΛͱʹ ΩϟογϡػೳͷڍಈΛมߋ proxy_pass $proxy_scheme://$http_x_lolipop_upstream; IUUQϔομΛՃ
ػೳͷϋϯυϦϯά 3FWFSTF1SPYZ OHJOY OHY@NSVCZ 8FSWFS 8FSWFS 4JUF" 4JUF# 4JUF$ 4JUF%
$BDIF4FSWFS IUUQTTJUFBDPN σʔλϕʔε IUUQϦΫΤετϔομΛՃ IUUQϦΫΤετϔομΛͱʹϓϩΩγ αʔό8FSWFS ΩϟογϡPO ΩϟογϡλΠϓ81 9-0-*10161453&".8FC4FSWFS 9-0-*101$"$)&5:1&81 IUUQϦΫΤετϔομΛͱ ʹΩϟογϡػೳͷڍಈΛมߋ proxy_pass $proxy_scheme://$http_x_lolipop_upstream; NSVCZͰσʔλϕʔε͔Βऔಘͨ͠ΛIUUQ ϔομʹຒΊࠐΉ $BDIF4FSWFSଆຒΊࠐ·ΕͨIUUQϔομΛ ࢀর͚ͩͰυϝΠϯຖͷৼΔ͍ͷ੍ޚ͕Մೳ IUUQϔομʹΑΔใͷͳͷͰɺ$BDIF 4FSWFS௨ৗͷOHJOYͰΑ͍ͷͰγϯϓϧ
3FWFSTF1SPYZ OHJOY OHY@NSVCZ σʔλϕʔε ϦΫΤετ ύϑΥʔϚϯεେৎʁ
ύϑΥʔϚϯεྼԽΛ࠷খݶʹ ͑ΔςΫχοΫΛ͝հ͠·͢ʂ
Ωϟογϡͷಋೖ
Ωϟογϡͷಋೖ 3FWFSTF1SPYZ .Z42- ϦΫΤετ 3FEJT OHJOY OHY@NSVCZ
Ωϟογϡͷಋೖ 3FWFSTF1SPYZ .Z42- ϦΫΤετ 3FEJT OHJOY OHY@NSVCZ ᶃ ᶃ3FEJT͔ΒใΛऔಘ
Ωϟογϡͷಋೖ 3FWFSTF1SPYZ .Z42- ϦΫΤετ 3FEJT OHJOY OHY@NSVCZ ᶃ ᶄ ᶃ3FEJT͔ΒใΛऔಘ
ᶄᶃͰଘࡏ͠ͳ͚Ε.Z42-͔ΒใΛऔಘ
Ωϟογϡͷಋೖ 3FWFSTF1SPYZ .Z42- ϦΫΤετ 3FEJT OHJOY OHY@NSVCZ ᶃ ᶅ ᶄ
ᶃ3FEJT͔ΒใΛऔಘ ᶄᶃͰଘࡏ͠ͳ͚Ε.Z42-͔ΒใΛऔಘ ᶅᶄͰऔಘͨ͠ใΛ࣍ճϦΫΤετͷͨΊʹ 3FEJTʹॻ͖ࠐΈ
ϖύϘͰɺσʔλετΞΛ ֊Խͯ͠Λ͍͍ײ͡ʹ͢Δ NSCHFNΛެ։͍ͯ͠·͢ ֦ுػߏ 3VCZͰ͍͏HFN
NSVCZNTE MPDBMNFNDBDIF ΠϯϝϞϦ,74 3FEJT .Z42- ॲཧίετ͕͍ॱʹGFUDI ࣍ճҎ߱ͷGFUDIͷͨΊʹΩϟογϡ .VMUJ4UBHF%BUBTUPSF https://github.com/pepabo/mruby-msd NTE͕͍͍ײ͡ʹߴͳσʔλετΞ͔ΒGFUDI͢Δ
NSVCZNTE redis = Msd::Store::Redis.new mysql = Msd::Store::MySQL.new( 'SELECT host FROM
table WHERE domain = ?', 'localhost', 'root', 'password', 'DBName' ) msd = Msd::Client.new msd.configure do |c| c.stores = [redis, mysql] end msd.fetch('site-a.com') # => "Web Server1"
NSVCZNTE redis = Msd::Store::Redis.new mysql = Msd::Store::MySQL.new( 'SELECT host FROM
table WHERE domain = ?', 'localhost', 'root', 'password', 'DBName' ) msd = Msd::Client.new msd.configure do |c| c.stores = [redis, mysql] end msd.fetch('site-a.com') # => "Web Server1" ଓ
NSVCZNTE redis = Msd::Store::Redis.new mysql = Msd::Store::MySQL.new( 'SELECT host FROM
table WHERE domain = ?', 'localhost', 'root', 'password', 'DBName' ) msd = Msd::Client.new msd.configure do |c| c.stores = [redis, mysql] end msd.fetch('site-a.com') # => "Web Server1" ଓ σʔλετΞΛొ
NSVCZNTE redis = Msd::Store::Redis.new mysql = Msd::Store::MySQL.new( 'SELECT host FROM
table WHERE domain = ?', 'localhost', 'root', 'password', 'DBName' ) msd = Msd::Client.new msd.configure do |c| c.stores = [redis, mysql] end msd.fetch('site-a.com') # => "Web Server1" ଓ σʔλετΞΛొ σʔλΛΩϟογϡͭͭ͠GFUDI͢Δ
3FWFSTF1SPYZ OHJOY OHY@NSVCZ .Z42- 3FEJT ϦΫΤετ ϦΫΤετຖʹίωΫγϣϯΛ ுΔͷίετ͕ߴ͍ ίωΫγϣϯ
ίωΫγϣϯͷ͍ճ͠
OHY@NSVCZʹNSVCZͷϑοΫϙΠϯτ͕ଘࡏ͢Δ https://github.com/matsumotory/ngx_mruby/tree/master/docs/directives mruby_init_worker /path/to/init.rb; mruby_init_worker_code " # ίʔυ "; mruby_set
$variable /path/to/variable.rb; mruby_access_handler /path/to/access.rb; mruby_access_handler /path/to/access.rb cache; nginx.conf # Workerϓϩηεىಈ࣌ # cacheΦϓγϣϯΛ͚ͭΔͱnginxىಈ࣌ʹmrubyΛόΠτίʔυ # _code ͷσΟϨΫςΟϒΠϯϥΠϯͰmrubyͷίʔυΛهड़Ͱ͖Δ # mrubyͷ࣮ߦ݁ՌΛnginxͷมʹ֨ೲ͢Δ # ϦΫΤετ։࢝࣌ʹ࣮ߦ͞ΕΔ
OHY@NSVCZʹNSVCZͷϑοΫϙΠϯτ͕ଘࡏ͢Δ https://github.com/matsumotory/ngx_mruby/tree/master/docs/directives mruby_init_worker /path/to/init.rb; mruby_init_worker_code " # ίʔυ "; mruby_set
$variable /path/to/variable.rb; mruby_access_handler /path/to/access.rb; mruby_access_handler /path/to/access.rb cache; nginx.conf # Workerϓϩηεىಈ࣌ # cacheΦϓγϣϯΛ͚ͭΔͱnginxىಈ࣌ʹmrubyΛόΠτίʔυ # _code ͷσΟϨΫςΟϒΠϯϥΠϯͰmrubyͷίʔυΛهड़Ͱ͖Δ # mrubyͷ࣮ߦ݁ՌΛnginxͷมʹ֨ೲ͢Δ # ϦΫΤετ։࢝࣌ʹ࣮ߦ͞ΕΔ
OHY@NSVCZʹNSVCZͷϑοΫϙΠϯτ͕ଘࡏ͢Δ https://github.com/matsumotory/ngx_mruby/tree/master/docs/directives mruby_init_worker /path/to/init.rb; mruby_init_worker_code " # ίʔυ "; mruby_set
$variable /path/to/variable.rb; mruby_access_handler /path/to/access.rb; mruby_access_handler /path/to/access.rb cache; nginx.conf # Workerϓϩηεىಈ࣌ # cacheΦϓγϣϯΛ͚ͭΔͱnginxىಈ࣌ʹmrubyΛόΠτίʔυ # _code ͷσΟϨΫςΟϒΠϯϥΠϯͰmrubyͷίʔυΛهड़Ͱ͖Δ # mrubyͷ࣮ߦ݁ՌΛnginxͷมʹ֨ೲ͢Δ # ϦΫΤετ։࢝࣌ʹ࣮ߦ͞ΕΔ
OHY@NSVCZʹNSVCZͷϑοΫϙΠϯτ͕ଘࡏ͢Δ https://github.com/matsumotory/ngx_mruby/tree/master/docs/directives mruby_init_worker /path/to/init.rb; mruby_init_worker_code " # ίʔυ "; mruby_set
$variable /path/to/variable.rb; mruby_access_handler /path/to/access.rb; mruby_access_handler /path/to/access.rb cache; nginx.conf # Workerϓϩηεىಈ࣌ # cacheΦϓγϣϯΛ͚ͭΔͱnginxىಈ࣌ʹmrubyΛόΠτίʔυ # _code ͷσΟϨΫςΟϒΠϯϥΠϯͰmrubyͷίʔυΛهड़Ͱ͖Δ # mrubyͷ࣮ߦ݁ՌΛnginxͷมʹ֨ೲ͢Δ # ϦΫΤετ։࢝࣌ʹ࣮ߦ͞ΕΔ
OHY@NSVCZʹNSVCZͷϑοΫϙΠϯτ͕ଘࡏ͢Δ https://github.com/matsumotory/ngx_mruby/tree/master/docs/directives mruby_init_worker /path/to/init.rb; mruby_init_worker_code " # ίʔυ "; mruby_set
$variable /path/to/variable.rb; mruby_access_handler /path/to/access.rb; mruby_access_handler /path/to/access.rb cache; nginx.conf # Workerϓϩηεىಈ࣌ # cacheΦϓγϣϯΛ͚ͭΔͱnginxىಈ࣌ʹmrubyΛόΠτίʔυ # _code ͷσΟϨΫςΟϒΠϯϥΠϯͰmrubyͷίʔυΛهड़Ͱ͖Δ # mrubyͷ࣮ߦ݁ՌΛnginxͷมʹ֨ೲ͢Δ # ϦΫΤετ։࢝࣌ʹ࣮ߦ͞ΕΔ
ίωΫγϣϯΛ͍ճ͢ https://github.com/matsumotory/ngx_mruby/tree/master/docs/directives mruby_init_worker /path/to/init.rb; mruby_init_worker_code " # ίʔυ "; mruby_set
$variable /path/to/variable.rb; mruby_access_handler /path/to/access.rb; mruby_access_handler /path/to/access.rb cache; nginx.conf # Workerϓϩηεىಈ࣌ # cacheΦϓγϣϯΛ͚ͭΔͱnginxىಈ࣌ʹmrubyΛόΠτίʔυ # _code ͷσΟϨΫςΟϒΠϯϥΠϯͰmrubyͷίʔυΛهड़Ͱ͖Δ # mrubyͷ࣮ߦ݁ՌΛnginxͷมʹ֨ೲ͢Δ # ϦΫΤετ։࢝࣌ʹ࣮ߦ͞ΕΔ mruby_init_worker /path/to/init.rb; # Workerϓϩηεىಈ࣌ # ϦΫΤετ։࢝࣌ʹ࣮ߦ͞ΕΔ mruby_access_handler /path/to/access.rb;
OHJOY 3FEJT 8PSLFSىಈ࣌ʹ3FEJTͱଓ͠ίωΫγϣϯΛอଘ͢Δ
OHJOY XPSLFS 3FEJT ίωΫγϣϯ 8PSLFSىಈ࣌ʹ3FEJTͱଓ͠ίωΫγϣϯΛอଘ͢Δ 8PSLFSϓϩηεͷ ىಈ
OHJOY XPSLFS 3FEJT mruby_init_worker_code " Userdata.new.redis = Redis.new('127.0.0.1', 6379) ";
ίωΫγϣϯ 8PSLFSىಈ࣌ʹ3FEJTͱଓ͠ίωΫγϣϯΛอଘ͢Δ 8PSLFSϓϩηεͷ ىಈ NSVCZVTFSEBUBͱ͍͏NSCHFNΛͬͯɺNSVCZεΫϦϓτ͔Βࢀর Ͱ͖ͳ͍NSVCZͷάϩʔόϧมʹ3FEJTͷίωΫγϣϯΛ֨ೲ ൺֱత҆શʹάϩʔόϧมʹΦϒδΣΫτΛ֨ೲͰ͖Δ
OHJOY XPSLFS 3FEJT 8PSLFSىಈ࣌ʹଓͨ͠3FEJTͷίωΫγϣϯΛ͏
OHJOY XPSLFS 3FEJT 8PSLFSىಈ࣌ʹଓͨ͠3FEJTͷίωΫγϣϯΛ͏ ϦΫΤετ ΞΫηε mruby_access_handler_code " Userdata.new.redis.get('hoge') ";
OHJOY XPSLFS 3FEJT 8PSLFSىಈ࣌ʹଓͨ͠3FEJTͷίωΫγϣϯΛ͏ ϦΫΤετ ΞΫηε mruby_access_handler_code " Userdata.new.redis.get('hoge') ";
8PSLFSىಈ࣌ʹଓͨ͠ίωΫγϣϯΛऔΓग़ͯ͠ɺར༻͢Δɻ NSVCZͷΠϯλϓϦλ͕8PSLFSͰ͍ճ͞Ε͍ͯΔͨΊΞΫηε͕Մೳ ͦͷͨΊɺผͷ8PSLFS͔ΒผͷΠϯλϓϦλͳͷͰࢀরͰ͖ͳ͍
OHJOY XPSLFS 3FEJT 8PSLFSىಈ࣌ʹଓͨ͠3FEJTͷίωΫγϣϯΛ͏ ϦΫΤετ ΞΫηε mruby_access_handler_code " Userdata.new.redis.get('hoge') ";
ίωΫγϣϯΛுͬͨޙʹ3FEJT͕࠶ىಈ͞ΕΔͳͲɺ ίωΫγϣϯ͕அ͞ΕΔ͜ͱΛఆͯ͠࠶ଓॲཧͷ࣮ඞཁɻ NSVCZNTE࣮ࡁΈ
εέʔϥϏϦςΟ ߴՄ༻ੑ
εέʔϥϏϦςΟ ߴՄ༻ੑ ໘ͳखॱͳ͘؆୯ɺࣗಈʹ
3FWFSTF1SPYZ $BDIF 4FSWFS $BDIF 4FSWFS $BDIF 4FSWFS $BDIF 4FSWFS $BDIF
4FSWFS $BDIF 4FSWFS ϓϩΩγ͕ਖ਼ৗͳαʔόΛೝࣝͯ͠ ಈతʹϓϩΩγઌΛܾΊΔ
$POTVM OHY@NSVCZ CZ)BTIJ$PSQ
)BTIJ$PSQ͕։ൃ͍ͯ͠ΔιϑτΣΞ ػೳɿ αʔϏεσ ΟεΧόϦ ϔϧενΣοΫ ͳͲͳͲ DPOTVM
DPOTVMͷΠϕϯτʹൃՐͯ͠ɺ༧Ί༻ҙ͠ ͨςϯϓϨʔτΛͬͯϑΝΠϧΛੜͰ ͖Δɻ αʔόͷ૿ݮ ϔϧενΣοΫͷ݁Ռ DPOTVMUFNQMBUF
$POTVMΛ͏ͱͲ͏ͳΔʁ
3FWFSTF1SPYZ DPOTVM DPOTVM DBDIFTFSWFS DPOTVM DBDIFTFSWFS $POTVMΛ͏ͱͲ͏ͳΔʁ
3FWFSTF1SPYZ DPOTVM DPOTVM DBDIFTFSWFS DPOTVM DBDIFTFSWFS TFSWJDFDBDIFTFSWFS $POTVMͰTFSJWDFΛఆٛ ϔϧενΣοΫ TFSWJDFΛఆٛͯ͠ϔϧενΣοΫ͕Ͱ͖Δ
{ "service": { "name": "cache-server", "checks": [ { "script": "ϔϧενΣοΫίϚϯυ", } ] } }
3FWFSTF1SPYZ DPOTVM DPOTVM DBDIFTFSWFS DPOTVM DBDIFTFSWFS # curl -s http://localhost:8500/v1/health/service/
\ cache-server | jq '.[].Node.Node' "cache-server-1" "cache-server-2" TFSWJDFDBDIFTFSWFS ϔϧενΣοΫ DPOTVM"1*ʹΞΫηε͢ΔͱαʔϏεʹଐ͢Δ ϊʔυΛಘΔ͜ͱ͕Ͱ͖Δɻ ϔϧενΣοΫ݁ՌಘΔ͜ͱ͕Ͱ͖Δɻ αʔϏεʹଐ͢ΔϊʔυͷҰཡϔϧενΣοΫ݁ՌΛಘΒΕΔ
DPOTVMUFNQMBUFΛͬͯɺ ಈతʹϑΝΠϧΛੜ͢Δ
3FWFSTF1SPYZ OHJOY XJUIOHY@NSVCZ DPOTVM DPOTVM DBDIFTFSWFS DPOTVM DBDIFTFSWFS TFSWJDFDBDIFTFSWFS DPOTVMUFNQMBUFΛͬͯɺಈతʹϑΝΠϧΛੜ͢Δ
DPOTVMUFNQMBUF
3FWFSTF1SPYZ OHJOY XJUIOHY@NSVCZ DPOTVM DPOTVM DBDIFTFSWFS DPOTVM DBDIFTFSWFS TFSWJDFDBDIFTFSWFS DPOTVMUFNQMBUF
{{ range service "cache-server|passing" }} - {{ .Address }} {{ end }} servers.yml.ctmpl DPOTVMUFNQMBUFΛͬͯɺಈతʹϑΝΠϧΛੜ͢Δ ϩʔυ ςϯϓϨʔτϑΝΠϧ
3FWFSTF1SPYZ OHJOY XJUIOHY@NSVCZ DPOTVM DPOTVM DBDIFTFSWFS DPOTVM DBDIFTFSWFS TFSWJDFDBDIFTFSWFS DPOTVMUFNQMBUF
{{ range service "cache-server|passing" }} - {{ .Address }} {{ end }} servers.yml.ctmpl TFSWJDF ϔϧενΣοΫঢ়ଶ OPEFͷ*1ΞυϨε DPOTVMUFNQMBUFΛͬͯɺಈతʹϑΝΠϧΛੜ͢Δ ϩʔυ ςϯϓϨʔτϑΝΠϧ
3FWFSTF1SPYZ OHJOY XJUIOHY@NSVCZ DPOTVM DPOTVM DBDIFTFSWFS DPOTVM DBDIFTFSWFS TFSWJDFDBDIFTFSWFS DPOTVMUFNQMBUF
{{ range service "cache-server|passing" }} - {{ .Address }} {{ end }} - cache-server-1ͷIPΞυϨε - cache-server-2ͷIPΞυϨε servers.yml.ctmpl servers.yml DPOTVMUFNQMBUFΛͬͯɺಈతʹϑΝΠϧΛੜ͢Δ ϩʔυ औಘ ੜ ςϯϓϨʔτϑΝΠϧ
3FWFSTF1SPYZ OHJOY XJUIOHY@NSVCZ DPOTVM DPOTVM DBDIFTFSWFS DPOTVM DBDIFTFSWFS TFSWJDFDBDIFTFSWFS DPOTVMUFNQMBUF
{{ range service "cache-server|passing" }} - {{ .Address }} {{ end }} - cache-server-1ͷIPΞυϨε - cache-server-2ͷIPΞυϨε - cache-server-3ͷIPΞυϨε servers.yml.ctmpl servers.yml αʔόΛ૿ઃͨ͠ͱ͖ DPOTVM DBDIFTFSWFS ςϯϓϨʔτϑΝΠϧ
3FWFSTF1SPYZ OHJOY XJUIOHY@NSVCZ DPOTVM DPOTVM DBDIFTFSWFS DPOTVM DBDIFTFSWFS TFSWJDFDBDIFTFSWFS DPOTVMUFNQMBUF
{{ range service "cache-server|passing" }} - {{ .Address }} {{ end }} - cache-server-1ͷIPΞυϨε - cache-server-2ͷIPΞυϨε servers.yml.ctmpl servers.yml αʔό͕μϯͨ͠ͱ͖ ϔϧενΣοΫ ςϯϓϨʔτϑΝΠϧ
αʔόͷ૿ݮ࣌ʹ ਖ਼ৗͳαʔόҰཡΛ ಈతੜ͢Δ͜ͱ͕Ͱ͖ͨʂ
NSVCZΛΈ߹ͤͯ ಈతʹઃఆΛಡΈࠐΉ
3FWFSTF1SPYZ OHJOY XJUIOHY@NSVCZ DPOTVM DPOTVM DBDIFTFSWFS DPOTVM DBDIFTFSWFS TFSWJDFDBDIFTFSWFS NSVCZΛΈ߹ͤͯಈతʹઃఆΛಡΈࠐΉ
DPOTVMUFNQMBUF mruby_init_worker_code " servers = YAML.load( File.open('servers.yml').read ) Userdata.new.servers = servers "; nginx.conf DPOTVM DBDIFTFSWFS
3FWFSTF1SPYZ OHJOY XJUIOHY@NSVCZ DPOTVM DPOTVM DBDIFTFSWFS DPOTVM DBDIFTFSWFS TFSWJDFDBDIFTFSWFS DPOTVMUFNQMBUF
mruby_init_worker_code " servers = YAML.load( File.open('servers.yml').read ) Userdata.new.servers = servers "; nginx.conf DPOTVM DBDIFTFSWFS XPSLFSϓϩηεىಈ࣌ʹ ੜ͞Εͨ:".-Λϩʔυ *1ΞυϨεͷྻΛอଘ NSVCZΛΈ߹ͤͯಈతʹઃఆΛಡΈࠐΉ
3FWFSTF1SPYZ OHJOY XJUIOHY@NSVCZ DPOTVM DPOTVM DBDIFTFSWFS DPOTVM DBDIFTFSWFS TFSWJDFDBDIFTFSWFS DPOTVMUFNQMBUF
mruby_init_worker_code " servers = YAML.load( File.open('servers.yml').read ) Userdata.new.servers = servers "; nginx.conf DPOTVM DBDIFTFSWFS XPSLFSϓϩηεىಈ࣌ʹ ੜ͞Εͨ:".-Λϩʔυ *1ΞυϨεͷྻΛอଘ DPOTVMUFNQMBUFͰϑΝΠϧੜޙʹOHJOYSFMPBEΛ࣮ࢪͯ͠ϩʔυ͢Δʂ OHJOY SFMPBE NSVCZΛΈ߹ͤͯಈతʹઃఆΛಡΈࠐΉ
NSVCZͷੈքʹϓϩΩγઌͷ αʔόҰཡΛ͢͜ͱ͕Ͱ͖ͨʂ
NSVCZͰಈతʹ6QTUSFBNΛ ܾఆ͢Δ
NSVCZͰಈతʹ6QTUSFBNΛܾఆ͢Δ 3FWFSTF1SPYZ DBDIFTFSWFS DBDIFTFSWFS DBDIFTFSWFS 8FC4FSWFS ίϯςϯπΩϟογϡػೳແޮ࣌
NSVCZͰಈతʹ6QTUSFBNΛܾఆ͢Δ 3FWFSTF1SPYZ DBDIFTFSWFS DBDIFTFSWFS DBDIFTFSWFS 8FC4FSWFS ίϯςϯπΩϟογϡػೳ༗ޮ࣌ ͲΕ͔̍
NSVCZΛΈ߹ͤͯಈతʹઃఆΛಡΈࠐΉ upstream dynamic_cache_server { server 127.0.0.1:80; mruby_upstream_keepalive 64; } mruby_set_code
$upstream " : if result.enable_contents_cache? servers = Userdata.new.servers port = Nginx::Connection.new.local_port index = SecureRandom.random_number(servers.size) upstream = Nginx::Upstream.new("dynamic_cache_server") upstream.server = "#{servers[index]}:#{port}" "dynamic_cache_server" else result.upstream end "; proxy_pass $upstream; # DB͔Βऔಘͨ͠ίϯςϯπΩϟογϡػೳͷར༻༗ແ # DB͔Βऔಘͨ͠υϝΠϯʹඥͮ͘Web Server nginx.conf
NSVCZΛΈ߹ͤͯಈతʹઃఆΛಡΈࠐΉ upstream dynamic_cache_server { server 127.0.0.1:80; mruby_upstream_keepalive 64; } mruby_set_code
$upstream " : if result.enable_contents_cache? servers = Userdata.new.servers port = Nginx::Connection.new.local_port index = SecureRandom.random_number(servers.size) upstream = Nginx::Upstream.new("dynamic_cache_server") upstream.server = "#{servers[index]}:#{port}" "dynamic_cache_server" else result.upstream end "; proxy_pass $upstream; # DB͔Βऔಘͨ͠ίϯςϯπΩϟογϡػೳͷར༻༗ແ # DB͔Βऔಘͨ͠υϝΠϯʹඥͮ͘Web Server μϛʔͷ6QTUSFBN OHY@NSVCZͰॻ͖͑Δ nginx.conf
NSVCZΛΈ߹ͤͯಈతʹઃఆΛಡΈࠐΉ upstream dynamic_cache_server { server 127.0.0.1:80; mruby_upstream_keepalive 64; } mruby_set_code
$upstream " : if result.enable_contents_cache? servers = Userdata.new.servers port = Nginx::Connection.new.local_port index = SecureRandom.random_number(servers.size) upstream = Nginx::Upstream.new("dynamic_cache_server") upstream.server = "#{servers[index]}:#{port}" "dynamic_cache_server" else result.upstream end "; proxy_pass $upstream; # DB͔Βऔಘͨ͠ίϯςϯπΩϟογϡػೳͷར༻༗ແ # DB͔Βऔಘͨ͠υϝΠϯʹඥͮ͘Web Server OHJOYͷมʹNSVCZͷ࣮ߦ݁ՌΛ֨ೲ͢Δ nginx.conf
NSVCZΛΈ߹ͤͯಈతʹઃఆΛಡΈࠐΉ upstream dynamic_cache_server { server 127.0.0.1:80; mruby_upstream_keepalive 64; } mruby_set_code
$upstream " : if result.enable_contents_cache? servers = Userdata.new.servers port = Nginx::Connection.new.local_port index = SecureRandom.random_number(servers.size) upstream = Nginx::Upstream.new("dynamic_cache_server") upstream.server = "#{servers[index]}:#{port}" "dynamic_cache_server" else result.upstream end "; proxy_pass $upstream; # DB͔Βऔಘͨ͠ίϯςϯπΩϟογϡػೳͷར༻༗ແ # DB͔Βऔಘͨ͠υϝΠϯʹඥͮ͘Web Server mruby_init_worker_code " servers = YAML.load( File.open('servers.yml').read ) Userdata.new.servers = servers "; ىಈ࣌ʹऔಘͨ͠$BDIF4FSWFSҰཡ nginx.conf
NSVCZΛΈ߹ͤͯಈతʹઃఆΛಡΈࠐΉ upstream dynamic_cache_server { server 127.0.0.1:80; mruby_upstream_keepalive 64; } mruby_set_code
$upstream " : if result.enable_contents_cache? servers = Userdata.new.servers port = Nginx::Connection.new.local_port index = SecureRandom.random_number(servers.size) upstream = Nginx::Upstream.new("dynamic_cache_server") upstream.server = "#{servers[index]}:#{port}" "dynamic_cache_server" else result.upstream end "; proxy_pass $upstream; # DB͔Βऔಘͨ͠ίϯςϯπΩϟογϡػೳͷར༻༗ແ # DB͔Βऔಘͨ͠υϝΠϯʹඥͮ͘Web Server ଓઌͷϙʔτ൪߸ nginx.conf
NSVCZΛΈ߹ͤͯಈతʹઃఆΛಡΈࠐΉ upstream dynamic_cache_server { server 127.0.0.1:80; mruby_upstream_keepalive 64; } mruby_set_code
$upstream " : if result.enable_contents_cache? servers = Userdata.new.servers port = Nginx::Connection.new.local_port index = SecureRandom.random_number(servers.size) upstream = Nginx::Upstream.new("dynamic_cache_server") upstream.server = "#{servers[index]}:#{port}" "dynamic_cache_server" else result.upstream end "; proxy_pass $upstream; # DB͔Βऔಘͨ͠ίϯςϯπΩϟογϡػೳͷར༻༗ແ # DB͔Βऔಘͨ͠υϝΠϯʹඥͮ͘Web Server μϛʔͰఆٛͨ͠6QTUSFBN nginx.conf
NSVCZΛΈ߹ͤͯಈతʹઃఆΛಡΈࠐΉ upstream dynamic_cache_server { server 127.0.0.1:80; mruby_upstream_keepalive 64; } mruby_set_code
$upstream " : if result.enable_contents_cache? servers = Userdata.new.servers port = Nginx::Connection.new.local_port index = SecureRandom.random_number(servers.size) upstream = Nginx::Upstream.new("dynamic_cache_server") upstream.server = "#{servers[index]}:#{port}" "dynamic_cache_server" else result.upstream end "; proxy_pass $upstream; # DB͔Βऔಘͨ͠ίϯςϯπΩϟογϡػೳͷར༻༗ແ # DB͔Βऔಘͨ͠υϝΠϯʹඥͮ͘Web Server 6QTUSFBNͷαʔόΛॻ͖͑Δ nginx.conf
NSVCZΛΈ߹ͤͯಈతʹઃఆΛಡΈࠐΉ upstream dynamic_cache_server { server 127.0.0.1:80; mruby_upstream_keepalive 64; } mruby_set_code
$upstream " : if result.enable_contents_cache? servers = Userdata.new.servers port = Nginx::Connection.new.local_port index = SecureRandom.random_number(servers.size) upstream = Nginx::Upstream.new("dynamic_cache_server") upstream.server = "#{servers[index]}:#{port}" "dynamic_cache_server" else result.upstream end "; proxy_pass $upstream; # DB͔Βऔಘͨ͠ίϯςϯπΩϟογϡػೳͷར༻༗ແ # DB͔Βऔಘͨ͠υϝΠϯʹඥͮ͘Web Server 6QTUSFBNͷαʔόΛॻ͖͑Δ ϥϯμϜʹΩϟογϡαʔόΛ1ฦ͢ nginx.conf
NSVCZΛΈ߹ͤͯಈతʹઃఆΛಡΈࠐΉ upstream dynamic_cache_server { server 127.0.0.1:80; mruby_upstream_keepalive 64; } mruby_set_code
$upstream " : if result.enable_contents_cache? servers = Userdata.new.servers port = Nginx::Connection.new.local_port index = SecureRandom.random_number(servers.size) upstream = Nginx::Upstream.new("dynamic_cache_server") upstream.server = "#{servers[index]}:#{port}" "dynamic_cache_server" else result.upstream end "; proxy_pass $upstream; # DB͔Βऔಘͨ͠ίϯςϯπΩϟογϡػೳͷར༻༗ແ # DB͔Βऔಘͨ͠υϝΠϯʹඥͮ͘Web Server ࠷ޙʹࢀরͨ͠ͷ͕มʹ֨ೲ͞ΕΔ nginx.conf
NSVCZΛΈ߹ͤͯಈతʹઃఆΛಡΈࠐΉ upstream dynamic_cache_server { server 127.0.0.1:80; mruby_upstream_keepalive 64; } mruby_set_code
$upstream " : if result.enable_contents_cache? servers = Userdata.new.servers port = Nginx::Connection.new.local_port index = SecureRandom.random_number(servers.size) upstream = Nginx::Upstream.new("dynamic_cache_server") upstream.server = "#{servers[index]}:#{port}" "dynamic_cache_server" else result.upstream end "; proxy_pass $upstream; # DB͔Βऔಘͨ͠ίϯςϯπΩϟογϡػೳͷར༻༗ແ # DB͔Βऔಘͨ͠υϝΠϯʹඥͮ͘Web Server ࠷ޙʹࢀরͨ͠ͷ͕มʹ֨ೲ͞ΕΔ ϓϩΩγ͢Δ nginx.conf
NSVCZΛΈ߹ͤͯಈతʹઃఆΛಡΈࠐΉ upstream dynamic_cache_server { server 127.0.0.1:80; mruby_upstream_keepalive 64; } mruby_set_code
$upstream " : if result.enable_contents_cache? servers = Userdata.new.servers port = Nginx::Connection.new.local_port index = SecureRandom.random_number(servers.size) upstream = Nginx::Upstream.new("dynamic_cache_server") upstream.server = "#{servers[index]}:#{port}" "dynamic_cache_server" else result.upstream end "; proxy_pass $upstream; # DB͔Βऔಘͨ͠ίϯςϯπΩϟογϡػೳͷར༻༗ແ # DB͔Βऔಘͨ͠υϝΠϯʹඥͮ͘Web Server ίϯςϯπΩϟογϡػೳ͕ແޮͷ߹ %#͔Βऔಘͨ͠8FC4FSWFSΛฦ͢ nginx.conf
DPOTVMͱOHY@NSVCZͷΈ߹ͤͰ αʔόͷ૿ݮʹ߹Θͤͯࣗಈతʹ ϓϩΩγઌΛܾఆ͢ΔΈ͕Ͱ͖ͨ
ޮతͳΩϟογϡ
ޮతͳΩϟογϡ ୯७ʹ$BDIF4FSWFSΛฒͯࢄ͢Δͱ 3FWFSTF1SPYZ $BDIF 4FSWFS $BDIF 4FSWFS $BDIF 4FSWFS $BDIF
4FSWFS $BDIF 4FSWFS $BDIF 4FSWFS 8FSWFS ΩϟογϡώοτԼ σΟεΫྖҬͷফඅ FYBNQMFDPN FYBNQMFDPN
ޮతͳΩϟογϡ υϝΠϯຖʹॲཧ͢Δ$BDIF4FSWFSΛݶఆ͍ͨ͠ 3FWFSTF1SPYZ $BDIF 4FSWFS $BDIF 4FSWFS $BDIF 4FSWFS $BDIF
4FSWFS $BDIF 4FSWFS $BDIF 4FSWFS 8FSWFS Ωϟογϡώοτ্ σΟεΫྖҬͷઅ FYBNQMFDPN FYBNQMFDPN
υϝΠϯຖʹΩϟογϡαʔόΛ ݶఆ͍͚ͨͩ͠Ͱͳ͘ ʴ αʔόͷεέʔϧʹࣗಈରԠ͍ͨ͠ ʴ Մ༻ੑΛҡ͍࣋ͨ͠
NSVCZͰ؆୯ͳΞϧΰϦζϜΛ࣮
3FWFSTF1SPYZ $BDIF 4FSWFS $BDIF 4FSWFS $BDIF 4FSWFS $BDIF 4FSWFS $BDIF
4FSWFS $BDIF 4FSWFS FYBNQMFDPN
3FWFSTF1SPYZ $BDIF 4FSWFS $BDIF 4FSWFS $BDIF 4FSWFS $BDIF 4FSWFS $BDIF
4FSWFS $BDIF 4FSWFS FYBNQMFDPN F Y B N Q M F D P N υϝΠϯͷઌ಄͔Β̑จࣈநग़
3FWFSTF1SPYZ $BDIF 4FSWFS $BDIF 4FSWFS $BDIF 4FSWFS $BDIF 4FSWFS $BDIF
4FSWFS $BDIF 4FSWFS FYBNQMFDPN F Y B N Q M F D P N ਐͷ"4$**ίʔυΛऔಘ υϝΠϯͷઌ಄͔Β̑จࣈநग़
3FWFSTF1SPYZ $BDIF 4FSWFS $BDIF 4FSWFS $BDIF 4FSWFS $BDIF 4FSWFS $BDIF
4FSWFS $BDIF 4FSWFS FYBNQMFDPN F Y B N Q M F D P N ਐͷ"4$**ίʔυΛ͢ υϝΠϯͷઌ಄͔Β̑จࣈநग़
3FWFSTF1SPYZ $BDIF 4FSWFS $BDIF 4FSWFS $BDIF 4FSWFS $BDIF 4FSWFS $BDIF
4FSWFS $BDIF 4FSWFS FYBNQMFDPN F Y B N Q M F D P N <> <> <> <> <> <> "SSBZ DPOTVMUFNQMBUFʹΑΔ:".-ੜˠ:".-MPBE ˠ"SSBZ
3FWFSTF1SPYZ $BDIF 4FSWFS $BDIF 4FSWFS $BDIF 4FSWFS $BDIF 4FSWFS $BDIF
4FSWFS $BDIF 4FSWFS FYBNQMFDPN F Y B N Q M F D P N <> <> <> <> <> <> "SSBZ MFOHUI
3FWFSTF1SPYZ $BDIF 4FSWFS $BDIF 4FSWFS $BDIF 4FSWFS $BDIF 4FSWFS $BDIF
4FSWFS $BDIF 4FSWFS FYBNQMFDPN F Y B N Q M F D P N <> <> <> <> <> <> "SSBZ
αʔόͷ૿ݮ͕ൃੜͨ͠߹
3FWFSTF1SPYZ $BDIF 4FSWFS $BDIF 4FSWFS $BDIF 4FSWFS $BDIF 4FSWFS $BDIF
4FSWFS $BDIF 4FSWFS FYBNQMFDPN F Y B N Q M F D P N <> <> <> <> <> <> "SSBZ
3FWFSTF1SPYZ $BDIF 4FSWFS $BDIF 4FSWFS $BDIF 4FSWFS $BDIF 4FSWFS $BDIF
4FSWFS $BDIF 4FSWFS FYBNQMFDPN F Y B N Q M F D P N <> <> <> <> <> <> "SSBZ MFOHUI DPOTVMUFNQMBUFͰઃఆϑΝΠϧ͕࠶ੜ OHJOYSFMPBE
3FWFSTF1SPYZ $BDIF 4FSWFS $BDIF 4FSWFS $BDIF 4FSWFS $BDIF 4FSWFS $BDIF
4FSWFS $BDIF 4FSWFS FYBNQMFDPN F Y B N Q M F D P N <> <> <> <> <> <> "SSBZ
NSVCZΛͬͨ؆୯ͳΞϧΰϦζϜͷ ࣮ʹΑͬͯ ޮతͳΩϟογϡΛ࣮ݱͨ͠ʂ
·ͱΊ
·ͱΊ ίϯςϯπΩϟογϡػೳΛϦϦʔεͨ͠ ંฦ͠Ͱߴɾઃఆ؆୯ NSVCZΛ׆༻ͯ͠େنϨϯαόڥʹඞཁͳཁ݅ Λຬͨͨ͠ NSVCZNTE NSVCZVTFSEBUBΛ༻͍ͨύϑΥʔϚ ϯε্5JQTΛհͨ͠ DPOTVMͱNSVCZΛΈ߹ͤͯɺαʔόͷঢ়ଶʹ߹ ΘͤͯಈతʹมԽ͢ΔΠϯϑϥΞʔΩςΫνϟΛ
࣮ݱͨ͠
܅ϖύϘͰಇ͔ͳ͍͔ʁ ࠷৽ͷ࠾༻ใΛνΣοΫˠ !QC@SFDSVJU
͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠