sankichi92 / isucon13 Goto Github PK
View Code? Open in Web Editor NEWチーム「HEAVIEST OBJECTS IN THE UNIVERSE (./target)」の ISUCON 13 本番使用リポジトリ
チーム「HEAVIEST OBJECTS IN THE UNIVERSE (./target)」の ISUCON 13 本番使用リポジトリ
$ sudo mysqldumpslow /tmp/slow.log -s t -t 10
Reading mysql slow query log from /tmp/slow.log
Count: 12119 Time=0.03s (340s) Lock=0.00s (0s) Rows=3.6 (43432), isucon[isucon]@localhost
SELECT * FROM livestream_tags WHERE livestream_id = N
Count: 21301 Time=0.01s (125s) Lock=0.00s (0s) Rows=0.7 (15704), isucon[isucon]@localhost
SELECT image FROM icons WHERE user_id = N
Count: 12269 Time=0.01s (102s) Lock=0.00s (0s) Rows=0.2 (2780), isudns[isudns]@localhost
SELECT content,ttl,prio,type,domain_id,disabled,name,auth FROM records WHERE disabled=N and name='S' and domain_id=N
Count: 6726 Time=0.01s (61s) Lock=0.00s (0s) Rows=1.0 (6726), isucon[isucon]@localhost
SELECT IFNULL(SUM(l2.tip), N) FROM users u
INNER JOIN livestreams l ON l.user_id = u.id
INNER JOIN livecomments l2 ON l2.livestream_id = l.id
WHERE u.id = N
Count: 6730 Time=0.01s (58s) Lock=0.00s (0s) Rows=1.0 (6730), isucon[isucon]@localhost
SELECT COUNT(*) FROM users u
INNER JOIN livestreams l ON l.user_id = u.id
INNER JOIN reactions r ON r.livestream_id = l.id
WHERE u.id = N
Count: 9162 Time=0.01s (56s) Lock=0.00s (0s) Rows=0.5 (4733), isudns[isudns]@localhost
SELECT content,ttl,prio,type,domain_id,disabled,name,auth FROM records WHERE disabled=N and type='S' and name='S'
Count: 17837 Time=0.00s (38s) Lock=0.00s (0s) Rows=1.0 (17837), isucon[isucon]@localhost
SELECT * FROM themes WHERE user_id = N
Count: 1395 Time=0.03s (35s) Lock=0.00s (0s) Rows=1.0 (1395), isucon[isucon]@localhost
SELECT slot FROM reservation_slots WHERE start_at = N AND end_at = N
Count: 76120 Time=0.00s (32s) Lock=0.00s (0s) Rows=0.0 (0), isucon[isucon]@localhost
DELETE FROM livecomments
WHERE
id = N AND
livestream_id = N AND
(SELECT COUNT(*)
FROM
(SELECT 'S' AS text) AS texts
INNER JOIN
(SELECT CONCAT('S', 'S', 'S') AS pattern) AS patterns
ON texts.text LIKE patterns.pattern) >= N
Count: 448 Time=0.05s (23s) Lock=0.00s (0s) Rows=0.4 (180), isucon[isucon]@localhost
SELECT id, user_id, livestream_id, word FROM ng_words WHERE user_id = N AND livestream_id = N
正攻法は Nginx から配信するようにするが、DB からデータ剥がすのは大変そう。
DB をそのままにやる場合は以下の手順か。
icon_hash
カラムを追加するicon_hash
に非同期で保存する(2秒以内)fill_user_response
で事前計算済みの icon_hash
を返すようにするIf-None-Match
ヘッダを見て、存在すれば icons テーブルで icon_hash
との一致を確認、一致すれば 304 を返して早期リターンsetup.sh
を殴る)A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.