Open saza-ku opened 1 year ago
+-------+--------+-----+-----+-----+-----+-----+-----+
| COUNT | METHOD | URI | MIN | MAX | SUM | AVG | P99 |
+-------+--------+-----+-----+-----+-----+-----+-----+
+-------+--------+-----+-----+-----+-----+-----+-----+
Reading from STDIN ...
# No events processed.
http://localhost:19993/#menu_services;after=1700881209895;before=1700881289902
go tool pprof -http=0.0.0.0:1080 http://isucon3/pprof/11250300
+-------+--------+------------------------------------------+-------+-------+-------+-------+-------+
| COUNT | METHOD | URI | MIN | MAX | SUM | AVG | P99 |
+-------+--------+------------------------------------------+-------+-------+-------+-------+-------+
| 2 | GET | /api/user/.+/statistics | 4.084 | 4.148 | 8.232 | 4.116 | 4.148 |
| 2 | GET | /api/livestream/.+/statistics | 0.028 | 0.032 | 0.060 | 0.030 | 0.032 |
| 1 | POST | /api/register | 0.044 | 0.044 | 0.044 | 0.044 | 0.044 |
| 1 | POST | /api/livestream/.+ | 0.036 | 0.036 | 0.036 | 0.036 | 0.036 |
| 3 | POST | /api/livestream/.+/reaction | 0.008 | 0.012 | 0.032 | 0.011 | 0.012 |
| 2 | POST | /api/livestream/.+/livecomment | 0.012 | 0.016 | 0.028 | 0.014 | 0.016 |
| 2 | POST | /api/livestream/.+/livecomment/.+/report | 0.012 | 0.016 | 0.028 | 0.014 | 0.016 |
| 1 | POST | /api/livestream/.+/enter | 0.008 | 0.008 | 0.008 | 0.008 | 0.008 |
| 3 | POST | /api/login | 0.000 | 0.004 | 0.004 | 0.001 | 0.004 |
| 3 | GET | /api/tag | 0.000 | 0.004 | 0.004 | 0.001 | 0.004 |
| 1 | GET | /api/payment | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 |
+-------+--------+------------------------------------------+-------+-------+-------+-------+-------+
Count: 2000 Time=0.00s (3s) Lock=0.00s (0s) Rows=1.0 (2000), 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: 2000 Time=0.00s (3s) Lock=0.00s (0s) Rows=1.0 (2000), 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: 19 Time=0.00s (0s) Lock=0.00s (0s) Rows=0.0 (0), isucon[isucon]@localhost
COMMIT
Count: 2 Time=0.01s (0s) Lock=0.00s (0s) Rows=7496.0 (14992), isucon[isucon]@localhost
SELECT * FROM livestreams
Count: 8 Time=0.00s (0s) Lock=0.00s (0s) Rows=0.0 (0), isucon[isucon]@localhost
SELECT * FROM livestream_tags WHERE livestream_id = N
Count: 7 Time=0.00s (0s) Lock=0.00s (0s) Rows=1.0 (7), isucon[isucon]@localhost
SELECT slot FROM reservation_slots WHERE start_at = N AND end_at = N
Count: 2 Time=0.00s (0s) Lock=0.00s (0s) Rows=9.0 (18), isucon[isucon]@localhost
SELECT * FROM livestreams WHERE user_id = N
Count: 2 Time=0.00s (0s) Lock=0.00s (0s) Rows=0.0 (0), isucon[isucon]@localhost
SELECT id, user_id, livestream_id, word FROM ng_words WHERE user_id = N AND livestream_id = N
Reading from STDIN ...
# 480ms user time, 10ms system time, 37.12M rss, 51.34M vsz
# Current date: Sat Nov 25 03:01:30 2023
# Hostname: ip-192-168-0-12
# Files: STDIN
# Overall: 4.25k total, 56 unique, 52.44 QPS, 0.10x concurrency __________
# Time range: 2023-11-25T03:00:09 to 2023-11-25T03:01:30
# Attribute total min max avg 95% stddev median
# ============ ======= ======= ======= ======= ======= ======= =======
# Exec time 8s 1us 23ms 2ms 2ms 756us 2ms
# Lock time 5ms 0 20us 1us 1us 0 1us
# Rows sent 24.59k 0 7.32k 5.93 0.99 166.09 0.99
# Rows examine 7.92M 0 14.00k 1.91k 1.96k 703.39 1.86k
# Query size 618.31k 5 413 149.05 158.58 26.82 143.84
# Profile
# Rank Query ID Response time Calls R/Call V/M Ite
# ==== ============================== ============= ===== ====== ===== ===
# 1 0xF1B8EF06D6CA63B24BFF433E0... 3.9874 49.5% 2000 0.0020 0.00 SELECT users livestreams livecomments
# 2 0xDB74D52D39A7090F224C4DEEA... 3.8557 47.9% 2000 0.0019 0.00 SELECT users livestreams reactions
# 3 0xFFFCA4D67EA0A788813031B8B... 0.0612 0.8% 20 0.0031 0.00 COMMIT
# 4 0x050F7D44808F43E5D33D0B90B... 0.0274 0.3% 2 0.0137 0.00 SELECT livestreams
# MISC 0xMISC 0.1219 1.5% 226 0.0005 0.0 <52 ITEMS>
# Query 1: 250 QPS, 0.50x concurrency, ID 0xF1B8EF06D6CA63B24BFF433E06CCEB22 at byte 877253
# This item is included in the report because it matches --limit.
# Scores: V/M = 0.00
# Time range: 2023-11-25T03:00:10 to 2023-11-25T03:00:18
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count 47 2000
# Exec time 49 4s 2ms 23ms 2ms 2ms 617us 2ms
# Lock time 46 2ms 0 3us 1us 1us 0 1us
# Rows sent 7 1.95k 1 1 1 1 0 1
# Rows examine 48 3.82M 1.96k 1.96k 1.96k 1.96k 2 1.96k
# Query size 52 322.06k 163 166 164.89 158.58 0 158.58
# 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 'users'\G
# SHOW CREATE TABLE `isupipe`.`users`\G
# 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 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 = 163\G
# *************************** 1. row ***************************
# id: 1
# select_type: SIMPLE
# table: u
# partitions: NULL
# type: const
# possible_keys: PRIMARY
# key: PRIMARY
# key_len: 8
# ref: const
# rows: 1
# filtered: 100.00
# Extra: Using index
# *************************** 2. row ***************************
# id: 1
# select_type: SIMPLE
# table: l2
# partitions: NULL
# type: ALL
# possible_keys: NULL
# key: NULL
# key_len: NULL
# ref: NULL
# rows: 1003
# filtered: 100.00
# Extra: NULL
# *************************** 3. row ***************************
# id: 1
# select_type: SIMPLE
# table: l
# partitions: NULL
# type: eq_ref
# possible_keys: PRIMARY
# key: PRIMARY
# key_len: 8
# ref: isupipe.l2.livestream_id
# rows: 1
# filtered: 10.00
# Extra: Using where
# Query 2: 250 QPS, 0.48x concurrency, ID 0xDB74D52D39A7090F224C4DEEAF3028C9 at byte 881223
# This item is included in the report because it matches --limit.
# Scores: V/M = 0.00
# Time range: 2023-11-25T03:00:10 to 2023-11-25T03:00:18
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count 47 2000
# Exec time 47 4s 2ms 21ms 2ms 2ms 547us 2ms
# Lock time 49 2ms 1us 12us 1us 1us 0 1us
# Rows sent 7 1.95k 1 1 1 1 0 1
# Rows examine 48 3.82M 1.96k 1.96k 1.96k 1.96k 3 1.96k
# Query size 45 282.99k 143 146 144.89 143.84 0.65 143.84
# 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 'users'\G
# SHOW CREATE TABLE `isupipe`.`users`\G
# SHOW TABLE STATUS FROM `isupipe` LIKE 'livestreams'\G
# SHOW CREATE TABLE `isupipe`.`livestreams`\G
# SHOW TABLE STATUS FROM `isupipe` LIKE 'reactions'\G
# SHOW CREATE TABLE `isupipe`.`reactions`\G
# EXPLAIN
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 = 169\G
# *************************** 1. row ***************************
# id: 1
# select_type: SIMPLE
# table: u
# partitions: NULL
# type: const
# possible_keys: PRIMARY
# key: PRIMARY
# key_len: 8
# ref: const
# rows: 1
# filtered: 100.00
# Extra: Using index
# *************************** 2. row ***************************
# id: 1
# select_type: SIMPLE
# table: r
# partitions: NULL
# type: ALL
# possible_keys: NULL
# key: NULL
# key_len: NULL
# ref: NULL
# rows: 1004
# filtered: 100.00
# Extra: NULL
# *************************** 3. row ***************************
# id: 1
# select_type: SIMPLE
# table: l
# partitions: NULL
# type: eq_ref
# possible_keys: PRIMARY
# key: PRIMARY
# key_len: 8
# ref: isupipe.r.livestream_id
# rows: 1
# filtered: 10.00
# Extra: Using where
# Query 3: 2.22 QPS, 0.01x concurrency, ID 0xFFFCA4D67EA0A788813031B8BBC3B329 at byte 744662
# This item is included in the report because it matches --limit.
# Scores: V/M = 0.00
# Time range: 2023-11-25T03:00:09 to 2023-11-25T03:00:18
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count 0 20
# Exec time 0 61ms 33us 8ms 3ms 6ms 3ms 4ms
# Lock time 0 0 0 0 0 0 0 0
# Rows sent 0 0 0 0 0 0 0 0
# Rows examine 0 0 0 0 0 0 0 0
# Query size 0 120 6 6 6 6 0 6
# String:
# Databases isupipe (19/95%), isudns (1/5%)
# Hosts localhost
# Users isucon (19/95%), isudns (1/5%)
# Query_time distribution
# 1us
# 10us ####################################################
# 100us
# 1ms ################################################################
# 10ms
# 100ms
# 1s
# 10s+
COMMIT\G
# Query 4: 0.50 QPS, 0.01x concurrency, ID 0x050F7D44808F43E5D33D0B90BCF57CC9 at byte 733021
# This item is included in the report because it matches --limit.
# Scores: V/M = 0.00
# Time range: 2023-11-25T03:00:14 to 2023-11-25T03:00:18
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count 0 2
# Exec time 0 27ms 13ms 14ms 14ms 14ms 464us 14ms
# Lock time 0 1us 0 1us 0 1us 0 0
# Rows sent 59 14.64k 7.32k 7.32k 7.32k 7.32k 0 7.32k
# Rows examine 0 14.64k 7.32k 7.32k 7.32k 7.32k 0 7.32k
# Query size 0 50 25 25 25 25 0 25
# 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
# EXPLAIN
SELECT * FROM livestreams\G
# *************************** 1. row ***************************
# id: 1
# select_type: SIMPLE
# table: livestreams
# partitions: NULL
# type: ALL
# possible_keys: NULL
# key: NULL
# key_len: NULL
# ref: NULL
# rows: 7229
# filtered: 100.00
# Extra: NULL
http://localhost:19992/#menu_services;after=1700881209896;before=1700881289904
go tool pprof -http=0.0.0.0:1080 http://isucon2/pprof/11250300
isucon1
alp
slow query
explain
netdata
http://localhost:19991/#menu_services;after=1700881209913;before=1700881285901
pprof