Open saza-ku opened 1 year ago
+-------+--------+-----+-----+-----+-----+-----+-----+
| COUNT | METHOD | URI | MIN | MAX | SUM | AVG | P99 |
+-------+--------+-----+-----+-----+-----+-----+-----+
+-------+--------+-----+-----+-----+-----+-----+-----+
Count: 30753 Time=0.00s (58s) Lock=0.00s (0s) Rows=0.2 (7596), 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: 23002 Time=0.00s (40s) Lock=0.00s (0s) Rows=0.5 (11685), 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: 36744 Time=0.00s (4s) 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: 600 Time=0.00s (2s) 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: 1200 Time=0.00s (2s) Lock=0.00s (0s) Rows=0.5 (600), 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: 91625 Time=0.00s (1s) Lock=0.00s (0s) Rows=0.0 (0), isudns[isudns]@isucon1
#
Count: 600 Time=0.00s (0s) Lock=0.00s (0s) Rows=0.0 (0), isudns[isudns]@isucon1
commit
Count: 600 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: 600 Time=0.00s (0s) Lock=0.00s (0s) Rows=1.0 (600), isudns[isudns]@isucon1
select id,name,master,last_check,notified_serial,type,options,catalog,account from domains where name='S'
Count: 1200 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 ...
# 11.5s user time, 80ms system time, 36.88M rss, 51.20M vsz
# Current date: Sat Nov 25 08:32:11 2023
# Hostname: ip-192-168-0-12
# Files: STDIN
# Overall: 187.53k total, 22 unique, 2.29k QPS, 1.35x concurrency ________
# Time range: 2023-11-25T08:30:37 to 2023-11-25T08:31:59
# Attribute total min max avg 95% stddev median
# ============ ======= ======= ======= ======= ======= ======= =======
# Exec time 111s 1us 12ms 589us 2ms 899us 89us
# Lock time 171ms 0 5ms 0 1us 25us 0
# Rows sent 20.01k 0 3 0.11 0.99 0.31 0
# Rows examine 84.07M 0 1.84k 470.09 1.69k 713.05 0
# Query size 14.41M 5 219 80.58 151.03 48.66 51.63
# Profile
# Rank Query ID Response time Calls R/Call V/M Item
# ==== ============================= ============= ===== ====== ===== ====
# 1 0x42EF7D7D98FBCC9723BF896E... 58.5864 53.0% 30753 0.0019 0.00 SELECT records
# 2 0x3D83BC87F3B3A00D571FFC81... 40.7803 36.9% 23002 0.0018 0.00 SELECT records
# 3 0x22279D81D51006139E0C7640... 4.6320 4.2% 36744 0.0001 0.00 SELECT domains domainmetadata
# 4 0x859BBB7E9D760686137A9444... 2.5454 2.3% 600 0.0042 0.00 DELETE records
# MISC 0xMISC 4.0908 3.7% 96434 0.0000 0.0 <18 ITEMS>
# Query 1: 465.95 QPS, 0.89x concurrency, ID 0x42EF7D7D98FBCC9723BF896EBFC51D24 at byte 52805339
# This item is included in the report because it matches --limit.
# Scores: V/M = 0.00
# Time range: 2023-11-25T08:30:37 to 2023-11-25T08:31:43
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count 16 30753
# Exec time 52 59s 698us 11ms 2ms 3ms 652us 2ms
# Lock time 31 53ms 0 5ms 1us 1us 42us 1us
# Rows sent 37 7.42k 0 1 0.25 0.99 0.43 0
# Rows examine 55 46.49M 1.25k 1.83k 1.55k 1.78k 166.06 1.53k
# Query size 28 4.14M 129 219 141.27 158.58 11.49 136.99
# 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='*.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='*.u.isucon.dev' and domain_id=4"] at /usr/bin/pt-query-digest line 7796.
# Query 2: 348.52 QPS, 0.62x concurrency, ID 0x3D83BC87F3B3A00D571FFC8104A6E50C at byte 42469075
# This item is included in the report because it matches --limit.
# Scores: V/M = 0.00
# Time range: 2023-11-25T08:30:37 to 2023-11-25T08:31:43
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count 12 23002
# Exec time 36 41s 663us 12ms 2ms 3ms 605us 2ms
# Lock time 17 30ms 0 704us 1us 1us 5us 1us
# Rows sent 57 11.41k 0 1 0.51 0.99 0.50 0.99
# Rows examine 41 34.87M 1.25k 1.83k 1.55k 1.78k 166.57 1.53k
# Query size 20 2.96M 126 218 134.91 151.03 10.78 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: 556.73 QPS, 0.07x concurrency, ID 0x22279D81D51006139E0C76405B54C261 at byte 27097446
# This item is included in the report because it matches --limit.
# Scores: V/M = 0.00
# Time range: 2023-11-25T08:30:37 to 2023-11-25T08:31:43
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count 19 36744
# Exec time 4 5s 70us 8ms 126us 167us 114us 108us
# Lock time 34 58ms 0 1ms 1us 1us 9us 1us
# Rows sent 0 0 0 0 0 0 0 0
# Rows examine 0 0 0 0 0 0 0 0
# Query size 27 3.99M 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: 9.09 QPS, 0.04x concurrency, ID 0x859BBB7E9D760686137A944406874C4D at byte 53378360
# This item is included in the report because it matches --limit.
# Scores: V/M = 0.00
# Time range: 2023-11-25T08:30:37 to 2023-11-25T08:31:43
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count 0 600
# Exec time 2 3s 2ms 12ms 4ms 7ms 1ms 4ms
# Lock time 15 26ms 0 4ms 43us 1us 312us 1us
# Rows sent 0 0 0 0 0 0 0 0
# Rows examine 1 925.48k 1.25k 1.83k 1.54k 1.78k 171.08 1.53k
# Query size 0 50.11k 78 93 85.53 88.31 3.35 84.10
# 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
delete from records where domain_id=4 and name='yoichinakamura0.u.isucon.dev' and type='A'\G
# Converted for EXPLAIN
# EXPLAIN
select * from records where domain_id=4 and name='yoichinakamura0.u.isucon.dev' and type='A'\G
http://localhost:19992/#menu_services;after=1700901037191;before=1700901117198
go tool pprof -http=0.0.0.0:1080 http://isucon2/pprof/11250830
+-------+--------+-----+-----+-----+-----+-----+-----+
| COUNT | METHOD | URI | MIN | MAX | SUM | AVG | P99 |
+-------+--------+-----+-----+-----+-----+-----+-----+
+-------+--------+-----+-----+-----+-----+-----+-----+
Count: 29794 Time=0.00s (23s) Lock=0.00s (0s) Rows=1.0 (29794), isucon[isucon]@isucon1
SELECT * FROM themes WHERE user_id = N
Count: 918 Time=0.01s (12s) Lock=0.00s (0s) Rows=2.8 (2528), isucon[isucon]@isucon1
SELECT * FROM livestreams WHERE user_id = N
Count: 613 Time=0.01s (8s) 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: 614 Time=0.01s (7s) Lock=0.00s (0s) Rows=10.1 (6181), isucon[isucon]@isucon1
SELECT * FROM reservation_slots WHERE start_at >= N AND end_at <= N FOR UPDATE
Count: 20345 Time=0.00s (4s) Lock=0.00s (0s) Rows=5.0 (101223), isucon[isucon]@isucon1
SELECT livestream_id, tags.id AS tag_id, tags.name as tag_name FROM livestream_tags as l LEFT JOIN tags ON l.tag_id = tags.id WHERE livestream_id = N
Count: 1142 Time=0.00s (4s) Lock=0.00s (0s) Rows=3019.5 (3448238), isucon[isucon]@isucon1
SELECT * FROM livecomments
Count: 1847 Time=0.00s (3s) Lock=0.00s (0s) Rows=245.5 (453459), isucon[isucon]@isucon1
SELECT livestream_id, tags.id AS tag_id, tags.name as tag_name FROM livestream_tags as l LEFT JOIN tags ON l.tag_id = tags.id WHERE livestream_id IN (N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N)
Count: 29153 Time=0.00s (3s) Lock=0.00s (0s) Rows=1.0 (29153), isucon[isucon]@isucon1
SELECT * FROM users WHERE id = N
Count: 30565 Time=0.00s (3s) Lock=0.00s (0s) Rows=1.0 (30565), isucon[isucon]@isucon1
SELECT * FROM livestreams WHERE id = N
Count: 29454 Time=0.00s (3s) Lock=0.00s (0s) Rows=0.0 (0), isucon[isucon]@isucon1
COMMIT
Reading from STDIN ...
# 17.2s user time, 60ms system time, 38.12M rss, 52.43M vsz
# Current date: Sat Nov 25 08:32:17 2023
# Hostname: ip-192-168-0-13
# Files: STDIN
# Overall: 264.83k total, 66 unique, 2.98k QPS, 1.16x concurrency ________
# Time range: 2023-11-25T08:30:37 to 2023-11-25T08:32:06
# Attribute total min max avg 95% stddev median
# ============ ======= ======= ======= ======= ======= ======= =======
# Exec time 103s 1us 78ms 388us 1ms 2ms 93us
# Lock time 266ms 0 5ms 1us 1us 22us 1us
# Rows sent 4.82M 0 7.90k 19.09 16.81 224.49 0.99
# Rows examine 78.48M 0 15.72k 310.74 1.39k 919.23 0.99
# Query size 15.35M 6 1000 60.77 151.03 69.54 40.45
# Profile
# Rank Query ID Response time Calls R/Call V/M Item
# ==== ============================ ============= ====== ====== ===== ====
# 1 0x38BC86A45F31C6B1EE32467... 23.9185 23.2% 29794 0.0008 0.00 SELECT themes
# 2 0x9EAD6C0CE525E3693EE27FF... 12.6298 12.3% 918 0.0138 0.00 SELECT livestreams
# 3 0xA3401CA3ABCC04C3AB221DB... 8.3690 8.1% 613 0.0137 0.00 UPDATE reservation_slots
# 4 0x5A8A79FB9E5D1635CA10FEA... 7.8343 7.6% 9799 0.0008 0.00 SELECT themes
# MISC 0xMISC 50.2502 48.8% 223705 0.0002 0.0 <62 ITEMS>
# Query 1: 451.42 QPS, 0.36x concurrency, ID 0x38BC86A45F31C6B1EE324671506C898A at byte 19414449
# This item is included in the report because it matches --limit.
# Scores: V/M = 0.00
# Time range: 2023-11-25T08:30:37 to 2023-11-25T08:31:43
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count 11 29794
# Exec time 23 24s 239us 16ms 802us 2ms 741us 596us
# Lock time 14 37ms 0 3ms 1us 1us 25us 1us
# Rows sent 0 29.10k 1 1 1 1 0 1
# Rows examine 47 37.40M 1000 1.56k 1.29k 1.53k 167.80 1.26k
# Query size 7 1.16M 38 41 41.00 40.45 0.10 40.45
# String:
# Hosts isucon1
# Users isucon
# Query_time distribution
# 1us
# 10us
# 100us ################################################################
# 1ms ##########
# 10ms #
# 100ms
# 1s
# 10s+
# Tables
# SHOW TABLE STATUS LIKE 'themes'\G
# SHOW CREATE TABLE `themes`\G
# EXPLAIN /*!50100 PARTITIONS*/
SELECT * FROM themes WHERE user_id = 1013\G
# *************************** 1. row ***************************
# id: 1
# select_type: SIMPLE
# table: themes
# partitions: NULL
# type: ALL
# possible_keys: NULL
# key: NULL
# key_len: NULL
# ref: NULL
# rows: 1600
# filtered: 10.00
# Extra: Using where
# Query 2: 13.91 QPS, 0.19x concurrency, ID 0x9EAD6C0CE525E3693EE27FFC9AAF05A3 at byte 50788743
# This item is included in the report because it matches --limit.
# Scores: V/M = 0.00
# Time range: 2023-11-25T08:30:37 to 2023-11-25T08:31:43
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count 0 918
# Exec time 12 13s 4ms 51ms 14ms 26ms 6ms 12ms
# Lock time 0 966us 0 97us 1us 1us 3us 1us
# Rows sent 0 2.47k 0 21 2.75 7.70 2.93 1.96
# Rows examine 8 6.87M 7.32k 7.92k 7.66k 7.68k 187.06 7.68k
# Query size 0 41.23k 43 46 45.99 44.60 0.14 44.60
# 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 = 1189\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: 7952
# filtered: 10.00
# Extra: Using where
# Query 3: 9.29 QPS, 0.13x concurrency, ID 0xA3401CA3ABCC04C3AB221DB8AD5CBF26 at byte 54994065
# This item is included in the report because it matches --limit.
# Scores: V/M = 0.00
# Time range: 2023-11-25T08:30:37 to 2023-11-25T08:31:43
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count 0 613
# Exec time 8 8s 5ms 47ms 14ms 27ms 7ms 12ms
# Lock time 0 692us 0 126us 1us 1us 5us 1us
# Rows sent 0 0 0 0 0 0 0 0
# Rows examine 6 5.12M 8.55k 8.55k 8.55k 8.55k 0 8.55k
# Query size 0 58.67k 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 >= 1705197600 AND end_at <= 1705204800\G
# Converted for EXPLAIN
# EXPLAIN
select slot = slot - 1 from reservation_slots where start_at >= 1705197600 AND end_at <= 1705204800\G
# Query 4: 148.47 QPS, 0.12x concurrency, ID 0x5A8A79FB9E5D1635CA10FEA9BAB68CB0 at byte 68949009
# This item is included in the report because it matches --limit.
# Scores: V/M = 0.00
# Time range: 2023-11-25T08:30:37 to 2023-11-25T08:31:43
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count 3 9799
# Exec time 7 8s 245us 14ms 799us 2ms 659us 626us
# Lock time 4 12ms 0 846us 1us 1us 13us 1us
# Rows sent 1 96.03k 1 142 10.03 49.17 18.09 1.96
# Rows examine 15 12.30M 1001 1.56k 1.29k 1.53k 166.68 1.26k
# Query size 6 956.45k 44 756 99.95 329.68 104.19 49.17
# String:
# Hosts isucon1
# Users isucon
# Query_time distribution
# 1us
# 10us
# 100us ################################################################
# 1ms ##########
# 10ms #
# 100ms
# 1s
# 10s+
# Tables
# SHOW TABLE STATUS LIKE 'themes'\G
# SHOW CREATE TABLE `themes`\G
# EXPLAIN
SELECT * FROM themes WHERE user_id IN (1345)\G
# *************************** 1. row ***************************
# id: 1
# select_type: SIMPLE
# table: themes
# partitions: NULL
# type: ALL
# possible_keys: NULL
# key: NULL
# key_len: NULL
# ref: NULL
# rows: 1600
# filtered: 10.00
# Extra: Using where
http://localhost:19993/#menu_services;after=1700901037191;before=1700901117198
go tool pprof -http=0.0.0.0:1080 http://isucon3/pprof/11250830
isucon1
alp
slow query
explain
netdata
http://localhost:19991/#menu_services;after=1700901037175;before=1700901113321
pprof