isucon13's People
isucon13's Issues
[DB] `SELECT livestreams livecomments` スロークエリの改善
初回のスロークエリログの2番手。
https://github.com/vvani06/isucon13/blob/main/mysql/digest_20231125-043157.txt
# Query 2: 577.72 QPS, 0.78x concurrency, ID 0xFD38427AE3D09E3883A680F7BAF95D3A at byte 103249723
# This item is included in the report because it matches --limit.
# Scores: V/M = 0.00
# Time range: 2023-11-25T04:28:13 to 2023-11-25T04:30:50
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count 27 90702
# Exec time 12 122s 292us 18ms 1ms 3ms 989us 972us
# Lock time 15 151ms 0 4ms 1us 1us 27us 1us
# Rows sent 22 88.58k 1 1 1 1 0 1
# Rows examine 31 102.27M 1001 1.19k 1.15k 1.14k 77.20 1.14k
# Query size 19 10.54M 119 122 121.85 118.34 0 118.34
# String:
# Databases isupipe
# Hosts localhost
# Users isucon
# Query_time distribution
# 1us
# 10us
# 100us ##############################################################
# 1ms ################################################################
# 10ms #
# 100ms
# 1s
# 10s+
# Tables
# SHOW TABLE STATUS FROM `isupipe` LIKE 'livestreams'\G
# SHOW CREATE TABLE `isupipe`.`livestreams`\G
# SHOW TABLE STATUS FROM `isupipe` LIKE 'livecomments'\G
# SHOW CREATE TABLE `isupipe`.`livecomments`\G
# EXPLAIN /*!50100 PARTITIONS*/
SELECT IFNULL(SUM(l2.tip), 0) FROM livestreams l INNER JOIN livecomments l2 ON l.id = l2.livestream_id WHERE l.id = '239'\G
テーブル定義はこちら。インデックスは貼られてなさそうな感じ
https://github.com/vvani06/isucon13/blob/main/sql/initdb.d/10_schema.sql
[Linux] カーネルパラメータのチューニング
[DB] icon取得時の改善としてuser_idにインデックスを貼る
isucon13/mysql/digest_20231125-043157.txt
Line 166 in ec54350
初期設定
アプリソースコード解読メモ (Ruby)
[DB] indexを張る
貼っていくものは以降コメントで
[DB] livestream_tags のスロークエリを改善する
初回のスロークエリログの筆頭
https://github.com/vvani06/isucon13/blob/main/mysql/digest_20231125-043157.txt
# Query 1: 60.72 QPS, 2.47x concurrency, ID 0xF7144185D9A142A426A36DC55C1D2623 at byte 67959722
# This item is included in the report because it matches --limit.
# Scores: V/M = 0.02
# Time range: 2023-11-25T04:28:11 to 2023-11-25T04:29:49
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count 1 5951
# Exec time 24 242s 2ms 182ms 41ms 87ms 29ms 40ms
# Lock time 3 36ms 0 20ms 6us 1us 263us 1us
# Rows sent 5 20.88k 0 11 3.59 4.96 1.84 4.96
# Rows examine 19 63.05M 10.71k 11.00k 10.85k 10.80k 151 10.80k
# Query size 0 336.84k 55 58 57.96 56.92 0.17 56.92
# String:
# Databases isupipe
# Hosts localhost
# Users isucon
# Query_time distribution
# 1us
# 10us
# 100us
# 1ms #####################
# 10ms ################################################################
# 100ms ###
# 1s
# 10s+
# Tables
# SHOW TABLE STATUS FROM `isupipe` LIKE 'livestream_tags'\G
# SHOW CREATE TABLE `isupipe`.`livestream_tags`\G
# EXPLAIN /*!50100 PARTITIONS*/
SELECT * FROM livestream_tags WHERE livestream_id = '7523'\G
テーブルそのものは単純なカラムしかない、インデックスはれたら効きそうだがどうか
https://github.com/vvani06/isucon13/blob/main/sql/initdb.d/10_schema.sql
解析ツールのインストール
pt-query-digest, alpをインストールし、使えるよう設定する
[Ruby] アイコン画像ハッシュのレスポンスにTTL設定(キャッシュ)をかける
効果は大したことないと思う・・ 2秒の間は古い画像でも良いということで、設定として容易い
Line 749 in 4356a32
[DB] タグなどでDBクエリキャッシュを検討
テスト
テスト
[DNS] PowerDNS の receiver-threads を 1 => 2 に変更する
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.