vendredi 20 février 2015

Request gets response very slow, only first time it is fired

Our application use MongoDB, ruby1.9 and rails3.2.


The problem happens when we try to get user profile(/users/first_name-last_name). Not on all user profiles, but only on user profiles those have a lot of embedded collection data. (notifications ~ 10 000, following items ~ 600) Rendering is done with rabl.


In development mode there is interesting part of this problem:


When we send request for getting data of 'problematic user', there is no response for more than 60 seconds (and we get bad response gateway error), but if you open profile of that same user in other tab after 5 seconds of time when first request is sent you get response in less then 7 seconds(first request is still loading!!!). CPU usage is at 99% all the time.


We have problems both in development and production servers.


In log I can find something nonsense like list of all queries and time consumed for them and when I sum it, result is about 9000ms, and the nonsense part is the last line in log which state:


Completed 200 OK in 43899ms (Views: 2288.7ms)


Any idea where to start digging?


Aucun commentaire:

Enregistrer un commentaire