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
Ugoku Backend
Search
Harukasan
PRO
August 02, 2014
Technology
1
1.9k
Ugoku Backend
Ugoku "It's working" Backend
pixiv Ugoira Tech Talks / 2014-08-01
Harukasan
PRO
August 02, 2014
Tweet
Share
More Decks by Harukasan
See All by Harukasan
PicoRabbit: a Tiny Presentation Device Powered by Ruby
harukasan
PRO
1
68
pixivを支える技術 / 技育CAMPアカデミア
harukasan
PRO
3
460
20240401 新卒研修 - ピクシブにおける技術領域
harukasan
PRO
1
780
ピクシブのコンテンツ配信基盤技術 / pixiv TECH SALON
harukasan
PRO
5
5.6k
Goにおける画像ファイル処理 / golang.tokyo #19
harukasan
PRO
7
6.6k
WebRTC動画をトランスコードする / Transcoding video streams from WebRTC
harukasan
PRO
5
1.5k
ImageFluxを支えるリモート開発 / 20171202
harukasan
PRO
2
1.8k
YAPC::Fukuoka 前夜祭LT / Yet Another Pawoo Commit logs
harukasan
PRO
0
3k
YAPC::Fukuoka lunch session
harukasan
PRO
1
3k
Other Decks in Technology
See All in Technology
YOLOv10~v12
tenten0727
3
870
低レイヤを知りたいPHPerのためのCコンパイラ作成入門 / Building a C Compiler for PHPers Who Want to Dive into Low-Level Programming
tomzoh
0
210
Langchain4j y Ollama - Integrando LLMs con programas Java @ Commit Conf 2025
deors
1
130
近年の PyCon 情勢から見た PyCon APAC のまとめ
terapyon
0
290
GitHub MCP Serverを使って Pull Requestを作る、レビューする
hiyokose
2
710
アジャイル脅威モデリング#1(脅威モデリングナイト#8)
masakane55
3
170
AI AgentOps LT大会(2025/04/16) Algomatic伊藤発表資料
kosukeito
0
130
Amebaにおける Platform Engineeringの実践
kumorn5s
6
900
【2025年度新卒技術研修】100分で学ぶ サイバーエージェントのデータベース 活用事例とMySQLパフォーマンス調査
cyberagentdevelopers
PRO
5
6.6k
プロダクト開発におけるAI時代の開発生産性
shnjtk
2
200
AIエージェント開発における「攻めの品質改善」と「守りの品質保証」 / 2024.04.09 GPU UNITE 新年会 2025
smiyawaki0820
0
400
「それはhowなんよ〜」のガイドライン #orestudy
77web
9
2.4k
Featured
See All Featured
Faster Mobile Websites
deanohume
306
31k
Code Reviewing Like a Champion
maltzj
522
39k
Fashionably flexible responsive web design (full day workshop)
malarkey
407
66k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
16k
Build The Right Thing And Hit Your Dates
maggiecrowley
35
2.6k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
3.8k
Optimising Largest Contentful Paint
csswizardry
36
3.2k
Documentation Writing (for coders)
carmenintech
69
4.7k
The Pragmatic Product Professional
lauravandoore
33
6.5k
Writing Fast Ruby
sferik
628
61k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
8
650
Java REST API Framework Comparison - PWX 2021
mraible
30
8.5k
Transcript
Ugoku backend Ugoira Tech Talks / 2014-08-01 harukasan
• Infrastructure Team in pixiv since 2012 • nginx /
Apache Traffic Server • Fluentd / Kibana / BigQuery • Kosenconf Harukasan / Shunsuke MICHII ! ൃച @harukasan shunsuke.michii
Ugoku Backend ͏͝ΠϥͷཪଆͰ
Works in Ugoira Project • ͏͍͝Βͷ͚ͩͷͨΊʹؾΛݣͬͨ෦ ͦΕ΄Ͳͳ͍ • ಛච͖͢ࣄฑ͋·Γͳ͍…… •
ͲͪΒ͔ͱ͍͏ͱৗʹ͕Μ͍ͬͯΔ͔Μ͡
Ugoku Backend
None
Statistics 3,700,000,000 PV/month 11,000,000 Users 45,000,000 Illustrations |
Statistics 7K peak req/s (dynamic) 30K peak req/s (image) 12Gbps
peak Traffic (image) 3 x 10Gbps backbone 40TB image files 400 servers
Ugoku Backend ͏͝ΠϥͷཪଆͰ
Ugoira Data Flow PHP nginx nginx Apache HTTPd nginx pixiv
Contents Delivery Clusters uploading small light load balancing Store Images generating thumbnails Ý Creator Viewers PHP Redis queing
Ugoira Data Flow PHP nginx nginx Apache HTTPd nginx pixiv
Contents Delivery Clusters uploading small light load balancing Store Images generating thumbnails Ý Creator Viewers PHP Redis queing
Upload System
Upload System • ࠷େ150ຕͷը૾ͷมॲཧΛߦ͏ඞཁ͕͋Δ • ϢʔβʔΛग़དྷΔ͚ͩͨͤͳ͍Α͏ʹ͍ͨ͠
Asynchronous Uploading Upload View Information form View Complete View 1.
ը૾ϑΝΠϧΛ Ξοϓϩʔυ 2. ใೖྗ ◦ ྃΛͭ Redis Uplaod Worker upload αϜωΠϧϚελը૾ੜ Ý upload Ý GIFը૾ׂ active standby 3. Ξοϓϩʔυྃ
Upload System • Ϣʔβʔ͕ใΛೖྗ͍ͯ͠Δؒʹ ը૾ϑΝΠϧΛ४උ • GIFը૾Λׂ Github: pixiv/gifsplit •
͏͝ΠϥͰ3छྨͷը૾Λ༻ҙ • WebDAVͰΞοϓϩʔυ͢Δ PHP nginx Redis php-resque nginx ϩʔυόϥϯα ΞϓϦέʔγϣϯ Ωϡʔ ϫʔΧʔ DAVετϨʔδ
Ugoira Data Flow PHP nginx nginx Apache HTTPd nginx pixiv
Contents Delivery Clusters uploading small light load balancing Store Images generating thumbnails Ý Creator Viewers PHP Redis queing
Dynamic Thumbnail Generation
Dynamic Thumb. Generation • Ξοϓϩʔυ࣌ʹͨ͘͞ΜͷαϜωΠϧΛ ͭ͘Δͷେม • αΠζσβΠϯมߋͱ͔Ͱม͍͑ͨ • ༧ΊϚελը૾Λੜͯͦ͠Ε͔Βੜ͢Δ
ΦϦδφϧը૾ αϜωΠϧϚελը૾ αϜωΠϧը૾
Thumbnail Master • ΞεϖΫτݻఆͱਖ਼ํܗΫϩοϓͷ2छྨ • JPEGը૾ʹม(PNG→JPEGͷมॏ͍) 1200px 1200px 1200px 1200px
1200px 1200px ඪ४αΠζ(1200x1200ʹऩ·ΔαΠζ) ਖ਼ํܗΫϩοϓ(ԣͱॎͰΫϩοϓํ๏͕ҟͳΔ) ԣதԝ߹Θͤ ॎ্߹Θͤ
• αϜωΠϧੜmod_small_lightΛ༻ https://github.com/yamac/smalllight ! • ετϨʔδ͔ΒԿϚελը૾Λ औಘ͠ͳ͍Α͏ʹΩϟογϡΛ͞Ή Dynamic Thumb. Generation
Small Light ετϨʔδ Ωϟογϡ Ωϡʔ nginx Ý nginx ৼΓ͚
Ugoira Data Flow PHP nginx nginx Apache HTTPd nginx pixiv
Contents Delivery Cluster uploading small light load balancing Store Images generating thumbnails Ý Creator Viewers PHP Redis queing
Contents Delivery Cluster
• εέʔϥϒϧ • Ԇ (< 100ms) • ߴ͍ώοτ (> 95%)
• ઃఆ͕มߋ͍͢͠ Storage pixiv Contents Delivery Clusters Contents Delivery Cluster
Inside of pixiv CDC 10Gbps 10Gbps nginx nginx nginx ATS
ATS ATS nginx nginx nginx Hashing 64GB Memory Caching (60%) 3x 256GB SSD Caching (90%) 1Gbps
Ugoira Compatibility • ZIPϑΝΠϧͷ৴ • CORS Non-simpleϦΫΤετͷԠ
CORS • ผυϝΠϯͷϦιʔεͷϦΫΤετΛڐՄ͢Δ • simple requests / non-simple requests ͷ2͕ͭ͋Δ
• Ϟμϯϒϥβ͍͍ͩͨରԠ
CORS Non-Simple Request someone.example.com www.pixiv.net/api var req = new XMLHTTPRequest();
req.open(“GET”, “//www.pixiv.net/api”); req.setRequestHeader(“Range”, “0-10000”); req.send(); GET /api HTTP/1.1 Origin:someone.example.com Range: 0-10000 ϒϥβͰϒϩοΫ͞ΕΔ
someone.example.com www.pixiv.net/api OPTIONS /api HTTP/1.1 Origin:someone.example.com Access-Control-Request-Headers: range Access-Control-Request-Method: GET
Preflight request HTTP/1.1 200 OK Access-Control-Allow-Headers: Range Access-Control-Allow-Methods: GET, POST, OPTIONS Access-Control-Allow-Origin:* Access-Control-Expose-Headers: Content-Length Access-Control-Max-Age: 2592000 ڐՄ͢ΔϦΫΤετϔομ ڐՄ͢ΔϦΫΤετϝιου ڐՄ͢ΔϦΫΤετݩΦϦδϯ Script͔Βར༻Ͱ͖ΔϨεϙϯεϔομ ΩϟογϡՄೳ࣌ؒ ڐՄΛٻΊΔϦΫΤετϔομ ڐՄΛٻΊΔϦΫΤετϝιου GET /api HTTP/1.1 Origin:someone.example.com Range: 0-10000
Ugoira Data Flow PHP nginx nginx Apache HTTPd nginx pixiv
Contents Delivery Cluster uploading small light load balancing Store Images generating thumbnails Ý Creator Viewers PHP Redis queing
Complete!
Conclusion • ͏͝ΠϥͷόοΫΤϯυී௨ʹ͏͍͍ͯ͝Δ • ៉ྷͳγεςϜྑ͍͚Ͳ͏͘͝ͷલఏ • ͏্͘͝ʹ֦ு͍͢͠ͷॏཁ