{"id":4098,"date":"2010-03-23T15:00:05","date_gmt":"2010-03-23T07:00:05","guid":{"rendered":"http:\/\/ihower.tw\/blog\/?p=4098"},"modified":"2015-12-01T16:27:13","modified_gmt":"2015-12-01T08:27:13","slug":"ruby-on-rails-performance-best-practices","status":"publish","type":"post","link":"https:\/\/ihower.tw\/blog\/4098-ruby-on-rails-performance-best-practices","title":{"rendered":"Ruby on Rails Performance \u6700\u4f73\u5be6\u52d9"},"content":{"rendered":"<p>\u9019\u662f\u6211 2\/26 \u5728\u4e2d\u7814\u9662 OSSF \u5de5\u4f5c\u574a\u548c 3\/23 \u5728 Ruby Tuesday \u6240\u6f14\u8b1b\u7684\u984c\u76ee\u4e4b\u4e8c\u3002<\/p>\n<p><iframe loading=\"lazy\" src=\"\/\/www.slideshare.net\/slideshow\/embed_code\/key\/a2rmkA3OKUf1SF\" width=\"595\" height=\"485\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\" style=\"border:1px solid #CCC; border-width:1px; margin-bottom:5px; max-width: 100%;\" allowfullscreen> <\/iframe><\/p>\n<div style=\"margin-bottom:5px\"> <strong> <a href=\"\/\/www.slideshare.net\/ihower\/rails-performance\" title=\"Rails Performance\" target=\"_blank\">Rails Performance<\/a> <\/strong> from <strong><a href=\"\/\/www.slideshare.net\/ihower\" target=\"_blank\">Wen-Tien Chang<\/a><\/strong> <\/div>\n<p>\u95dc\u65bc Performance\uff0c\u6709\u56db\u500b\u6700\u597d\u4e0d\u8981\u505a\u7684\u4e8b\u60c5:<\/p>\n<ul>\n<li>\u904e\u65e9\u6700\u4f73\u5316<\/li>\n<li>\u4e82\u731c\u54ea\u88e1\u6162<\/li>\n<li>\u5230\u8655\u505a\u5feb\u53d6<\/li>\n<li>\u8207 Framework \u904e\u4e0d\u53bb\uff0c\u786c\u8981 Hack \u5b83<\/li>\n<\/ul>\n<p>\u7136\u5f8c\u6709\u4e94\u689d\u95dc\u65bc Performance \u7684\u9808\u77e5:<\/p>\n<ul>\n<li>\u6f14\u7b97\u6cd5\u7684\u6539\u826f\u6c38\u9060\u52dd\u904e\u786c\u64e0\u7a0b\u5f0f\u78bc<\/li>\n<li>\u4e00\u822c\u4f86\u8aaa\uff0c\u7a0b\u5f0f\u78bc\u7dad\u8b77\u6027\u7684\u91cd\u8981\u6027\u52dd\u904e\u6548\u80fd<\/li>\n<li>\u53ea\u6700\u4f73\u5316\u6700\u9700\u8981\u7684\u90e8\u4efd (80\/20\u6cd5\u5247)<\/li>\n<li>\u6e2c\u91cf\u518d\u6e2c\u91cf\uff0c\u6700\u4f73\u5316\u524d\u3001\u6700\u4f73\u5316\u5f8c\u90fd\u8981\u6e2c\u91cf<\/li>\n<li>\u5fc5\u9808\u8207\u7a0b\u5f0f\u78bc\u5f48\u6027\u505a\u5e73\u8861\u3002\u6709\u6642\u5019\u505a\u4e86\u6700\u4f73\u5316\u4e4b\u5f8c(\u4f8b\u5982\u5feb\u53d6)\uff0c\u6703\u72a7\u7272\u6389\u4e00\u4e9b\u5f48\u6027\u3002<\/li>\n<\/ul>\n<p>\u5176\u4ed6\u5c31\u770b\u6295\u5f71\u7247\u5427\u3002\u9019\u4efd\u6295\u5f71\u7247\u4e3b\u8981\u9084\u662f\u95dc\u6ce8\u5728 Web application layer\uff0c\u4e5f\u5c31\u662f Ruby \u7a0b\u5f0f\u8a9e\u8a00\u548c Ruby on Rails \u4e0a\u3002\u6709\u9ede\u5c0f\u53ef\u60dc\u7684\u662f\u7bc7\u5e45\u548c\u6e96\u5099\u6642\u9593\u6240\u9650\uff0c\u95dc\u65bc Front-end performance\u3001NoSQL: Key-value stores \u548c HTTP Caching \u9019\u4e09\u500b\u4e3b\u984c\u662f\u6211\u89ba\u5f97\u53ef\u4ee5\u591a\u8b1b\u4e00\u9ede\u7684\u6771\u897f\u3002<\/p>\n<p>\u6709\u4e86\u6548\u80fd\uff0c\u4e5f\u8a31\u4f60\u6703\u60f3\u9032\u4e00\u6b65\u77e5\u9053\u5982\u4f55\u505a Scaling? \u4e0d\u540c\u65bc Performance \u63a2\u8a0e\u55ae\u4e00\u53f0 application server \u53ef\u4ee5\u670d\u52d9\u591a\u5c11 requests\uff0cScaling \u8981\u63a2\u8a0e\u7684\u554f\u984c\u662f\u5982\u4f55\u64f4\u5c55\u67b6\u69cb\u5230\u591a\u53f0\u4f3a\u670d\u5668\u4e0a\u4f86\u670d\u52d9\u66f4\u591a\u6d41\u91cf\u3002\u7576\u7136 Performance \u6703\u662f\u505a Scaling \u7684\u4e00\u500b\u91cd\u8981\u7684\u56e0\u7d20\uff0c\u4e0d\u904e Scaling \u9700\u8981\u8003\u91cf\u7684\u5730\u65b9\u53c8\u66f4\u591a\u4e86\uff0c\u5305\u62ec:<\/p>\n<ul>\n<li>Asynchrony Processing (Message queue)<\/li>\n<li>Partition Component using SOA<\/li>\n<li>HTTP Reverse Proxy Caching<\/li>\n<li>Distributed Filesystem\/Database<\/li>\n<\/ul>\n<p>\u5176\u4e2d Asynchrony Processing \u548c SOA \u7684\u90e8\u4efd\uff0c\u6211\u5728 <a href=\"http:\/\/ihower.tw\/blog\/archives\/3589\">Distributes Ruby and Rails<\/a> \u7684\u6f14\u8b1b\u6709\u5206\u4eab\u904e\u3002<\/p>\n<p>xdite \u4e5f\u6709\u91dd\u5c0d Scaling Rails Site \u9019\u500b\u4e3b\u984c\u5beb\u4e86\u4e00\u7cfb\u5217\u7684 Scaling Rails Site: Reading Material \u4f86\u4ecb\u7d39: <a href=\"http:\/\/blog.xdite.net\/?p=1597\">#1<\/a>, <a href=\"http:\/\/blog.xdite.net\/?p=1617\">#2<\/a>, <a href=\"http:\/\/blog.xdite.net\/?p=1664\">#3<\/a>, <a href=\"http:\/\/blog.xdite.net\/?p=1682\">#4<\/a>, <a href=\"http:\/\/blog.xdite.net\/?p=1704\">#5<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u9019\u662f\u6211 2\/26 \u5728\u4e2d\u7814\u9662 OSSF \u5de5\u4f5c\u574a\u548c 3\/23 \u5728 Ruby Tuesday \u6240\u6f14\u8b1b\u7684\u984c\u76ee\u4e4b\u4e8c\u3002 R &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/ihower.tw\/blog\/4098-ruby-on-rails-performance-best-practices\" class=\"more-link\">\u95b1\u8b80\u5168\u6587<span class=\"screen-reader-text\">\u3008Ruby on Rails Performance \u6700\u4f73\u5be6\u52d9\u3009<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[50,53,31],"tags":[],"class_list":["post-4098","post","type-post","status-publish","format-standard","hentry","category-performance","category-rails","category-ruby","entry"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p1q6tG-146","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/ihower.tw\/blog\/wp-json\/wp\/v2\/posts\/4098","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ihower.tw\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ihower.tw\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ihower.tw\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ihower.tw\/blog\/wp-json\/wp\/v2\/comments?post=4098"}],"version-history":[{"count":32,"href":"https:\/\/ihower.tw\/blog\/wp-json\/wp\/v2\/posts\/4098\/revisions"}],"predecessor-version":[{"id":8404,"href":"https:\/\/ihower.tw\/blog\/wp-json\/wp\/v2\/posts\/4098\/revisions\/8404"}],"wp:attachment":[{"href":"https:\/\/ihower.tw\/blog\/wp-json\/wp\/v2\/media?parent=4098"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ihower.tw\/blog\/wp-json\/wp\/v2\/categories?post=4098"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ihower.tw\/blog\/wp-json\/wp\/v2\/tags?post=4098"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}