Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
melanmeg committed Nov 24, 2024
1 parent 7ecb9a2 commit a2a1d85
Show file tree
Hide file tree
Showing 9 changed files with 54 additions and 8 deletions.
48 changes: 46 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,52 @@ mysql> EXPLAIN SELECT p.id, p.user_id, p.body, p.mime, p.created_at FROM posts A
```
![httplog](./images/5.PNG)
![httplog](./images/5_2.PNG)
![slowlog](./images/s.PNG)

### commentsテーブル comments_idx_2 追加
```bash
mysql> EXPLAIN SELECT COUNT(*) AS `count` FROM `comments` WHERE `user_id` = 382 \G
*************************** 1. row ***************************
id: 1
select_type: SIMPLE
table: comments
partitions: NULL
type: ALL
possible_keys: NULL
key: NULL
key_len: NULL
ref: NULL
rows: 99590
filtered: 10.00
Extra: Using where
1 row in set, 1 warning (0.00 sec)
```

```bash
$ mysql -u isuconp -pisuconp isuconp -e "alter table comments add index comments_idx_2 (user_id);"
```

```bash
mysql> EXPLAIN SELECT COUNT(*) AS `count` FROM `comments` WHERE `user_id` = 382 \G
*************************** 1. row ***************************
id: 1
select_type: SIMPLE
table: comments
partitions: NULL
type: ref
possible_keys: comments_idx_2
key: comments_idx_2
key_len: 4
ref: const
rows: 102
filtered: 100.00
Extra: Using index
1 row in set, 1 warning (0.00 sec)
```

![slowlog](./images/s2.PNG)


```bash
{"pass":true,"score":86961,"success":83035,"fail":0,"messages":[]}
```
Expand All @@ -95,8 +136,10 @@ $ mysql -u isuconp -pisuconp isuconp -e "alter table comments add index comments
```bash
{"pass":true,"score":171163,"success":164317,"fail":0,"messages":[]}
```
![httplog](./images/6.PNG)
![httplog](./images/6_2.PNG)

![slowlog](./images/6.PNG)
![slowlog](./images/6_2.PNG)
![slowlog](./images/6_3.PNG)

### ログをやめてみる
```bash
Expand Down Expand Up @@ -153,6 +196,7 @@ $ curl -fsSL "$URL" -o /tmp/go.tar.gz && \
$ cat <<EOF >> ~/.bashrc
export GOROOT=/usr/local/go
export GOPATH=$HOME/go
export PATH=/usr/local/go/bin:$PATH
EOF
```

Expand Down
2 changes: 1 addition & 1 deletion ansible/env.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ ISUCON_DB_USER: isuconp
ISUCON_DB_PASSWORD: isuconp

# アプリ変数
BUILD_DIR: /home/isucon/private_isu/webapp/golang
BUILD_DIR: /home/isucon/private_isu/webapp/golang/
6 changes: 3 additions & 3 deletions ansible/playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,16 @@
vars_files:
- env.yml
tasks:
- include_tasks: tasks/isu/isu_deploy.yml
- include_tasks: tasks/isu/isu_challenge.yml
- include_tasks: tasks/tools/common.yml
- include_tasks: tasks/tools/nginx.yml
- include_tasks: tasks/tools/mysql.yml
- include_tasks: tasks/tools/memcached.yml
- include_tasks: tasks/tools/netdata.yml
- include_tasks: tasks/tools/graphviz.yml
- include_tasks: tasks/tools/pprotein.yml
- include_tasks: tasks/tools/sysctl.yml
- include_tasks: tasks/isu/isu_deploy.yml
- include_tasks: tasks/isu/isu_challenge.yml
#
# - name: isu1
# hosts: isu1
Expand All @@ -28,7 +29,6 @@
# tasks:
# - include_tasks: tasks/tools/collect.yml
# - include_tasks: tasks/tools/fetch.yml
# - include_tasks: tasks/tools/graphviz.yml
#
# - name: isu2
# hosts: isu2
Expand Down
6 changes: 4 additions & 2 deletions ansible/tasks/isu/isu_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,19 @@
enabled: true

- name: Pull latest code from Git repository
become: no
git:
repo: "{{ GIT_REPOSITORY_URL }}"
dest: "{{ ISUCON_DIR }}"
version: "main"
force: true

# Execute as login shell
- name: setup
shell: make
become: no
shell: bash -lc "sh setup.sh"
args:
chdir: "{{ BUILD_DIR }}"
ignore_errors: true

- name: "{{ SERVICE_NAME }} is restarted"
become: yes
Expand Down
Binary file modified images/6.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/6_2.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/6_3.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/s.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/s2.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit a2a1d85

Please sign in to comment.