kackey0-1 / isucon13

0 stars 1 forks source link

benchmarkで失敗しているやつ #4

Open bayamasa opened 2 weeks ago

bayamasa commented 2 weeks ago

2024-11-10T11:49:14.655Z info staff-logger bench/bench.go:323 [シナリオ viewer-report] 26 回成功, 4 回失敗 2024-11-10T11:49:14.655Z info staff-logger bench/bench.go:323 [失敗シナリオ viewer-report-fail] 4 回失敗

benchmarkのシナリオから以下のエンドポイントのベンチマークが遅い

    e.POST("/api/livestream/:livestream_id/livecomment/:livecomment_id/report", reportLivecommentHandler)

https://github.com/bayamasa/isucon13/blob/master/go/main.go#L158

bayamasa commented 2 weeks ago

PowerDNSテーブル構成 あんま関係ないかも

isucon@ip-192-168-0-13:~$ less /usr/share/doc/pdns-backend-mysql/schema.mysql.sql 

CREATE INDEX nametype_index ON records(name,type);
CREATE INDEX domain_id ON records(domain_id);
CREATE INDEX ordername ON records (ordername);

CREATE TABLE supermasters (
  ip                    VARCHAR(64) NOT NULL,
  nameserver            VARCHAR(255) NOT NULL,
  account               VARCHAR(40) CHARACTER SET 'utf8' NOT NULL,
  PRIMARY KEY (ip, nameserver)
) Engine=InnoDB CHARACTER SET 'latin1';

CREATE TABLE comments (
  id                    INT AUTO_INCREMENT,
  domain_id             INT NOT NULL,
  name                  VARCHAR(255) NOT NULL,
  type                  VARCHAR(10) NOT NULL,
  modified_at           INT NOT NULL,
  account               VARCHAR(40) CHARACTER SET 'utf8' DEFAULT NULL,
  comment               TEXT CHARACTER SET 'utf8' NOT NULL,
  PRIMARY KEY (id)
) Engine=InnoDB CHARACTER SET 'latin1';

CREATE INDEX comments_name_type_idx ON comments (name, type);
CREATE INDEX comments_order_idx ON comments (domain_id, modified_at);

CREATE TABLE domainmetadata (
  id                    INT AUTO_INCREMENT,
  domain_id             INT NOT NULL,
  kind                  VARCHAR(32),
  content               TEXT,
  PRIMARY KEY (id)
) Engine=InnoDB CHARACTER SET 'latin1';

CREATE INDEX domainmetadata_idx ON domainmetadata (domain_id, kind);

CREATE TABLE cryptokeys (
  id                    INT AUTO_INCREMENT,
  domain_id             INT NOT NULL,
  flags                 INT NOT NULL,
  active                BOOL,
  published             BOOL DEFAULT 1,
  content               TEXT,
  PRIMARY KEY(id)
) Engine=InnoDB CHARACTER SET 'latin1';

CREATE INDEX domainidindex ON cryptokeys(domain_id);

CREATE TABLE tsigkeys (
  id                    INT AUTO_INCREMENT,
  name                  VARCHAR(255),
  algorithm             VARCHAR(50),
  secret                VARCHAR(255),
  PRIMARY KEY (id)
) Engine=InnoDB CHARACTER SET 'latin1';

CREATE UNIQUE INDEX namealgoindex ON tsigkeys(name, algorithm);
bayamasa commented 2 weeks ago

isupipe テーブル構成

mysql> show tables;
+----------------------------+
| Tables_in_isupipe          |
+----------------------------+
| icons                      |
| livecomment_reports        |
| livecomments               |
| livestream_tags            |
| livestream_viewers_history |
| livestreams                |
| ng_words                   |
| reactions                  |
| reservation_slots          |
| tags                       |
| themes                     |
| users                      |
+----------------------------+
12 rows in set (0.00 sec)
bayamasa commented 2 weeks ago

index一覧

mysql> SELECT 
    ->     TABLE_NAME,
    ->     INDEX_NAME,
    ->     COLUMN_NAME,
    ->     NON_UNIQUE,
    ->     SEQ_IN_INDEX,
    ->     INDEX_TYPE
    -> FROM 
    ->     INFORMATION_SCHEMA.STATISTICS
    -> WHERE 
    ->     TABLE_SCHEMA = 'isupipe'
    -> ORDER BY 
    ->     TABLE_NAME, INDEX_NAME, SEQ_IN_INDEX;
+----------------------------+----------------+-------------+------------+--------------+------------+
| TABLE_NAME                 | INDEX_NAME     | COLUMN_NAME | NON_UNIQUE | SEQ_IN_INDEX | INDEX_TYPE |
+----------------------------+----------------+-------------+------------+--------------+------------+
| icons                      | PRIMARY        | id          |          0 |            1 | BTREE      |
| livecomment_reports        | PRIMARY        | id          |          0 |            1 | BTREE      |
| livecomments               | PRIMARY        | id          |          0 |            1 | BTREE      |
| livestream_tags            | PRIMARY        | id          |          0 |            1 | BTREE      |
| livestream_viewers_history | PRIMARY        | id          |          0 |            1 | BTREE      |
| livestreams                | PRIMARY        | id          |          0 |            1 | BTREE      |
| ng_words                   | ng_words_word  | word        |          1 |            1 | BTREE      |
| ng_words                   | PRIMARY        | id          |          0 |            1 | BTREE      |
| reactions                  | PRIMARY        | id          |          0 |            1 | BTREE      |
| reservation_slots          | PRIMARY        | id          |          0 |            1 | BTREE      |
| tags                       | PRIMARY        | id          |          0 |            1 | BTREE      |
| tags                       | uniq_tag_name  | name        |          0 |            1 | BTREE      |
| themes                     | PRIMARY        | id          |          0 |            1 | BTREE      |
| users                      | PRIMARY        | id          |          0 |            1 | BTREE      |
| users                      | uniq_user_name | name        |          0 |            1 | BTREE      |
+----------------------------+----------------+-------------+------------+--------------+------------+
15 rows in set (0.02 sec)

mysql>