saza-ku / isucon13

0 stars 0 forks source link

11250221 #9

Open saza-ku opened 1 year ago

saza-ku commented 1 year ago

isucon1

alp

+-------+--------+--------------------------------+--------+--------+---------+--------+--------+
| COUNT | METHOD |              URI               |  MIN   |  MAX   |   SUM   |  AVG   |  P99   |
+-------+--------+--------------------------------+--------+--------+---------+--------+--------+
| 6     | GET    | /api/livestream/.+/statistics  | 29.052 | 29.860 | 177.180 | 29.530 | 29.860 |
| 1     | GET    | /api/livestream/.+             | 0.152  | 0.152  | 0.152   | 0.152  | 0.152  |
| 20    | GET    | /api/livestream/.+/livecomment | 0.000  | 0.004  | 0.032   | 0.002  | 0.004  |
| 20    | GET    | /api/livestream/.+/reaction    | 0.000  | 0.004  | 0.008   | 0.000  | 0.004  |
| 1     | GET    | /api/user/.+                   | 0.004  | 0.004  | 0.004   | 0.004  | 0.004  |
| 1     | GET    | /api/tag                       | 0.000  | 0.000  | 0.000   | 0.000  | 0.000  |
+-------+--------+--------------------------------+--------+--------+---------+--------+--------+

slow query

Count: 16745  Time=0.00s (17s)  Lock=0.00s (0s)  Rows=1.0 (16745), isucon[isucon]@localhost
  SELECT IFNULL(SUM(l2.tip), N) FROM livestreams l INNER JOIN livecomments l2 ON l.id = l2.livestream_id WHERE l.id = N

Count: 16744  Time=0.00s (14s)  Lock=0.00s (0s)  Rows=1.0 (16744), isucon[isucon]@localhost
  SELECT COUNT(*) FROM livestreams l INNER JOIN reactions r ON l.id = r.livestream_id WHERE l.id = N

Count: 10  Time=0.01s (0s)  Lock=0.00s (0s)  Rows=0.0 (0), isucon[isucon]@localhost
  SELECT * FROM livestream_tags WHERE livestream_id = N

Count: 56  Time=0.00s (0s)  Lock=0.00s (0s)  Rows=0.8 (44), 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: 52  Time=0.00s (0s)  Lock=0.00s (0s)  Rows=0.5 (26), 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: 11  Time=0.00s (0s)  Lock=0.00s (0s)  Rows=1.0 (11), isucon[isucon]@localhost
  SELECT * FROM themes WHERE user_id = N

Count: 14  Time=0.00s (0s)  Lock=0.00s (0s)  Rows=0.0 (0), isucon[isucon]@localhost
  SELECT * FROM livecomments WHERE livestream_id = N ORDER BY created_at DESC LIMIT N

Count: 2  Time=0.00s (0s)  Lock=0.00s (0s)  Rows=1.0 (2), isucon[isucon]@localhost
  EXPLAIN SELECT * FROM livestream_tags WHERE livestream_id = N

Count: 14  Time=0.00s (0s)  Lock=0.00s (0s)  Rows=0.0 (0), isucon[isucon]@localhost
  SELECT * FROM reactions WHERE livestream_id = N ORDER BY created_at DESC LIMIT N

Count: 60  Time=0.00s (0s)  Lock=0.00s (0s)  Rows=0.0 (0), isudns[isudns]@localhost
  select kind,content from domains, domainmetadata where domainmetadata.domain_id=domains.id and name='S'

explain

Reading from STDIN ...

# 2.5s user time, 20ms system time, 36.75M rss, 51.07M vsz
# Current date: Sat Nov 25 02:23:11 2023
# Hostname: ip-192-168-0-11
# Files: STDIN
# Overall: 34.00k total, 32 unique, 441.53 QPS, 0.43x concurrency ________
# Time range: 2023-11-25T02:21:52 to 2023-11-25T02:23:09
# Attribute          total     min     max     avg     95%  stddev  median
# ============     ======= ======= ======= ======= ======= ======= =======
# Exec time            33s     1us    17ms   962us     2ms   713us   541us
# Lock time           61ms       0     3ms     1us     1us    26us     1us
# Rows sent         32.94k       0     103    0.99    0.99    0.56    0.99
# Rows examine      32.25M       0  10.71k  994.81  964.41  190.82  964.41
# Query size         3.56M       6     195  109.88  118.34   12.85   97.36

# Profile
# Rank Query ID                      Response time Calls R/Call V/M   Item
# ==== ============================= ============= ===== ====== ===== ====
#    1 0xFD38427AE3D09E3883A680F7... 17.7381 54.2% 16745 0.0011  0.00 SELECT livestreams livecomments
#    2 0xC499D81D570D361DB61FC43A... 14.7101 44.9% 16744 0.0009  0.00 SELECT livestreams reactions
#    3 0xF7144185D9A142A426A36DC5...  0.1215  0.4%    10 0.0122  0.00 SELECT livestream_tags
#    4 0x42EF7D7D98FBCC9723BF896E...  0.0422  0.1%    56 0.0008  0.00 SELECT records
# MISC 0xMISC                         0.1143  0.3%   443 0.0003   0.0 <28 ITEMS>

# Query 1: 1.67k QPS, 1.77x concurrency, ID 0xFD38427AE3D09E3883A680F7BAF95D3A at byte 4483490
# This item is included in the report because it matches --limit.
# Scores: V/M = 0.00
# Time range: 2023-11-25T02:21:52 to 2023-11-25T02:22:02
# Attribute    pct   total     min     max     avg     95%  stddev  median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count         49   16745
# Exec time     54     18s   294us    11ms     1ms     2ms   730us   596us
# Lock time     47    29ms       0     3ms     1us     1us    29us     1us
# Rows sent     49  16.35k       1       1       1       1       0       1
# Rows examine  49  15.99M    1001    1001    1001    1001       0    1001
# Query size    53   1.92M     120     120     120     120       0     120
# String:
# Hosts        localhost
# 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
#    SHOW TABLE STATUS LIKE 'livecomments'\G
#    SHOW CREATE TABLE `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 = 5932\G
# *************************** 1. row ***************************
#            id: 1
#   select_type: SIMPLE
#         table: l
#    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: 1001
#      filtered: 10.00
#         Extra: Using where

# Query 2: 1.67k QPS, 1.47x concurrency, ID 0xC499D81D570D361DB61FC43A94BB888A at byte 8982387
# This item is included in the report because it matches --limit.
# Scores: V/M = 0.00
# Time range: 2023-11-25T02:21:52 to 2023-11-25T02:22:02
# Attribute    pct   total     min     max     avg     95%  stddev  median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count         49   16744
# Exec time     44     15s   252us    10ms   878us     2ms   623us   467us
# Lock time     51    32ms       0     2ms     1us     1us    23us     1us
# Rows sent     49  16.35k       1       1       1       1       0       1
# Rows examine  49  15.98M    1001    1001    1001    1001       0    1001
# Query size    45   1.61M     101     101     101     101       0     101
# String:
# Hosts        localhost
# 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
#    SHOW TABLE STATUS LIKE 'reactions'\G
#    SHOW CREATE TABLE `reactions`\G
# EXPLAIN 
SELECT COUNT(*) FROM livestreams l INNER JOIN reactions r ON l.id = r.livestream_id WHERE l.id = 7132\G
# *************************** 1. row ***************************
#            id: 1
#   select_type: SIMPLE
#         table: l
#    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: 1001
#      filtered: 10.00
#         Extra: Using where

# Query 3: 0 QPS, 0x concurrency, ID 0xF7144185D9A142A426A36DC55C1D2623 at byte 9846022
# This item is included in the report because it matches --limit.
# Scores: V/M = 0.00
# Time range: all events occurred at 2023-11-25T02:22:02
# Attribute    pct   total     min     max     avg     95%  stddev  median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count          0      10
# Exec time      0   122ms     6ms    17ms    12ms    15ms     3ms    12ms
# Lock time      0   105us       0    97us    10us     1us    27us     1us
# Rows sent      0       0       0       0       0       0       0       0
# Rows examine   0 107.09k  10.71k  10.71k  10.71k  10.71k       0  10.71k
# Query size     0     560      56      56      56      56       0      56
# String:
# Hosts        localhost
# Users        isucon
# Query_time distribution
#   1us
#  10us
# 100us
#   1ms  #######
#  10ms  ################################################################
# 100ms
#    1s
#  10s+
# Tables
#    SHOW TABLE STATUS LIKE 'livestream_tags'\G
#    SHOW CREATE TABLE `livestream_tags`\G
# EXPLAIN 
SELECT * FROM livestream_tags WHERE livestream_id = 7494\G
# *************************** 1. row ***************************
#            id: 1
#   select_type: SIMPLE
#         table: livestream_tags
#    partitions: NULL
#          type: ALL
# possible_keys: NULL
#           key: NULL
#       key_len: NULL
#           ref: NULL
#          rows: 11137
#      filtered: 10.00
#         Extra: Using where

# Query 4: 3.29 QPS, 0.00x concurrency, ID 0x42EF7D7D98FBCC9723BF896EBFC51D24 at byte 10683847
# This item is included in the report because it matches --limit.
# Scores: V/M = 0.00
# Time range: 2023-11-25T02:22:07 to 2023-11-25T02:22:24
# Attribute    pct   total     min     max     avg     95%  stddev  median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count          0      56
# Exec time      0    42ms   712us     1ms   753us   761us   117us   725us
# Lock time      0    54us       0     2us       0     1us       0     1us
# Rows sent      0      44       0       1    0.79    0.99    0.41    0.99
# Rows examine   0  70.00k   1.25k   1.25k   1.25k   1.25k       0   1.25k
# Query size     0   7.37k     129     144  134.82  143.84    5.03  130.47
# String:
# Hosts        localhost
# Users        isudns
# Query_time distribution
#   1us
#  10us
# 100us  ################################################################
#   1ms  ##
#  10ms
# 100ms
#    1s
#  10s+
# Tables
#    SHOW TABLE STATUS FROM `isudns` LIKE 'records'\G
#    SHOW CREATE TABLE `isudns`.`records`\G
# EXPLAIN 
SELECT content,ttl,prio,type,domain_id,disabled,name,auth FROM records WHERE disabled=0 and name='pipe.u.isucon.dev' and domain_id=2\G
# *************************** 1. row ***************************
#            id: 1
#   select_type: SIMPLE
#         table: records
#    partitions: NULL
#          type: ALL
# possible_keys: domain_id
#           key: NULL
#       key_len: NULL
#           ref: NULL
#          rows: 1280
#      filtered: 1.00
#         Extra: Using where

netdata

http://localhost:19991/#menu_services;after=1700878912858;before=1700878988923

pprof

go tool pprof -http=0.0.0.0:1080 http://isucon1/pprof/11250221
saza-ku commented 1 year ago

isucon3

alp

+-------+--------+-----+-----+-----+-----+-----+-----+
| COUNT | METHOD | URI | MIN | MAX | SUM | AVG | P99 |
+-------+--------+-----+-----+-----+-----+-----+-----+
+-------+--------+-----+-----+-----+-----+-----+-----+

slow query

explain

Reading from STDIN ...

# No events processed.

netdata

http://localhost:19993/#menu_services;after=1700878912771;before=1700878992778

pprof

go tool pprof -http=0.0.0.0:1080 http://isucon3/pprof/11250221
saza-ku commented 1 year ago

isucon2

alp

+-------+--------+------------------------------------------+--------+--------+--------+--------+--------+
| COUNT | METHOD |                   URI                    |  MIN   |  MAX   |  SUM   |  AVG   |  P99   |
+-------+--------+------------------------------------------+--------+--------+--------+--------+--------+
| 1     | POST   | /api/initialize                          | 15.060 | 15.060 | 15.060 | 15.060 | 15.060 |
| 2     | GET    | /api/livestream/.+/statistics            | 5.588  | 5.644  | 11.232 | 5.616  | 5.644  |
| 2     | GET    | /api/user/.+/statistics                  | 2.588  | 2.624  | 5.212  | 2.606  | 2.624  |
| 1     | POST   | /api/register                            | 0.040  | 0.040  | 0.040  | 0.040  | 0.040  |
| 1     | POST   | /api/livestream/.+                       | 0.032  | 0.032  | 0.032  | 0.032  | 0.032  |
| 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  |
| 3     | POST   | /api/login                               | 0.000  | 0.004  | 0.008  | 0.003  | 0.004  |
| 1     | POST   | /api/livestream/.+/enter                 | 0.008  | 0.008  | 0.008  | 0.008  | 0.008  |
| 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  |
+-------+--------+------------------------------------------+--------+--------+--------+--------+--------+

slow query

Count: 1000  Time=0.01s (5s)  Lock=0.00s (0s)  Rows=0.0 (0), isucon[isucon]@localhost
  INSERT INTO users (id, name, display_name, description, password) VALUES (N, 'S', 'S', 'S', 'S')

Count: 14992  Time=0.00s (4s)  Lock=0.00s (0s)  Rows=1.0 (14992), isucon[isucon]@localhost
  SELECT IFNULL(SUM(l2.tip), N) FROM livestreams l INNER JOIN livecomments l2 ON l.id = l2.livestream_id WHERE l.id = N

Count: 14992  Time=0.00s (4s)  Lock=0.00s (0s)  Rows=1.0 (14992), isucon[isucon]@localhost
  SELECT COUNT(*) FROM livestreams l INNER JOIN reactions r ON l.id = r.livestream_id WHERE l.id = N

Count: 510  Time=0.01s (2s)  Lock=0.00s (0s)  Rows=0.0 (0), isucon[isucon]@localhost
  INSERT INTO themes (user_id, dark_mode) VALUES (N, true)

Count: 490  Time=0.01s (2s)  Lock=0.00s (0s)  Rows=0.0 (0), isucon[isucon]@localhost
  INSERT INTO themes (user_id, dark_mode) VALUES (N, false)

Count: 2000  Time=0.00s (2s)  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 (2s)  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: 103  Time=0.01s (0s)  Lock=0.00s (0s)  Rows=0.0 (0), isucon[isucon]@localhost
  INSERT INTO tags(name) VALUES ('S')

explain

Reading from STDIN ...

# 2.9s user time, 30ms system time, 43.32M rss, 58.14M vsz
# Current date: Sat Nov 25 02:23:16 2023
# Hostname: ip-192-168-0-12
# Files: STDIN
# Overall: 38.84k total, 79 unique, 479.51 QPS, 0.35x concurrency ________
# Time range: 2023-11-25T02:21:52 to 2023-11-25T02:23:13
# Attribute          total     min     max     avg     95%  stddev  median
# ============     ======= ======= ======= ======= ======= ======= =======
# Exec time            29s     1us   561ms   736us     5ms     4ms   316us
# Lock time           35ms       0    86us       0     1us       0     1us
# Rows sent         50.23k       0   7.32k    1.32    0.99   54.16    0.99
# Rows examine      36.58M       0  14.00k  987.52   1.96k  511.90  964.41
# Query size         7.70M       5   1.94M  207.77  158.58  10.48k  118.34

# Profile
# Rank Query ID                      Response time Calls R/Call V/M   Item
# ==== ============================= ============= ===== ====== ===== ====
#    1 0xDFFCC1D78939C4D781C7C583...  5.8289 20.4%  1000 0.0058  0.00 INSERT users
#    2 0xD2A0864774622BA36F655749...  5.4008 18.9%  1001 0.0054  0.00 INSERT themes
#    3 0xFD38427AE3D09E3883A680F7...  4.9331 17.2% 14992 0.0003  0.00 SELECT livestreams livecomments
#    4 0xC499D81D570D361DB61FC43A...  4.2957 15.0% 14992 0.0003  0.00 SELECT livestreams reactions
# MISC 0xMISC                         8.1583 28.5%  6855 0.0012   0.0 <75 ITEMS>

# Query 1: 90.91 QPS, 0.53x concurrency, ID 0xDFFCC1D78939C4D781C7C58349101F50 at byte 458859
# This item is included in the report because it matches --limit.
# Scores: V/M = 0.00
# Time range: 2023-11-25T02:21:53 to 2023-11-25T02:22:04
# Attribute    pct   total     min     max     avg     95%  stddev  median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count          2    1000
# Exec time     20      6s     3ms    45ms     6ms     8ms     2ms     5ms
# Lock time      3     1ms     1us     8us     1us     1us       0     1us
# Rows sent      0       0       0       0       0       0       0       0
# Rows examine   0       0       0       0       0       0       0       0
# Query size     5 401.18k     192     463  410.81  420.77   16.87  400.73
# String:
# Hosts        localhost
# Users        isucon
# Query_time distribution
#   1us
#  10us
# 100us
#   1ms  ################################################################
#  10ms  #
# 100ms
#    1s
#  10s+
# Tables
#    SHOW TABLE STATUS LIKE 'users'\G
#    SHOW CREATE TABLE `users`\G
INSERT INTO users (id, name, display_name, description, password) VALUES (521, 'hiroshisuzuki1', 'たんぽぽたね', '普段寿司職人をしています。\nよろしくおねがいします!\n\n連絡は以下からお願いします。\n\nウェブサイト: http://hiroshisuzuki.example.com/\nメールアドレス: hiroshisuzuki@example.com\n', '$2a$04$/0I5Z3FbgSF8C7k8qSfp3.ytDI6zVKZQ0u1qb4OeREpHxQzl6CTFW')\G

# Query 2: 32.29 QPS, 0.17x concurrency, ID 0xD2A0864774622BA36F6557496405CF75 at byte 664102
# This item is included in the report because it matches --limit.
# Scores: V/M = 0.00
# Time range: 2023-11-25T02:21:53 to 2023-11-25T02:22:24
# Attribute    pct   total     min     max     avg     95%  stddev  median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count          2    1001
# Exec time     18      5s   102us    12ms     5ms     7ms   777us     5ms
# Lock time      3     1ms       0    13us     1us     1us       0     1us
# Rows sent      0       0       0       0       0       0       0       0
# Rows examine   0       0       0       0       0       0       0       0
# Query size     0  57.07k      55      60   58.38   56.92    0.19   56.92
# String:
# Hosts        localhost
# 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
INSERT INTO themes (user_id, dark_mode) VALUES (755, true)\G

# Query 3: 1.07k QPS, 0.35x concurrency, ID 0xFD38427AE3D09E3883A680F7BAF95D3A at byte 9308187
# This item is included in the report because it matches --limit.
# Scores: V/M = 0.00
# Time range: 2023-11-25T02:22:10 to 2023-11-25T02:22:24
# Attribute    pct   total     min     max     avg     95%  stddev  median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count         38   14992
# Exec time     17      5s   290us     3ms   329us   332us    42us   316us
# Lock time     38    13ms       0    34us       0     1us       0     1us
# Rows sent     29  14.64k       1       1       1       1       0       1
# Rows examine  39  14.33M    1001    1003    1002  964.41       0  964.41
# Query size    22   1.71M     117     120  119.85  118.34    0.64  118.34
# String:
# 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 = 5571\G
# *************************** 1. row ***************************
#            id: 1
#   select_type: SIMPLE
#         table: l
#    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: 10.00
#         Extra: Using where

# Query 4: 1.07k QPS, 0.31x concurrency, ID 0xC499D81D570D361DB61FC43A94BB888A at byte 7917157
# This item is included in the report because it matches --limit.
# Scores: V/M = 0.00
# Time range: 2023-11-25T02:22:10 to 2023-11-25T02:22:24
# Attribute    pct   total     min     max     avg     95%  stddev  median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count         38   14992
# Exec time     15      4s   251us     3ms   286us   301us    31us   273us
# Lock time     38    14ms       0    86us       0     1us       0     1us
# Rows sent     29  14.64k       1       1       1       1       0       1
# Rows examine  39  14.33M    1001    1004 1002.50  964.41       0  964.41
# Query size    18   1.44M      98     101  100.85   97.36       0   97.36
# String:
# 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 'reactions'\G
#    SHOW CREATE TABLE `isupipe`.`reactions`\G
# EXPLAIN 
SELECT COUNT(*) FROM livestreams l INNER JOIN reactions r ON l.id = r.livestream_id WHERE l.id = 3367\G
# *************************** 1. row ***************************
#            id: 1
#   select_type: SIMPLE
#         table: l
#    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: 10.00
#         Extra: Using where

netdata

http://localhost:19992/#menu_services;after=1700878912836;before=1700878992846

pprof

go tool pprof -http=0.0.0.0:1080 http://isucon2/pprof/11250221