<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    MDA/MDD/TDD/DDD/DDDDDDD
    posts - 536, comments - 111, trackbacks - 0, articles - 0
      BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理

    rails處理遺留數據庫,分表等

    Posted on 2011-07-10 00:40 leekiang 閱讀(941) 評論(0)  編輯  收藏 所屬分類: rails
    分庫可以在model中加入
    ? establish_connection :your_connection
    ? self.abstract_class = true
    實現.
    分表應該也可以用類似的方法:
    set_table_name

    Rails遺留數據庫訪問之二分庫分表
    Rails遺留數據庫訪問之一動態ORM
    Rails中實現分表(1)垂直分表
    項目中遇到的問題(二)(動態創建MODEL)
    Rails是否可以這樣解決這個辣手的問題?
    Rails中如何支持數據庫分表啊

    http://stackoverflow.com/questions/44145/database-sharding-and-rails
    http://stackoverflow.com/questions/5981724/multiple-database-tables-within-one-ar-model-in-rails-3
    https://github.com/aglasgall/rails-sharding
    http://www.engineyard.com/blog/2009/a-quick-primer-on-sharding-for-ruby-on-rails/
    http://blog.sphereinc.com/2010/04/its-boring-to-scale-with-ruby-on-rails/
    http://kovyrin.net/2010/04/16/dbcharmer-rails-can-scale/
    https://www.ruby-toolbox.com/categories/Active_Record_Sharding
    https://www.ruby-toolbox.com/projects/octopus
    https://www.ruby-toolbox.com/projects/data_fabric

    how RoR scales
    I've said it before, but it bears repeating:?There's nothing interesting about how Ruby on Rails scales. We've gone the easy route and merely followed what makes Yahoo!, LiveJournal, and other high-profile LAMP stacks scale high and mighty.

    Take state out of the application servers and push it to database/memcached/shared network drive (that's the whole Shared Nothing thang). Use load balancers between your tiers, so you have load balancers -> web servers -> load balancers -> app servers -> load balancers -> database/memcached/shared network drive servers. (Past the entry point, load balancers can just be software, like haproxy).

    In a setup like that, you can add almost any number of web and app servers without changing a thing.

    Scaling the database is the "hard part", but still a solved problem. Once you get beyond what can be easily managed by a decent master-slave setup (and that'll probably take millions and millions of pageviews per day), you start doing partitioning.

    Users 1-100K on cluster A, 100K-200K on cluster B, and so on. But again, this is nothing new. LiveJournal scales like that. I hear eBay too. And probably everyone else that has to deal with huge numbers.

    So the scaling part is solved. What's left is judging whether the economics of it are sensible to you. And that's really a performance issue, not a scalability one.

    If your app server costs $500 per month (like our dual xeons does) and can drive 30 requests/second on Rails and 60 requests/second on Java/PHP/.NET/whatever?(these are totally arbitrary numbers pulled out of my...), then you're faced with the cost of $500 for 2.6 million requests/day on the Rails setup and $250 for the same on the other one.

    Now. How much is productivity worth to you? Let's just take a $60K/year programmer. That's $5K/month. If you need to handle 5 million requests/day, your programmer needs to be 10% more productive on Rails to make it even. If he's 15% more productive, you're up $250. And this is not even considering the joy and happiness programmers derive from working with more productive tools (nor that people have claimed to be many times more productive).

    Of course, the silly math above hinges on the assumption that the?whateverstack is twice as fast as Rails. That's a very big if. And totally dependent on the application, the people, and so on. Some have found?Rails to be as fast or faster?than comparable "best-of-breed J2EE stacks".

    The point is that the cost per request is plummeting, but the cost of programming is not. Thus, we have to find ways to trade efficiency in the runtime for efficiency in the "thought time" in order to make the development of applications cheaper. I believed we've long since entered an age where simplicity of development and maintenance is where the real value lies.

    其實正如zhangc之前說,理論的問題都清楚,關鍵還是實踐!


    主站蜘蛛池模板: 国产福利电影一区二区三区,亚洲国模精品一区| 欧洲精品码一区二区三区免费看| 91九色精品国产免费| 亚洲国产高清人在线| 两个人看的www免费视频中文| 国产偷窥女洗浴在线观看亚洲| 一级毛片在线完整免费观看| 亚洲精品国产精品乱码不卞 | 最近最好的中文字幕2019免费 | 国产在线jyzzjyzz免费麻豆| 亚洲最大黄色网址| 91免费国产在线观看| 亚洲三级在线视频| 夫妻免费无码V看片| 九九精品国产亚洲AV日韩| 国产成人高清精品免费鸭子| 色噜噜狠狠色综合免费视频| 亚洲欧洲精品成人久久曰影片 | 亚洲成av人片天堂网| 日韩免费视频一区二区| 老汉色老汉首页a亚洲| 四虎在线免费视频| 亚洲人精品亚洲人成在线| 免费观看的av毛片的网站| 在线播放亚洲精品| 久久99亚洲综合精品首页 | 亚洲制服中文字幕第一区| 四虎成年永久免费网站 | 亚洲国产精品久久久久久| 未满十八18禁止免费无码网站 | 国产无遮挡吃胸膜奶免费看视频| 无码 免费 国产在线观看91| 亚洲啪啪AV无码片| 免费A级毛片av无码| 亚洲av乱码一区二区三区| 国产小视频在线观看免费| 久久久久久久久久久免费精品| 亚洲乱亚洲乱淫久久| 丁香花在线观看免费观看| 美女被暴羞羞免费视频| 国产亚洲av片在线观看16女人 |