Access denied, Please sign in and make sure you have proper permission.
你这个首页本来也没什么东西,平均时间这么高,八成是某地的网络不畅
同 @ywencn , 首页全是 api.map.baidu.com
加载过久导致。
先找瓶颈再解决问题。不了解慢在哪里,加 cache 也不一定能命中。
如果是上面几位说的加载第三方服务慢,那就对那些内容进行异步化和延迟加载。
分析 Rails log 看看是那些 action 慢,然后再分析看是那个部分导致慢,接着尝试优化代码和数据库看是否能提上去,cache 不是用来加速的,而是用来解决搞访问量的时候,减少数据库和重复计算的
#3 楼 @lyfi2003 因为有些地方需要用到,在书和借出的页面需要地图,不过这些 JS 代码我都写在 JS 里面一起打包了,所以放在首页
#10 楼 @huacnlee 我现在是这样做的
<% post.comments.order_by("created_at DESC").each_with_index do |comment, index| %>
<div class="convo attribution clearfix"><p><a href="<%= user_path(comment.user) %>" title="<%= comment.user.name %>" class="img x"><%= user_avatar_tag(comment.user, :style => "small") %></a><a href="<%= user_path(comment.user) %>" class="author x"><%= comment.user.name %></a> <%= comment.body %></p></div>
<% break if index == 2 %>
<% end %>
<% end %>