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
複雑なState管理からの脱却
sansantech
PRO
1
150
IBC 2024 動画技術関連レポート / IBC 2024 Report
cyberagentdevelopers
PRO
1
110
個人でもIAM Identity Centerを使おう!(アクセス管理編)
ryder472
4
220
Python(PYNQ)がテーマのAMD主催のFPGAコンテストに参加してきた
iotengineer22
0
500
Making your applications cross-environment - OSCG 2024 NA
salaboy
0
190
Oracle Cloud Infrastructureデータベース・クラウド:各バージョンのサポート期間
oracle4engineer
PRO
28
13k
Terraform Stacks入門 #HashiTalks
msato
0
360
リンクアンドモチベーション ソフトウェアエンジニア向け紹介資料 / Introduction to Link and Motivation for Software Engineers
lmi
4
300k
マルチモーダル / AI Agent / LLMOps 3つの技術トレンドで理解するLLMの今後の展望
hirosatogamo
37
12k
強いチームと開発生産性
onk
PRO
35
11k
20241120_JAWS_東京_ランチタイムLT#17_AWS認定全冠の先へ
tsumita
2
290
iOSチームとAndroidチームでブランチ運用が違ったので整理してます
sansantech
PRO
0
140
Featured
See All Featured
Building Your Own Lightsaber
phodgson
103
6.1k
10 Git Anti Patterns You Should be Aware of
lemiorhan
655
59k
Six Lessons from altMBA
skipperchong
27
3.5k
4 Signs Your Business is Dying
shpigford
180
21k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
Building Applications with DynamoDB
mza
90
6.1k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
42
9.2k
BBQ
matthewcrist
85
9.3k
Bootstrapping a Software Product
garrettdimon
PRO
305
110k
Fireside Chat
paigeccino
34
3k
Mobile First: as difficult as doing things right
swwweet
222
8.9k
Unsuck your backbone
ammeep
668
57k
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ͰΦϯϓϨڥΛ͏·͘׆༻ͯ͠ίετύϑΥʔϚ ϯεͷߴ͍αʔόӡ༻Λ͍ͯ͠·͢ ▸ Ձ֨ͰेੑೳΛಘΔͨΊɺ༻్ʹ߹Θ༷ͤͯʑͳ Λ͍ͯ͠·͢ ▸ ϐΫγϒͰΠϯϑϥΤϯδχΞΛืू͍ͯ͠·͢