Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP][DO NOT MERGE] Optimized application #322

Open
wants to merge 47 commits into
base: master
Choose a base branch
from
Open

Conversation

kazeburo
Copy link
Collaborator

@kazeburo kazeburo commented Aug 26, 2019

ベンチマークのために最適化をやってみる

初期

2019/08/26 22:34:05 main.go:131: === final check ===
{
  "pass": true,
  "score": 15840,
  "messages": [
    "/new_items/30.jsonで返している商品の情報に誤りがあります"
  ]
}
  • indexの追加。root_category_idの追加
  • categoryをstaticに
  • userをpreloadする
  • userSimple、itemSimpleのときは、selectするものを絞る
  • getTransactionsのstatusは全部なので、where条件から外す
  • getTransactionsのクエリをunionクエリに書き換え + index
  • 不必要なtransaction削除
  • shippment serviceを呼び出さない
  • postbuyでトランザクション開始前にできるチェックはする + get_lockでトランザクション滞留回避

@kazeburo kazeburo changed the title [optimzied app] add index, add root_category_id [WIP][DO NOT MERGE] Optimized application Aug 26, 2019
@kazeburo
Copy link
Collaborator Author

indexの追加。root_category_idの追加

2019/08/26 22:35:19 main.go:131: === final check ===
{
  "pass": true,
  "score": 16240,
  "messages": []
}

@kazeburo
Copy link
Collaborator Author

categoryをstaticに

2019/08/26 23:00:51 main.go:131: === final check ===
{
  "pass": true,
  "score": 16140,
  "messages": [
    "/new_items/30.jsonで返している商品の情報に誤りがあります"
  ]
}

変わらない

@kazeburo
Copy link
Collaborator Author

userをpreloadする

2019/08/27 00:07:43 main.go:131: === final check ===
{
  "pass": true,
  "score": 16240,
  "messages": []
}

@kazeburo
Copy link
Collaborator Author

  • userSimple、itemSimpleのときは、selectするものを絞る
  • getTransactionsのstatusは全部なので、conditionから外せる
  • unionクエリに書き換え + index
  • 不必要なtransaction削除
  • shippment serviceを呼び出さない

@kazeburo
Copy link
Collaborator Author

timeline、アクセスが多いようであれば、専用テーブルとか考えられるのかも
getuserは何もやってない。
getTransactions の N+1はもう少しできる。limitはもう少し多くするとつらくなるのかも
getTransactionsにもう少しアクセス増やしたい
shippingテーブル必要?みたいなところはある
postbuyとbumpが重なるとdead lockしやすくなるのでおもしろいかも

@kazeburo
Copy link
Collaborator Author

キャンペーン機能がくると、もう少しやらなければならなそう

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant