saza-ku / private-isu-2023-public

0 stars 0 forks source link

11101120 #81

Open saza-ku opened 1 year ago

saza-ku commented 1 year ago

isucon1

alp

+-------+--------+-----+-------+-------+-------+-------+-------+
| COUNT | METHOD | URI |  MIN  |  MAX  |  SUM  |  AVG  |  P99  |
+-------+--------+-----+-------+-------+-------+-------+-------+
| 1     | GET    | /   | 0.004 | 0.004 | 0.004 | 0.004 | 0.004 |
+-------+--------+-----+-------+-------+-------+-------+-------+

slow query

Count: 1  Time=0.00s (0s)  Lock=0.00s (0s)  Rows=1.0 (1), isuconp[isuconp]@localhost
  SELECT * FROM `users` WHERE `id` = N

Count: 1  Time=0.00s (0s)  Lock=0.00s (0s)  Rows=0.0 (0), isuconp[isuconp]@localhost
  SELECT `id`, `user_id`, `body`, `mime`, `created_at` FROM `not_banned_posts_without_imgdata` ORDER BY `created_at` DESC LIMIT N

explain

Reading from STDIN ...

# 120ms user time, 10ms system time, 36.12M rss, 50.42M vsz
# Current date: Fri Nov 10 11:22:10 2023
# Hostname: ip-172-31-22-189
# Files: STDIN
# Overall: 2 total, 2 unique, 0 QPS, 0x concurrency ______________________
# Time range: all events occurred at 2023-11-10T02:21:00
# Attribute          total     min     max     avg     95%  stddev  median
# ============     ======= ======= ======= ======= ======= ======= =======
# Exec time          336us   112us   224us   168us   224us    79us   168us
# Lock time            5us     1us     4us     2us     4us     2us     2us
# Rows sent              1       0       1    0.50       1    0.71    0.50
# Rows examine           1       0       1    0.50       1    0.71    0.50
# Query size           164      36     128      82     128   65.05      82

# Profile
# Rank Query ID                           Response time Calls R/Call V/M  
# ==== ================================== ============= ===== ====== =====
#    1 0x396201721CD58410E070DA9421CA8C8D  0.0002 66.7%     1 0.0002  0.00 SELECT users
#    2 0x8FFC6FCCBEEC525A7DE53A12C542F25B  0.0001 33.3%     1 0.0001  0.00 SELECT not_banned_posts_without_imgdata

# Query 1: 0 QPS, 0x concurrency, ID 0x396201721CD58410E070DA9421CA8C8D at byte 0
# This item is included in the report because it matches --limit.
# Scores: V/M = 0.00
# Time range: all events occurred at 2023-11-10T02:21:00
# Attribute    pct   total     min     max     avg     95%  stddev  median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count         50       1
# Exec time     66   224us   224us   224us   224us   224us       0   224us
# Lock time     80     4us     4us     4us     4us     4us       0     4us
# Rows sent    100       1       1       1       1       1       0       1
# Rows examine 100       1       1       1       1       1       0       1
# Query size    21      36      36      36      36      36       0      36
# String:
# Hosts        localhost
# Users        isuconp
# Query_time distribution
#   1us
#  10us
# 100us  ################################################################
#   1ms
#  10ms
# 100ms
#    1s
#  10s+
# Tables
#    SHOW TABLE STATUS LIKE 'users'\G
#    SHOW CREATE TABLE `users`\G
# EXPLAIN /*!50100 PARTITIONS*/
SELECT * FROM `users` WHERE `id` = 1\G
# *************************** 1. row ***************************
#            id: 1
#   select_type: SIMPLE
#         table: users
#    partitions: NULL
#          type: const
# possible_keys: PRIMARY
#           key: PRIMARY
#       key_len: 4
#           ref: const
#          rows: 1
#      filtered: 100.00
#         Extra: NULL

# Query 2: 0 QPS, 0x concurrency, ID 0x8FFC6FCCBEEC525A7DE53A12C542F25B at byte 241
# This item is included in the report because it matches --limit.
# Scores: V/M = 0.00
# Time range: all events occurred at 2023-11-10T02:21:00
# Attribute    pct   total     min     max     avg     95%  stddev  median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count         50       1
# Exec time     33   112us   112us   112us   112us   112us       0   112us
# Lock time     20     1us     1us     1us     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    78     128     128     128     128     128       0     128
# String:
# Hosts        localhost
# Users        isuconp
# Query_time distribution
#   1us
#  10us
# 100us  ################################################################
#   1ms
#  10ms
# 100ms
#    1s
#  10s+
# Tables
#    SHOW TABLE STATUS LIKE 'not_banned_posts_without_imgdata'\G
#    SHOW CREATE TABLE `not_banned_posts_without_imgdata`\G
# EXPLAIN 
SELECT `id`, `user_id`, `body`, `mime`, `created_at` FROM `not_banned_posts_without_imgdata` ORDER BY `created_at` DESC LIMIT 20\G
# *************************** 1. row ***************************
#            id: 1
#   select_type: SIMPLE
#         table: not_banned_posts_without_imgdata
#    partitions: NULL
#          type: ALL
# possible_keys: NULL
#           key: NULL
#       key_len: NULL
#           ref: NULL
#          rows: 1
#      filtered: 100.00
#         Extra: Using filesort

netdata

http://localhost:19991/#menu_apps_submenu_cpu;after=1699582854212;before=1699582930333

pprof

go tool pprof -http=0.0.0.0:1080 http://isucon1/pprof/11101120