isucon5q's People
isucon5q's Issues
is_friend? で毎回sqlを発行している
Unicorn の worker process を増やす?
worker_processes should be at least the number of CPU cores on a dedicated server (unless you do not have enough memory). If your application has occasionally slow responses that are /not/ CPU-intensive, you may increase this to workaround those inefficiencies.
mysql と unicorn でそれぞれどれくらいメモリ使うかによるけど
$ free -m
total used free shared buffers cached
Mem: 3548 3100 447 9 142 2291
-/+ buffers/cache: 666 2881
Swap: 0 0 0
メモリにまだ余裕はある
住んでる県の選択をjsに移動する
優先度低
rubyで描画しているが不要っぽい
get '/' でfootprintsをとってくる方法を変える
なんかやばいsqlが発行されている
entry[:is_private] はいらない
entry[:is_private] = entry[:private] == 1
とかやってるけど無駄
users, salts, profilesを1つのテーブルにする
不必要なjoinを行っている
commentsにentry_user_idを追加する
get '/' で自分へのコメント一覧作ってるけどsqlが厳しい
インデックスを追加する
nginxとunicornの通信がtcpになっているのでunix domain socketに変更する
authenticate時にcurrent_userを設定する
それぞれにsqlを発行していて無駄
unicorn worker数を増やす
relationsの重複を排除する
友達関係を表していてaとbが友達のとき、one=a, another=bとone=b, another=aの両方が作られている
initializeもちゃんと直す必要有り
insertを非同期化する
1秒以内に反映されればいいとのこと
Dadadog 入れてみる
$ uname -a
Linux instance-1 3.19.0-21-generic #21-Ubuntu SMP Sun Jun 14 18:31:11 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
ubuntu
TODO
- datadog agent 入れる
- nginx 監視設定
- mysql 監視設定
- 最後に datadog agent は止める + 消す
entriesにtitleを追加する
bodyの一行目がtitleという仕様っぽい
comments_for_meのクエリが重い
Line 232 in ceeec37
ログイン失敗時のリダイレクトをエラーじゃなく直接やる
authenticateでraiseしてるけど post '/' でやった方がよさそう
get / のviewの中でget_userが何度も実行されている
- comments_for_me
- entries_of_friends
- comments_of_friends
get '/' で友達のエントリ一覧を取ってくる方法を変える
とにかくやばいことやってる
entries_of_friends
を作る箇所
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.