刚刚测试,目前查看帖子页面最耗时的就是 format_topic_body
这个转换过程,比如 777 这片 58 个回复,如果不用 format_topic_body
的话,Rendered topics/_replies.html.erb
的时间可以从 (252.6ms) 下降到 60ms,这个数字还是很可观的。
需要做的就是把 format_topic_body
的过程放到数据提交的时候,查出来就是有格式的。
#6 楼 @hooopo 原来 Rails 3 还有这个东西,才知道。 http://rails.rubyonrails.org/classes/ActionView/Partials.html
<%= render :partial => "replies/reply", :collection => replies%>
replies/reply.html.erb
第 <%= reply_counter + 1 %>楼, 创建于 <%= reply.created_at %>
似乎 MongoIC 依然不给力,刚刚有几个请求:
Completed 200 OK in 842ms (Views: 162.0ms | Mongo: 677.9ms | Solr: 0.0ms)
Completed 200 OK in 948ms (Views: 95.1ms | Mongo: 851.6ms | Solr: 0.0ms)
做个标记,以后调整哪来对比 1 CPU, 1G 内存,4 个 unicorn 进程,帖子 1000 用户 1000 现在的响应速度
Started GET "/topics/last"
Completed 200 OK in 265ms (Views: 201.0ms | Mongo: 52.8ms | Solr: 0.0ms)
Started GET "/topics"
Completed 200 OK in 120ms (Views: 88.4ms | Mongo: 30.7ms | Solr: 0.0ms)
Started GET "/topics/node2?page=2"
Completed 200 OK in 198ms (Views: 152.2ms | Mongo: 36.3ms | Solr: 0.0ms)
Started GET "/topics"
Completed 200 OK in 223ms (Views: 90.3ms | Mongo: 130.8ms | Solr: 0.0ms)
帖子查看页面,以 777 这篇为例,目前有 58 个回复
Started GET "/topics/777" at 2012-02-04 20:41:05 +0800
Processing by TopicsController#show as HTML
Parameters: {"id"=>"777"}
Rendered topics/_base.html.erb (1.9ms)
Rendered app/cells/topics/sidebar_for_new_topic_node.html.erb (0.9ms)
Rendered topics/_topic_info.html.erb (3.7ms)
Rendered topics/translation/_topic_reply_statics.zh-CN.html.erb (0.3ms)
Rendered replies/_reply.html.erb (5.1ms)
Rendered replies/_reply.html.erb (3.5ms)
Rendered replies/_reply.html.erb (4.0ms)
Rendered replies/_reply.html.erb (4.0ms)
Rendered replies/_reply.html.erb (5.3ms)
Rendered replies/_reply.html.erb (3.9ms)
Rendered replies/_reply.html.erb (3.2ms)
Rendered replies/_reply.html.erb (3.8ms)
Rendered replies/_reply.html.erb (3.3ms)
Rendered replies/_reply.html.erb (3.5ms)
Rendered replies/_reply.html.erb (3.6ms)
Rendered replies/_reply.html.erb (3.6ms)
Rendered replies/_reply.html.erb (3.3ms)
Rendered replies/_reply.html.erb (3.7ms)
Rendered replies/_reply.html.erb (4.4ms)
Rendered replies/_reply.html.erb (4.7ms)
Rendered replies/_reply.html.erb (3.8ms)
Rendered replies/_reply.html.erb (4.3ms)
Rendered replies/_reply.html.erb (3.7ms)
Rendered replies/_reply.html.erb (3.1ms)
Rendered replies/_reply.html.erb (3.7ms)
Rendered replies/_reply.html.erb (3.2ms)
Rendered replies/_reply.html.erb (3.0ms)
Rendered replies/_reply.html.erb (3.6ms)
Rendered replies/_reply.html.erb (3.2ms)
Rendered replies/_reply.html.erb (3.3ms)
Rendered replies/_reply.html.erb (3.3ms)
Rendered replies/_reply.html.erb (3.2ms)
Rendered replies/_reply.html.erb (3.5ms)
Rendered replies/_reply.html.erb (4.1ms)
Rendered replies/_reply.html.erb (6.9ms)
Rendered replies/_reply.html.erb (6.0ms)
Rendered replies/_reply.html.erb (3.9ms)
Rendered replies/_reply.html.erb (3.1ms)
Rendered replies/_reply.html.erb (4.3ms)
Rendered replies/_reply.html.erb (4.0ms)
Rendered replies/_reply.html.erb (4.3ms)
Rendered replies/_reply.html.erb (3.3ms)
Rendered replies/_reply.html.erb (3.8ms)
Rendered replies/_reply.html.erb (7.3ms)
Rendered replies/_reply.html.erb (5.3ms)
Rendered replies/_reply.html.erb (3.8ms)
Rendered replies/_reply.html.erb (4.1ms)
Rendered replies/_reply.html.erb (4.1ms)
Rendered replies/_reply.html.erb (3.2ms)
Rendered replies/_reply.html.erb (3.6ms)
Rendered replies/_reply.html.erb (3.6ms)
Rendered replies/_reply.html.erb (4.0ms)
Rendered replies/_reply.html.erb (3.2ms)
Rendered replies/_reply.html.erb (3.3ms)
Rendered replies/_reply.html.erb (3.9ms)
Rendered replies/_reply.html.erb (10.3ms)
Rendered replies/_reply.html.erb (8.5ms)
Rendered replies/_reply.html.erb (6.0ms)
Rendered replies/_reply.html.erb (3.7ms)
Rendered replies/_reply.html.erb (3.6ms)
Rendered replies/_reply.html.erb (3.6ms)
Rendered replies/_reply.html.erb (3.7ms)
Rendered topics/_replies.html.erb (252.6ms)
Rendered topics/_editor_toolbar.html.erb (0.4ms)
Rendered app/cells/topics/reply_help_block.zh-CN.html.erb (0.0ms)
Rendered topics/show.html.erb within layouts/application (279.3ms)
Rendered common/_search_form.html.erb (0.2ms)
Rendered common/_user_nav.html.erb (4.9ms)
Rendered common/_feeds.html.erb (0.7ms)
Rendered common/_google_analytics.html.erb (0.1ms)
Completed 200 OK in "500ms" (Views: "288.6ms" | Mongo: "49.6ms" | Solr: 0.0ms)
你试试 rvm use 1.9.3
看不明白 你 RVM 是如何安装的,ruby 是如何安装的? 另外别贴图啊,可以直接复制发上来
#5 楼 @ery 谢谢提醒 这个时期可以呼唤 @zhuangbiaowei 报告上去
一直想买个 Air,但是由于败了很多钱在电子产品上面,老婆不让...
我是一直不习惯用分屏
http://ruby-china.org/users/location/广州 http://ruby-china.org/users/location/深圳 这里可以看到有很多啊!
额,中文无法加链接。
#7 楼 @HungYuHei 哈哈哈,大家想法都一样
#3 楼 @fsword 用来不用那个功能,都是用 http://rdoc.info 代替的。
发帖时候那个 Connection refused - connect(2)
是由于 solr 没有启动,用 rake sunspot:solr:start
用 RVM 快速安装这个补丁
rvm remove 1.9.3
rvm get head
rvm install 1.9.3 --patch falcon
rvm 1.9.3 --default
下面是最近一个月的情况:
Mac,买了 ThinkPad 你一定后悔
@hayeah 的工作方式让人无比羡慕啊!
昨日达到了 9K 的 PV
#18 楼 @liuhui998 现在 4%
@jinleileiking 那也不行,有时候有好几个不错的回复
@jinleileiking @lainuo vote 的数量不好控制,如果设置 10,长久下去终有一天会到 10 的。
改了一下说明,让你们误解了,看帖子内容。