0
down vote
favorite
I have standard view with 1 database query (MySQL). I am using Devise and method for checking is it user logged in layouts/application.html.erb:


<% unless user_signed_in? %>
<%= render 'partials/login_modal' %>
<%= render 'partials/registration_modal' %>
<% end %>
Layout is with 4 partials included (_header.html.erb and _footer.html.erb, too). All generated HTML (from html tag to html) is around 320 lines.


In production I set : config.assets.raise_runtime_errors = false.


The site loads really slow, but only the first time, right after starting server and it doesn't matter which page loads. It is same for all . If I load page stop and start server again and reload page, it is slow, but after first time loading after server is started, it loads page normal.


In production:


FontAwesome loads for 20ms;
the CSS file for 8ms,
JS file - 14 ms and three images around 10-20ms each.
The page which is 11Kb loads for more than 9 seconds.


In development, same page, I have different requests for assets (9 CSS/JS/img files, each between 20 -50ms for loading) and same page (11.4Kb) loads for more than 11 seconds.