Giter VIP home page Giter VIP logo

isucon_secret_sauce's Introduction

https://github.com/k-nasa/isucon-magic-powder に移した

Install

git clone https://github.com/k-nasa/isucon_secret_sauce.git
chmod -R +x  ./isucon_secret_sauce/
cd isucon_secret_sauce

# apt-getを使用してる箇所があるので適宜yumなどに変更する
./setup.sh

Tools

何が install されるのか?

tool
alp web サーバーのログ集計
pt-query-digest slow query 解析
htop グラフィカルな top
zsh お気に入りのシェル
neovim エディタ入れとく

alp

alp は web サーバーのログプロファイラーです。

https://github.com/tkuchiki/alp

こんな感じの設定を nginx.conf に記述してください

nginx 以外は公式 README を見る

log_format ltsv "time:$time_local"
                "\thost:$remote_addr"
                "\tforwardedfor:$http_x_forwarded_for"
                "\treq:$request"
                "\tstatus:$status"
                "\tmethod:$request_method"
                "\turi:$request_uri"
                "\tsize:$body_bytes_sent"
                "\treferer:$http_referer"
                "\tua:$http_user_agent"
                "\treqtime:$request_time"
                "\tcache:$upstream_http_x_cache"
                "\truntime:$upstream_http_x_runtime"
                "\tapptime:$upstream_response_time"
                "\tvhost:$host";

access_log /var/log/nginx/access.log ltsv;

コマンド例です。 /user/:id のような path のときは aggregates "/user" or "/user\d+"とすると aggregates できます。 結果を除外したいときは excludes "/user"とすればいいです。

# avgでソートして出力してる
alp -f /var/log/nginx/access.log --aggregates "" --excludes "" --avg

pt-query-digest

slow log profile

まずは mysql, mariadb のスローログ出力を ON にしよう

[mysqld]
slow_query_log = 1
slow_query_log_file = /var/log/mysql/slow.log
long_query_time = 0

確認はこれ ON になってたら OK!

mysql> show variables like 'slow%';

あとは実行させるだけ!

sudo pt-query-digest /var/log/mysql/slow.log

htop

top コマンドのグラフィカルなやつです。

特に説明無し。

以下2つはいらないかもしれないので、setup.sh の該当箇所をコメントアウトしてください。

zsh

僕の普段使っている zsh plugin も一緒に入れます。 zsh のみを入れるわけじゃないです。

使いづらくなったらごめん

neovim

vim を入れます。 初回起動時に plugin をいろいろ入れるので時間がかかります。

isucon_secret_sauce's People

Contributors

k-nasa avatar

Stargazers

 avatar machida avatar Yuya Tajima avatar kz avatar Yuki Okushi avatar

Watchers

James Cloos avatar

isucon_secret_sauce's Issues

aptやyumに依存しないようにする

主にaptを使っている。

aptが入っている環境だと動くと思うがコメントでもいいのでyum用のスクリプトも準備する。

それから、自分以外の人でも使えるようにコードを書き換える。コメント書く

ドキュメント化する

github wikiを活用するなりして、最初にやることやツールの入れ方、チェックリストなどをドキュメント化する

秘伝のタレ強化

ngixn.confやmy.confもこのリポジトリに含めるようにする。

また、ログの初期化(ベンチマークを回す前に)や集計ログ表示などをするスクリプトファイルを追加する

neovimを用意する!

neovimがうまく入らずISHOCON1でつらい思いをしたのでneovimを確実に入れる!

htop入れる

グラフィカルなtopであるhtopを入れる。

こっちのほうが個人的に見やすい

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.