• 谈谈今天 ruby-china 的优化 at 2012年02月05日

    #12 楼 @hooopo 而且也不是这么好移动的,依赖了很多 Rails Helper,另外到时候格式化规则改变,就数据无法更新,只能上局部缓存了。

  • 谈谈今天 ruby-china 的优化 at 2012年02月05日

    刚刚测试,目前查看帖子页面最耗时的就是 format_topic_body 这个转换过程,比如 777 这片 58 个回复,如果不用 format_topic_body 的话,Rendered topics/_replies.html.erb 的时间可以从 (252.6ms) 下降到 60ms,这个数字还是很可观的。 需要做的就是把 format_topic_body 的过程放到数据提交的时候,查出来就是有格式的。

  • 谈谈今天 ruby-china 的优化 at 2012年02月05日

    #6 楼 @hooopo 不过两种方式效果看起来是一样的,只不过简化了一下,执行时间是差不多的。

  • 谈谈今天 ruby-china 的优化 at 2012年02月05日

    #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 %>
    
  • 谈谈今天 ruby-china 的优化 at 2012年02月04日

    #3 楼 @hooopo 什么 : collection ?

  • 谈谈今天 ruby-china 的优化 at 2012年02月04日

    似乎 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)
    
  • 谈谈今天 ruby-china 的优化 at 2012年02月04日

    做个标记,以后调整哪来对比 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)
    
  • #7 楼 @xds2000 不喜欢用 unless 容易逻辑混乱 if ! 比较符合语言说法,“如果,如果没有”

  • 你试试 rvm use 1.9.3

  • 看不明白 你 RVM 是如何安装的,ruby 是如何安装的? 另外别贴图啊,可以直接复制发上来

  • 吐槽一下盛大云 at 2012年02月04日

    #5 楼 @ery 谢谢提醒 这个时期可以呼唤 @zhuangbiaowei 报告上去

  • #16 楼 @ichord 现在没这么多资源 另外这个是老贴了,现在在 VPS 上面跑的,一直很稳定。

  • 打算换电脑,mac or thinkpad? at 2012年02月04日

    一直想买个 Air,但是由于败了很多钱在电子产品上面,老婆不让...

  • 我是一直不习惯用分屏

  • 有谁在广东吗? at 2012年02月04日

    http://ruby-china.org/users/location/广州 http://ruby-china.org/users/location/深圳 这里可以看到有很多啊!

    额,中文无法加链接。

  • #7 楼 @HungYuHei 哈哈哈,大家想法都一样

  • #3 楼 @fsword 用来不用那个功能,都是用 http://rdoc.info 代替的。

  • #9 楼 @bindiry 可以给他提交个修正啊

  • // at 2012年02月04日

    发帖时候那个 Connection refused - connect(2) 是由于 solr 没有启动,用 rake sunspot:solr:start

  • 1.9.3 的速度 at 2012年02月04日

    用 RVM 快速安装这个补丁

    rvm remove 1.9.3
    rvm get head
    rvm install 1.9.3 --patch falcon
    rvm 1.9.3 --default
    
  • 下面是最近一个月的情况:

  • 打算换电脑,mac or thinkpad? at 2012年02月03日

    Mac,买了 ThinkPad 你一定后悔

  • 有谁在广东吗? at 2012年02月03日

    @hayeah 的工作方式让人无比羡慕啊!

  • #25 楼 @hayeah 不会的

  • 昨日达到了 9K 的 PV

  • #18 楼 @liuhui998 现在 4%

  • @jinleileiking 那也不行,有时候有好几个不错的回复

  • @jinleileiking @lainuo vote 的数量不好控制,如果设置 10,长久下去终有一天会到 10 的。

  • 改了一下说明,让你们误解了,看帖子内容。