Open saza-ku opened 10 months ago
+-------+--------+-----+-----+-----+-----+-----+-----+
| COUNT | METHOD | URI | MIN | MAX | SUM | AVG | P99 |
+-------+--------+-----+-----+-----+-----+-----+-----+
+-------+--------+-----+-----+-----+-----+-----+-----+
Count: 51 Time=0.00s (0s) Lock=0.00s (0s) Rows=0.8 (41), isudns[isudns]@isucon1
SELECT content,ttl,prio,type,domain_id,disabled,name,auth FROM records WHERE disabled=N and name='S' and domain_id=N
Count: 47 Time=0.00s (0s) Lock=0.00s (0s) Rows=0.5 (24), isudns[isudns]@isucon1
SELECT content,ttl,prio,type,domain_id,disabled,name,auth FROM records WHERE disabled=N and type='S' and name='S'
Count: 54 Time=0.00s (0s) Lock=0.00s (0s) Rows=0.0 (0), isudns[isudns]@isucon1
select kind,content from domains, domainmetadata where domainmetadata.domain_id=domains.id and name='S'
Count: 146 Time=0.00s (0s) Lock=0.00s (0s) Rows=0.0 (0), isudns[isudns]@isucon1
#
Count: 1 Time=0.00s (0s) Lock=0.00s (0s) Rows=0.0 (0), isudns[isudns]@isucon1
delete from records where domain_id=N and name='S' and type='S'
Count: 2 Time=0.00s (0s) Lock=0.00s (0s) Rows=0.5 (1), isudns[isudns]@isucon1
SELECT content,ttl,prio,type,domain_id,disabled,name,auth FROM records WHERE disabled=N and type='S' and name='S' and domain_id=N
Count: 1 Time=0.00s (0s) Lock=0.00s (0s) Rows=0.0 (0), isudns[isudns]@isucon1
insert into records (content,ttl,prio,type,domain_id,disabled,name,ordername,auth) values ('S',N,N,'S',N,N,'S',NULL,N)
Count: 1 Time=0.00s (0s) Lock=0.00s (0s) Rows=1.0 (1), isudns[isudns]@isucon1
select id,name,master,last_check,notified_serial,type,options,catalog,account from domains where name='S'
Count: 1 Time=0.00s (0s) Lock=0.00s (0s) Rows=0.0 (0), isudns[isudns]@isucon1
commit
Count: 2 Time=0.00s (0s) Lock=0.00s (0s) Rows=0.0 (0), isudns[isudns]@isucon1
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED
Reading from STDIN ...
# 160ms user time, 10ms system time, 36.38M rss, 50.69M vsz
# Current date: Sat Nov 25 07:28:46 2023
# Hostname: ip-192-168-0-12
# Files: STDIN
# Overall: 314 total, 20 unique, 3.92 QPS, 0.00x concurrency _____________
# Time range: 2023-11-25T07:27:26 to 2023-11-25T07:28:46
# Attribute total min max avg 95% stddev median
# ============ ======= ======= ======= ======= ======= ======= =======
# Exec time 93ms 1us 4ms 296us 761us 432us 80us
# Lock time 180us 0 23us 0 1us 1us 0
# Rows sent 71 0 1 0.23 0.99 0.42 0
# Rows examine 126.27k 0 1.25k 411.79 1.20k 574.94 0
# Query size 24.52k 5 195 79.96 136.99 47.79 112.70
# Profile
# Rank Query ID Response time Calls R/Call V/M It
# ==== =============================== ============= ===== ====== ===== ==
# 1 0x42EF7D7D98FBCC9723BF896EBF... 0.0401 43.0% 51 0.0008 0.00 SELECT records
# 2 0x3D83BC87F3B3A00D571FFC8104... 0.0372 39.9% 47 0.0008 0.00 SELECT records
# 3 0x22279D81D51006139E0C76405B... 0.0052 5.6% 54 0.0001 0.00 SELECT domains domainmetadata
# 4 0xE77769C62EF669AA7DD5F6760F... 0.0047 5.0% 2 0.0023 0.00 SHOW VARIABLES
# MISC 0xMISC 0.0061 6.5% 160 0.0000 0.0 <16 ITEMS>
# Query 1: 0 QPS, 0x concurrency, ID 0x42EF7D7D98FBCC9723BF896EBFC51D24 at byte 3308
# This item is included in the report because it matches --limit.
# Scores: V/M = 0.00
# Time range: all events occurred at 2023-11-25T07:27:26
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count 16 51
# Exec time 43 40ms 701us 2ms 786us 799us 212us 725us
# Lock time 24 44us 0 1us 0 1us 0 1us
# Rows sent 57 41 0 1 0.80 0.99 0.39 0.99
# Rows examine 50 63.76k 1.25k 1.25k 1.25k 1.20k 0 1.20k
# Query size 27 6.75k 129 144 135.51 143.84 5.09 130.47
# String:
# Hosts isucon1
# Users isudns
# Query_time distribution
# 1us
# 10us
# 100us ################################################################
# 1ms ####
# 10ms
# 100ms
# 1s
# 10s+
# Tables
# SHOW TABLE STATUS LIKE 'records'\G
# SHOW CREATE TABLE `records`\G
# EXPLAIN /*!50100 PARTITIONS*/
SELECT content,ttl,prio,type,domain_id,disabled,name,auth FROM records WHERE disabled=0 and name='snpp.u.isucon.dev' and domain_id=4\G
# EXPLAIN failed: DBD::mysql::st execute failed: Table 'isupipe.records' doesn't exist [for Statement "EXPLAIN SELECT content,ttl,prio,type,domain_id,disabled,name,auth FROM records WHERE disabled=0 and name='snpp.u.isucon.dev' and domain_id=4"] at /usr/bin/pt-query-digest line 7796.
# Query 2: 0 QPS, 0x concurrency, ID 0x3D83BC87F3B3A00D571FFC8104A6E50C at byte 22511
# This item is included in the report because it matches --limit.
# Scores: V/M = 0.00
# Time range: all events occurred at 2023-11-25T07:27:26
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count 14 47
# Exec time 39 37ms 658us 3ms 791us 1ms 362us 690us
# Lock time 26 47us 0 2us 1us 1us 0 1us
# Rows sent 33 24 0 1 0.51 0.99 0.50 0.99
# Rows examine 46 58.76k 1.25k 1.25k 1.25k 1.20k 0.00 1.20k
# Query size 24 5.98k 126 143 130.34 136.99 4.92 124.25
# String:
# Hosts isucon1
# Users isudns
# Query_time distribution
# 1us
# 10us
# 100us ################################################################
# 1ms #####
# 10ms
# 100ms
# 1s
# 10s+
# Tables
# SHOW TABLE STATUS LIKE 'records'\G
# SHOW CREATE TABLE `records`\G
# EXPLAIN
SELECT content,ttl,prio,type,domain_id,disabled,name,auth FROM records WHERE disabled=0 and type='SOA' and name='u.isucon.dev'\G
# EXPLAIN failed: DBD::mysql::st execute failed: Table 'isupipe.records' doesn't exist [for Statement "EXPLAIN SELECT content,ttl,prio,type,domain_id,disabled,name,auth FROM records WHERE disabled=0 and type='SOA' and name='u.isucon.dev'"] at /usr/bin/pt-query-digest line 7796.
# Query 3: 0 QPS, 0x concurrency, ID 0x22279D81D51006139E0C76405B54C261 at byte 5015
# This item is included in the report because it matches --limit.
# Scores: V/M = 0.00
# Time range: all events occurred at 2023-11-25T07:27:26
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count 17 54
# Exec time 5 5ms 73us 198us 96us 125us 23us 84us
# Lock time 45 81us 0 23us 1us 1us 2us 1us
# Rows sent 0 0 0 0 0 0 0 0
# Rows examine 0 0 0 0 0 0 0 0
# Query size 24 6.01k 114 114 114 114 0 114
# String:
# Hosts isucon1
# Users isudns
# Query_time distribution
# 1us
# 10us ################################################################
# 100us ######################
# 1ms
# 10ms
# 100ms
# 1s
# 10s+
# Tables
# SHOW TABLE STATUS LIKE 'domains'\G
# SHOW CREATE TABLE `domains`\G
# SHOW TABLE STATUS LIKE 'domainmetadata'\G
# SHOW CREATE TABLE `domainmetadata`\G
# EXPLAIN
select kind,content from domains, domainmetadata where domainmetadata.domain_id=domains.id and name='u.isucon.dev'\G
# EXPLAIN failed: DBD::mysql::st execute failed: Table 'isupipe.domains' doesn't exist [for Statement "EXPLAIN select kind,content from domains, domainmetadata where domainmetadata.domain_id=domains.id and name='u.isucon.dev'"] at /usr/bin/pt-query-digest line 7796.
# Query 4: 0 QPS, 0x concurrency, ID 0xE77769C62EF669AA7DD5F6760F2D2EBB at byte 87669
# This item is included in the report because it matches --limit.
# Scores: V/M = 0.00
# Time range: all events occurred at 2023-11-25T07:28:46
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count 0 2
# Exec time 5 5ms 915us 4ms 2ms 4ms 2ms 2ms
# Lock time 2 4us 1us 3us 2us 3us 1us 2us
# Rows sent 2 2 1 1 1 1 0 1
# Rows examine 0 2 1 1 1 1 0 1
# Query size 0 77 35 42 38.50 42 4.95 38.50
# String:
# Databases isupipe
# Hosts localhost
# Users isucon
# Query_time distribution
# 1us
# 10us
# 100us ################################################################
# 1ms ################################################################
# 10ms
# 100ms
# 1s
# 10s+
SHOW VARIABLES LIKE 'wait\_timeout'\G
http://localhost:19992/#menu_services;after=1700897246229;before=1700897326239
go tool pprof -http=0.0.0.0:1080 http://isucon2/pprof/11250727
+-------+--------+-----+-----+-----+-----+-----+-----+
| COUNT | METHOD | URI | MIN | MAX | SUM | AVG | P99 |
+-------+--------+-----+-----+-----+-----+-----+-----+
+-------+--------+-----+-----+-----+-----+-----+-----+
Count: 2 Time=0.01s (0s) Lock=0.00s (0s) Rows=7496.0 (14992), isucon[isucon]@isucon1
SELECT * FROM livestreams
Count: 2 Time=0.01s (0s) Lock=0.00s (0s) Rows=0.0 (0), isucon[isucon]@isucon1
UPDATE reservation_slots SET slot = slot - N WHERE start_at >= N AND end_at <= N
Count: 2 Time=0.01s (0s) Lock=0.00s (0s) Rows=4.0 (8), isucon[isucon]@isucon1
SELECT * FROM reservation_slots WHERE start_at >= N AND end_at <= N FOR UPDATE
Count: 2 Time=0.00s (0s) Lock=0.00s (0s) Rows=9.0 (18), isucon[isucon]@isucon1
SELECT * FROM livestreams WHERE user_id = N
Count: 2 Time=0.00s (0s) Lock=0.00s (0s) Rows=632.5 (1265), isucon[isucon]@isucon1
SELECT u.id AS id, COUNT(*) AS count FROM users u
INNER JOIN livestreams l ON l.user_id = u.id
INNER JOIN reactions r ON r.livestream_id = l.id
GROUP BY u.id
Count: 18 Time=0.00s (0s) Lock=0.00s (0s) Rows=0.2 (4), isucon[isucon]@isucon1
SELECT * FROM livecomments WHERE livestream_id = N
Count: 2 Time=0.00s (0s) Lock=0.00s (0s) Rows=642.0 (1284), isucon[isucon]@isucon1
SELECT u.id AS id, IFNULL(SUM(l2.tip), N) AS count FROM users u
INNER JOIN livestreams l ON l.user_id = u.id
INNER JOIN livecomments l2 ON l2.livestream_id = l.id
GROUP BY u.id
Count: 20 Time=0.00s (0s) Lock=0.00s (0s) Rows=1.0 (20), isucon[isucon]@isucon1
SELECT * FROM themes WHERE user_id = N
Reading from STDIN ...
# 160ms user time, 10ms system time, 36.75M rss, 51.06M vsz
# Current date: Sat Nov 25 07:28:46 2023
# Hostname: ip-192-168-0-13
# Files: STDIN
# Overall: 278 total, 54 unique, 3.48 QPS, 0.00x concurrency _____________
# Time range: 2023-11-25T07:27:26 to 2023-11-25T07:28:46
# Attribute total min max avg 95% stddev median
# ============ ======= ======= ======= ======= ======= ======= =======
# Exec time 107ms 14us 8ms 385us 2ms 1ms 60us
# Lock time 144us 0 5us 0 1us 0 0
# Rows sent 23.85k 0 7.32k 87.86 112.70 648.35 0.99
# Rows examine 147.52k 0 10.72k 543.40 1.96k 1.51k 0.99
# Query size 18.18k 6 724 66.97 166.51 97.72 40.45
# Profile
# Rank Query ID Response time Calls R/Call V/M It
# ==== =============================== ============= ===== ====== ===== ==
# 1 0x050F7D44808F43E5D33D0B90BC... 0.0163 15.2% 2 0.0082 0.00 SELECT livestreams
# 2 0xA3401CA3ABCC04C3AB221DB8AD... 0.0105 9.8% 2 0.0053 0.00 UPDATE reservation_slots
# 3 0x7F9C0C0BA9473953B723EE16C0... 0.0103 9.7% 2 0.0052 0.00 SELECT reservation_slots
# 4 0x9EAD6C0CE525E3693EE27FFC9A... 0.0090 8.4% 2 0.0045 0.00 SELECT livestreams
# MISC 0xMISC 0.0610 56.9% 270 0.0002 0.0 <50 ITEMS>
# Query 1: 0 QPS, 0x concurrency, ID 0x050F7D44808F43E5D33D0B90BCF57CC9 at byte 46874
# This item is included in the report because it matches --limit.
# Scores: V/M = 0.00
# Time range: all events occurred at 2023-11-25T07:27:26
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count 0 2
# Exec time 15 16ms 8ms 8ms 8ms 8ms 207us 8ms
# Lock time 0 0 0 0 0 0 0 0
# Rows sent 61 14.64k 7.32k 7.32k 7.32k 7.32k 0 7.32k
# Rows examine 9 14.64k 7.32k 7.32k 7.32k 7.32k 0 7.32k
# Query size 0 50 25 25 25 25 0 25
# String:
# Hosts isucon1
# Users isucon
# Query_time distribution
# 1us
# 10us
# 100us
# 1ms ################################################################
# 10ms
# 100ms
# 1s
# 10s+
# Tables
# SHOW TABLE STATUS LIKE 'livestreams'\G
# SHOW CREATE TABLE `livestreams`\G
# EXPLAIN /*!50100 PARTITIONS*/
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: 7341
# filtered: 100.00
# Extra: NULL
# Query 2: 0 QPS, 0x concurrency, ID 0xA3401CA3ABCC04C3AB221DB8AD5CBF26 at byte 1883
# This item is included in the report because it matches --limit.
# Scores: V/M = 0.00
# Time range: all events occurred at 2023-11-25T07:27:26
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count 0 2
# Exec time 9 11ms 5ms 5ms 5ms 5ms 47us 5ms
# Lock time 1 2us 1us 1us 1us 1us 0 1us
# Rows sent 0 0 0 0 0 0 0 0
# Rows examine 11 17.11k 8.55k 8.55k 8.55k 8.55k 0 8.55k
# Query size 1 196 98 98 98 98 0 98
# String:
# Hosts isucon1
# Users isucon
# Query_time distribution
# 1us
# 10us
# 100us
# 1ms ################################################################
# 10ms
# 100ms
# 1s
# 10s+
# Tables
# SHOW TABLE STATUS LIKE 'reservation_slots'\G
# SHOW CREATE TABLE `reservation_slots`\G
UPDATE reservation_slots SET slot = slot - 1 WHERE start_at >= 1700874000 AND end_at <= 1700899200\G
# Converted for EXPLAIN
# EXPLAIN
select slot = slot - 1 from reservation_slots where start_at >= 1700874000 AND end_at <= 1700899200\G
# Query 3: 0 QPS, 0x concurrency, ID 0x7F9C0C0BA9473953B723EE16C08655F1 at byte 1581
# This item is included in the report because it matches --limit.
# Scores: V/M = 0.00
# Time range: all events occurred at 2023-11-25T07:27:26
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count 0 2
# Exec time 9 10ms 5ms 5ms 5ms 5ms 186us 5ms
# Lock time 1 2us 1us 1us 1us 1us 0 1us
# Rows sent 0 8 1 7 4 7 4.24 4
# Rows examine 11 17.11k 8.55k 8.55k 8.55k 8.55k 0 8.55k
# Query size 1 192 96 96 96 96 0 96
# String:
# Hosts isucon1
# Users isucon
# Query_time distribution
# 1us
# 10us
# 100us
# 1ms ################################################################
# 10ms
# 100ms
# 1s
# 10s+
# Tables
# SHOW TABLE STATUS LIKE 'reservation_slots'\G
# SHOW CREATE TABLE `reservation_slots`\G
# EXPLAIN
SELECT * FROM reservation_slots WHERE start_at >= 1700874000 AND end_at <= 1700899200 FOR UPDATE\G
# *************************** 1. row ***************************
# id: 1
# select_type: SIMPLE
# table: reservation_slots
# partitions: NULL
# type: ALL
# possible_keys: NULL
# key: NULL
# key_len: NULL
# ref: NULL
# rows: 8773
# filtered: 11.11
# Extra: Using where
# Query 4: 0 QPS, 0x concurrency, ID 0x9EAD6C0CE525E3693EE27FFC9AAF05A3 at byte 5799
# This item is included in the report because it matches --limit.
# Scores: V/M = 0.00
# Time range: all events occurred at 2023-11-25T07:27:26
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count 0 2
# Exec time 8 9ms 4ms 5ms 4ms 5ms 40us 4ms
# Lock time 1 2us 1us 1us 1us 1us 0 1us
# Rows sent 0 18 9 9 9 9 0 9
# Rows examine 9 14.64k 7.32k 7.32k 7.32k 7.32k 0 7.32k
# Query size 0 88 44 44 44 44 0 44
# String:
# Hosts isucon1
# Users isucon
# Query_time distribution
# 1us
# 10us
# 100us
# 1ms ################################################################
# 10ms
# 100ms
# 1s
# 10s+
# Tables
# SHOW TABLE STATUS LIKE 'livestreams'\G
# SHOW CREATE TABLE `livestreams`\G
# EXPLAIN
SELECT * FROM livestreams WHERE user_id = 22\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: 7341
# filtered: 10.00
# Extra: Using where
http://localhost:19993/#menu_services;after=1700897246208;before=1700897326215
go tool pprof -http=0.0.0.0:1080 http://isucon3/pprof/11250727
isucon1
alp
slow query
explain
netdata
http://localhost:19991/#menu_services;after=1700897246189;before=1700897322364
pprof