xdite, Rocodev
xdite xdite@rocodev.com
Poster from movie “Fulltime Killer”
Web 框架 | 併發模型 | 531 req / s |
Rails | Multiple Process | 531 req / s |
Sinatra | Multiple Process | 576 req / s |
Sinatra::Synchrony | Fibers | 1692 req / s |
Goliath | Fibers | 1924 req / s |
Cramp | Event IO | 3516 req / s |
Node.js | Event IO | 3100 req / s |
Web 框架 | 併發模型 | 531 req / s |
Rails | Multiple Process | 531 req / s |
Sinatra | Multiple Process | 576 req / s |
Sinatra::Synchrony | Fibers | 1692 req / s |
Goliath | Fibers | 1924 req / s |
Cramp | Event IO | 3516 req / s |
Node.js | Event IO | 3100 req / s |
The HTTP/1.1
specification suggests that browsers download no more than 2 components in parallel per hostname. If you serve your images from multiple hostnames
, you can get more than two downloads to occur in parallel.
config.action_controller.asset_host =
"http://asset%d.example.com"
<img src="http://asset1.example.org/demo4.jpg">
<img src="http://asset2.example.org/demo3.jpg">
<img src="http://asset3.example.org/demo2.jpg">
<img src="http://asset4.example.org/demo1.jpg">
A content delivery network or content distribution network (CDN)
is a large distributed system of servers deployed in multiple data centers across the Internet. The goal of a CDN is to serve content to end-users with high availability and high performance.
config.action_controller.asset_host =
"http://cdn%d.example.com"
<img src="http://cdn1.example.org/demo4.jpg">
<img src="http://cdn2.example.org/demo3.jpg">
<img src="http://cdn3.example.org/demo2.jpg">
<img src="http://cdn4.example.org/demo1.jpg">
<link href="/assets/application.css" type="text/css" />
<link href="/assets/application-v1.css" type="text/css" />
<link href="/assets/application-v2.css" type="text/css" />
<link href="/assets/application-v3.css" type="text/css" />
TIMESTAMP
, auto INVALID<link href="/assets/application-1b7a795f9.css" type="text/css" />
<link href="/assets/application-ca29aba87.css" type="text/css" />
<link href="/assets/application-72ae3ec5b.css" type="text/css" />
<link href="/assets/bootstrap.css" type="text/css" />
<link href="/assets/my-homepage.css" type="text/css" />
<link href="/assets/user-account.css" type="text/css" />
//= require_self
//= require bootstrap
//= require my-homepage
//= require user-account.css
//= require jquery.fullcalendar
<link href="/assets/application-1b7a795f9.css" type="text/css" />
SCSS
& Compass
@import "icon/*.png";
$icon-sprite-dimensions: true;
@include all-icon-sprites;
ETag
, is part of HTTP, the protocol for the World Wide Web. It is one of several mechanisms that HTTP provides for web cache validation, and which allows a client to make conditional requests. This allows caches to be more efficient, and saves bandwidth, as a web server does not need to send a full response if the content has not changed.
# lib/rack/etag.rb
def call(env)
status, headers, body = @app.call(env)
parts = []
body.each { |part| parts << part.to_s }
headers['ETag'] = %("#{Digest::MD5.hexdigest(parts.join(""))}")
[status, headers, parts]
end
rm -rf boostrap-2.2
cp -rf ~/Downloads/bootstrap bootstrap-2.3
gem "jquery"
gem "font-awesome"
gem "tinymce-rails"
gem "bootstrap-rails", "2.2.0"
gem "jquery"
gem "font-awesome"
gem "tinymce-rails"
gem "bootstrap-rails", "2.3.0"
.article h2 { font-size: 20px;}
.user .name { font-weight: bold; }
.comment p { line-height: 1.2em; }
//= require article
//= require user
//= require comment
vendor/styelseets/
boostrap-2.3.cssapp/styelseets/
my-home.csslib/styelseets/
social-share.css//= require bootstrap-wrapper
//= require awesome-bootstrap-theme
//= require awesome-bootstrap-theme-override
@import "bootstrap-setting";
@import "twitter/bootstrap/variables";
@import "bootstrap-override";
// puts your override variable here
// $baseFontSize: 13px;
// $navbarHeight: 50px;
$navbarInverseLinkColor: #ddd;
$navbarInverseBackground: #222;
$navbarInverseBackgroundHighlight: #610403;