Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
用途とコスパで考えるハードウェア選びのコツ
Search
Takafumi Minamikawa
March 18, 2017
Technology
0
150
用途とコスパで考えるハードウェア選びのコツ
2017/03/17 pixiv night in Fukuoka #2 で発表した資料です
Takafumi Minamikawa
March 18, 2017
Tweet
Share
More Decks by Takafumi Minamikawa
See All by Takafumi Minamikawa
みんストのインフラを支える技術
takafumiminamikawa
0
85
pixiv-booth-riakmeetup5
takafumiminamikawa
0
130
pixiv-summer-intern2014
takafumiminamikawa
7
5.9k
Other Decks in Technology
See All in Technology
成果を出しながら成長する、アウトプット駆動のキャッチアップ術 / Output-driven catch-up techniques to grow while producing results
aiandrox
0
310
複雑性の高いオブジェクト編集に向き合う: プラガブルなReactフォーム設計
righttouch
PRO
0
110
終了の危機にあった15年続くWebサービスを全力で存続させる - phpcon2024
yositosi
10
8.1k
サーバレスアプリ開発者向けアップデートをキャッチアップしてきた #AWSreInvent #regrowth_fuk
drumnistnakano
0
190
開発生産性向上! 育成を「改善」と捉えるエンジニア育成戦略
shoota
2
350
生成AIをより賢く エンジニアのための RAG入門 - Oracle AI Jam Session #20
kutsushitaneko
4
220
サイボウズフロントエンドエキスパートチームについて / FrontendExpert Team
cybozuinsideout
PRO
5
38k
10分で学ぶKubernetesコンテナセキュリティ/10min-k8s-container-sec
mochizuki875
3
330
1等無人航空機操縦士一発試験 合格までの道のり ドローンミートアップ@大阪 2024/12/18
excdinc
0
160
AI時代のデータセンターネットワーク
lycorptech_jp
PRO
1
280
[Ruby] Develop a Morse Code Learning Gem & Beep from Strings
oguressive
1
160
NW-JAWS #14 re:Invent 2024(予選落ち含)で 発表された推しアップデートについて
nagisa53
0
260
Featured
See All Featured
Fantastic passwords and where to find them - at NoRuKo
philnash
50
2.9k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
How To Stay Up To Date on Web Technology
chriscoyier
789
250k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
247
1.3M
Testing 201, or: Great Expectations
jmmastey
40
7.1k
Side Projects
sachag
452
42k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
48k
Typedesign – Prime Four
hannesfritz
40
2.4k
Building Your Own Lightsaber
phodgson
103
6.1k
Faster Mobile Websites
deanohume
305
30k
A better future with KSS
kneath
238
17k
A designer walks into a library…
pauljervisheath
204
24k
Transcript
༻్ͱίεύͰߟ͑Δ ϋʔυΣΞબͼͷίπ 2017/03/17 pixiv night in Fukuoka Πϯϑϥ෦ ೆ ؽจ
ࣗݾհ ▸ ໊લ: ೆ ؽจ ▸ pixiv 6 ▸ Πϯϑϥ෦Ͱpixivͱؔ࿈αʔϏεશମͷӡ༻Λ͍ͬͯ·͢
▸ αʔόͷௐୡ͔ΒηοτΞοϓɺϛυϧΣΞͷӡ༻ɺڥߏஙɺΞϓϦέʔ γϣϯͷνϡʔχϯάɺΫϥυपΓͳͲ͍Ζ͍Ζ ▸ pixivΠϯϑϥ෦ 4ਓ͘Β͍Ͱճ͍ͯ͠Δ͏ͪͷҰਓͰ͢ ▸ ࠒιϑτΣΞΛ৮Δ͜ͱ͕ଟ͍ͷͰ͕͢ɺࠓϋʔυͷΛ͖࣋ͬͯ ·ͨ͠ ▸ pixivͰelasticsearch, RiakCS, RedisͳͲΛಛʹ৮͍ͬͯΔ͜ͱ͕ଟ͍Ͱ͢ ▸ Ruby, PHP, JavaͰίʔυΛॻ͘͜ͱ͕͋Γ·͢
QJYJWͷαʔόͨͪ ▸ ৽॓DC 200ະຬ ▸ pixiv.netΛத৺ͱͨ͠αʔό͕Քಇ ▸ ΞϓϦέʔγϣϯɺDBɺը૾ετϨʔδͳͲ ▸ നՏDC
100ະຬ ▸ ը૾ΩϟογϡαʔόΛத৺ ▸ comic.pixiv.net ͷΞϓϦέʔγϣϯɺσʔλϕʔεͳͲ ▸ ৽॓DCͱґଘ͕͍ͷΛߏங ▸ ։ൃػɺΫϥυ े ▸ ݕূ༻ͳͲظతʹ͏αʔό
Ϋϥυ ▸ ظӡ༻͠ͳ͍ɺݕূظؒݶఆΠϕϯτ༻ΞϓϦέʔγϣϯ ▸ ݕূڥΦϯϓϨΛ༻ҙ͠ͳͯ͘ेͳ͜ͱ͕͋Δ ▸ ͍҆ΦϯϓϨڥผͷ༻్ʹͬͯػձଛࣦΛ͑Δ ▸ ΦϯσϚϯυͰ༻ҙͰ͖Δར
> ΦϯϓϨ͕͔͔࣌ؒΔ ▸ όοΫΞοϓ ▸ ߋ৽ස͕͍σʔλͷόοΫΞοϓ ▸ ผڌʹΑΔԽ ▸ DCΛผڌʹ༻ҙ͢ΔΑΓ͍҆ (DNSͳͲ)
Ϋϥυ ▸ సૹྔ͕গͳ͍ ▸ ࣌ؒ vs අ༻ Ͱ࣌ؒॖͷޮՌ͕େ͖͍ͷ ▸
ϩάղੳ ▸ ظ͕ؒ͘ܭࢉ͕࣌ؒ͘ͳΔ ͔ͭ ॏཁͳࢦඪ ֎෦αʔϏ εʹ͍͛ͯ҆͜ͱ͕͋Δ ▸ ظؒɺಛʹैྔ՝ۚͷ΄͏͕҆͘ͳΔέʔεͰΫϥυΛར ༻ ▸ ΦϯϓϨظతʹ҆͘ͳΔͷͰɺϲ݄Ҏ্͏ͷɺ ظӡ༻ʹҠߦ͢Δ߹Ϋϥυ͔ΒҾ্͖͛
ΦϯϓϨαʔό ▸ αʔόߏΛߟ͑ͯઃஔ ▸ CPUɺϝϞϦɺσΟεΫIOͳͲ༻్ʹ߹ΘͤͯύʔπΛ࠷ దԽ͍ͯ͘͠ ▸ ΞϓϦέʔγϣϯ/σʔλϕʔε/ετϨʔδ Λྫʹύʔπબ ͼͷྫΛڍ͍͖͛ͯ·͢ɻ
αʔό͝ͱͷ
ΞϓϦέʔγϣϯαʔό ▸ HTTPϦΫΤετΛॲཧ͢ΔWebαʔό ▸ Apache Nginx ▸ PHP
▸ Ruby ▸ Java ͳͲ ▸ ΞϓϦέʔγϣϯͷઃܭʹ߹Θͤͯ࠷దԽ͢Δඞཁ͋Γ
ΞϓϦέʔγϣϯαʔό ▸ pixiv.net PHP(Apache + mod_php) Ͱಈ࡞ ▸
prefork (Ϛϧνϓϩηε) ▸ Apacheͷ֤ϓϩηεΛͦΕͧΕCPUίΞͰಈ͔͢ (γϯ άϧεϨουɾϚϧνϓϩηε) ▸ CPUίΞ͕ଟ͍΄͏͕ฒྻੑߴ͍
ΞϓϦέʔγϣϯαʔό ▸ BOOTH/pixivFACTORY ͳͲ Ruby (RoR) ͷαʔό ▸ nginx
+ unicorn Ͱಈ࡞ ▸ ApacheͷPreforkϞσϧͱ͍ۙ ▸ unicornMasterʹΞϓϦέʔγϣϯίʔυΛಡΈࠐΜͩ͋ͱ fork͢Δ ▸ ͚ࠩͩϝϞϦΛফඅ͢Δ CoW ͕ͩͦΕͳΓʹϝϞϦΛ͏ ▸ PHPαʔόͱൺֱͯ͠ϝϞϦ༻͕ߴ͍ͨΊϝϞϦCPUͷ ڧ͍αʔόʹ͢Δඞཁ͕͋Δ
ΞϓϦέʔγϣϯαʔό ▸ Javaαʔό ▸ SolrElasticsearchͳͲͷݕࡧΤϯδϯͰͳ͘JettyͳͲͰಈ͘Webαʔό ▸ ಡΈࠐΉσʔλগͳ͍͕ɺΞϓϦέʔγϣϯΩϟογϡΛ࣋ͭඞཁ͕͋ Δέʔε͕͋Δ ▸
ϝϞϦPHPαʔόͱಉ͡ఔͰΑ͍ ▸ εϨουΛͬͨฒྻॲཧͰCPUੑೳΛ׆͔͘͢͠CPUίΞͷଟ͍Ϛ γϯͰߴԽͰ͖Δ ▸ ϝϞϦׂΓͯΛେ͖͘͠ա͗Δͱ GC Ͱࢭ·Γ͕ͪʹͳΔ ▸ GCઓུCMSͱ͍ͨ͠ͷͰCPUੑೳ͋ͬͨ΄͏͕Α͍
σʔλϕʔεαʔό ▸ MySQL ▸ InnoDB όοϑΝϓʔϧʹଟ͘ͷσʔλΛࡌͤΔ ▸ σΟεΫͷΞΫηε͕গͳ͘ͳΔΑ͏ʹ͢Δ ▸
bin/relaylogͷॻ͖ࠐΈ͕͘ͳΒͳ͍Α͏ߴͳSSDΛ datadirʹࢦఆ ▸ ΫΤϦ͕࠷దԽ͞Ε͍ͯΕCPUੑೳͦΕ΄Ͳཁٻ͞ Εͳ͍
σʔλϕʔεαʔό ▸ Solr / Elasticsearch ▸ Javaͷӡ༻APͱࣅ͍ͯΔ ▸ σʔλͷϩʔυɺωοτϫʔΫ௨৴ɺώʔϓαΠζେ͖͍
▸ ϝϞϦׂΓͯΛେ͖͘͠ա͗Δͱ GC Ͱࢭ·Γ͕ͪʹͳΔ ▸ GCઓུCMSͱ͍ͨ͠ͷͰCPUੑೳ͋ͬͨ΄͏͕Α͍ ▸ 32GBҎ্ͷϝϞϦΛJVMͷώʔϓʹׂΓ͋ͯΔ߹ JVM ͕͏ϙΠϯλ αΠζ͕4όΠτ͔Β8όΠτʹͳΓޮ͕ѱ͘ͳΔ ▸ 1ϊʔυ͋ͨΓ32GBҎ্ͷώʔϓׂΓͯʹͳΒͳ͍Α͏ʹ͢Δ ▸ ΠϯσοΫεͷ୳ࡧʹCPUΛ͏ͷͰCPUڧ͍ͷΛ͏
σʔλϕʔεαʔό ▸ Redis ▸ ΦϯϝϞϦσʔλϕʔε ▸ CPUͷෳίΞΛར༻Ͱ͖ͳ͍ ▸ ίΞ͕ଟ͍ͷඞཁ͕ͳ͍
▸ σʔλͷΞΫηεྔʹ߹ΘͤͯCPUΛ༻ҙ ▸ ϝϞϦσʔλྔʹ߹Θͤͯ༻ҙ ▸ σʔλͷμϯϓɺϩʔυΛߴʹ͢ΔͨΊSSDΛ༻ҙ
ετϨʔδαʔό ▸ ը૾αʔό ▸ αϜωΠϧͱΦϦδφϧαΠζͷը૾ɺछྨʹΑͬͯΞΫηε ͕ҟͳΔ ▸ ΞΫηε͕ଟ͍খ͞ͳϑΝΠϧΛૉૣ͘ฦ͢ʹSSDͷΑ͏ͳ ϥϯμϜΞΫηεੑೳͷߴ͍σΟεΫΛ͏ඞཁ͕͋Δ
▸ ΦϦδφϧαΠζͷը૾ɺաڈͷΠϥετΞΫηεස͕ ͘ͳΔ͕͋ΓɺHDDͰेͳ͜ͱ͕͋Δ ▸ αΠζΞΫηεʹΑͬͯɺSSDͱHDDΛ͍͚Δ͜ͱ ͰίετύϑΥʔϚϯεΛΑ͍ͯ͘͠Δ
ετϨʔδαʔό ▸ Riak / RiakCS ▸ ࢄετϨʔδαʔό ▸ BOOTH/pixivFACTORYͳͲͷαʔϏεͰར༻
▸ Խ͞Ε͍ͯΔͷͰɺHDDΛRAID0ͰଋͶͯετϨʔδͱ͢Δ ▸ vnode୯ҐͰϝϞϦʹࡌͬͨΓɺbitcaskͷΩʔҰཡ͕ϝϞϦʹऩ ·ΔΑ͏ʹ͠ͳ͚ΕͳΒͳ͍ ▸ ϝϞϦͷཁٻσʔλαΠζʹΑͬͯ૿͑Δ ▸ ߴͳϨεϙϯεʹ͔ͳ͍͕ɺେ͖ͳϑΝΠϧΛѻ͍ ͍͢Α͏ʹͳ͍ͬͯΔ
ϋʔυΣΞͷબͼํ
ϋʔυΣΞ$16 ▸ Intel CPU Xeon E5 2600v4 Λ͏͜ͱ͕ଟ͍ ▸ ίετ
> E5 2603v4 2609v4 ▸ CPUΛΘͳ͍έʔε ▸ தύϑΥʔϚϯε > E5 2620v4 ʙ 2640v4 ▸ CPUΛ͏έʔε ▸ ߴपCPU(E5 2637v4ͳͲ) ͦΕҎ্ͷੑೳ ▸ ར༻ࠓͷͱ͜Ζͳ͠
ϋʔυΣΞϝϞϦ ▸ DDR3 ͔Β DDR4 ͷஔ్্͖͑ ▸ લ͘Β͍ϝϞϦՁ͕֨ඇৗʹ͔҆ͬͨ ▸ ݱࡏɺԁ҆ɾڙڅෆʹΑΓߴಅத
▸ ϝϞϦՁ֨ϒϨ͕େ͖͘Ձ֨ͷݟఆΊ͍͠ ▸ DBαʔόͰͷϝϞϦར༻͕ଟ͍ ▸ ۙͰ32GBϞδϡʔϧத৺Ͱར༻
ϋʔυΣΞετϨʔδ)%% ▸ ίϯγϡʔϚʔ͚SATA HDDΛଋͶΔͱίετ͍҆ ▸ ͕ग़͍ͯΔͨΊ ▸ ݕূσʔλଟ͍ͨΊࢀߟʹͳΓ͍͢ ▸ ΤϯλʔϓϥΠζϋΠΤϯυϞσϧߴՁ͕ͩੑೳ໘Ͱ༏ΕΔ͜ͱ
▸ ݕূ༻ʹগྔࢼ͢͜ͱ͋Δ͕ຊӡ༻Ͱͷར༻ࠓͷͱ͜Ζͳ͍ ▸ HGST / WesternDigital / TOSHIBA / Seagate ͳͲ͍Ζ͍Ζͳϝʔ ΧʔͷͷΛར༻ ▸ ϩοτʹΑΓނো͕ҧ͏͕Θ͔͍ͬͯΔͨΊɺϩοτ͝ͱʹӡ ༻Λ͚͍ͯΔ
ϋʔυΣΞετϨʔδ44% ▸ ίϯγϡʔϚʔ͚SATA SSDΛ͏έʔε͕΄ͱΜͲ ▸ HDDͱಉ͕͘͡ग़͍ͯΔͨΊ ▸ Ұ෦αʔό༻్͚SSDΛ͍ͬͯΔॴ͋Δ ▸ Samsung
/ Crucial / Intel ͳͲ͍Ζ͍ΖͳϝʔΧʔͷͷΛ ར༻
ϋʔυΣΞ)%%WT44% ▸ SSDΛ͏͔Ͳ͏͔IOੑೳͱهԱ༰ྔɺՁ֨໘Ͱ༏ΕΔ͔Ͳ͏͔ ▸ هԱ༰ྔ/Ձ֨Ͱ HDD > SSD SATA >
SSD m.2 ▸ ۙSSDՁ͔֨ͳΓ҆͘ͳ͍ͬͯΔ ▸ HDDେ༰ྔԽਐΜͰ͍Δ͕ɺIOੑೳ໘Ͱ͕͋Δ͜ͱ͋Δɻ ▸ γʔέϯγϟϧΞΫηε༻్ͰίετͳͨΊ࠾༻͍ͯ͠Δ ▸ SSDͰಉ͡Ͱɺେ༰ྔԽʹ߹ΘͤͯIOੑೳ্͕͍ͬͯ͘ͷ͕ཧ ▸ SATAͷੑೳݶքΛ͑ΔͨΊۙͰm.2ΠϯλʔϑΣΠεϞσϧ Λར༻ (༧ఆ)
·ͱΊ ▸ pixivͰΦϯϓϨڥΛ͏·͘׆༻ͯ͠ίετύϑΥʔϚ ϯεͷߴ͍αʔόӡ༻Λ͍ͯ͠·͢ ▸ Ձ֨ͰेੑೳΛಘΔͨΊɺ༻్ʹ߹Θ༷ͤͯʑͳ Λ͍ͯ͠·͢ ▸ ϐΫγϒͰΠϯϑϥΤϯδχΞΛืू͍ͯ͠·͢