Carrying on our performance experiments with Amazon AWS and Go..
Repeating the same experiments, but comparing EC2 with S3.
S3 looked like this last time:
Document Complete
|
Fully Loaded
| |||||||||
---|---|---|---|---|---|---|---|---|---|---|
Load Time
|
First Byte
|
Start Render
|
DOM Elements
|
Time
|
Requests
|
Bytes In
|
Time
|
Requests
|
Bytes In
| |
First View
|
0.518s
|
0.391s
|
0.000s
|
14
|
0.518s
|
1
|
1 KB
|
0.518s
|
1
|
1 KB
|
Repeat View
|
0.363s
|
0.237s
|
0.000s
|
14
|
0.363s
|
1
|
0 KB
|
0.363s
|
1
|
0 KB
|
Document complete in under half a second, with TTFB of 0.391s and document complete 0.518s
These look pretty respectable, but now compare with an EC2 instance (t1.large linux) using Google Go language as a HTTP server
Document Complete | Fully Loaded | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
Load Time | First Byte | Start Render | DOM Elements | Time | Requests | Bytes In | Time | Requests | Bytes In | |
First View | 0.342s | 0.212s | 0.000s | 14 | 0.342s | 1 | 1 KB | 0.342s | 1 | 1 KB |
Repeat View | 0.389s | 0.224s | 0.000s | 14 | 0.389s | 1 | 1 KB | 0.389s | 1 | 1 KB |
Faster across the board - TTFB has halved to 0.212s and this is time saved off document complete and fully loaded. I was expecting that S3 would be very fast at serving static content, and its looks reasonable, but compared to this single server (large admittedly) its a fair % slower.
Now what happens with Google adverts? we get a similar google ads penalty to last time, 1.5s penalty on document complete and fully loaded:
Whats hidden in these numbers is a little gem - the ~0.200s saved using the EC2 instance is still there, i.e. this performs ~0.200s faster than S3 even when using Google Ads.
So even if you have a very heavy page, and are using CDN or other techniques to speed things up, you really need to see if you can get your TTFB down - and that may mean looking at async HTTP servers such as Go or Node.js
Here is the Go code for this example (the HTML is literal using back-quotes `), based on one of the Go examples:
package main
import (
"fmt"
"http"
)
func Hello(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w,
`
<!doctype html>
<html lang="en-GB">
<head>
<meta charset="utf-8">
<title>Croydon</title>
<meta name="description" content="Croydon">
</head>
<body>
<article>
<p>Croydon</p>
<p>Information on Croydon: shops, restaurants, property, schools, council &amp; government</p>
</article>
<script type="text/javascript"><!--
google_ad_client = "pub-7600935420912685";
google_ad_slot = "7690333966";
google_ad_width = 336;
google_ad_height = 280;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</body>
</html>`)
}
func main() {
http.HandleFunc("/", Hello)
http.ListenAndServe(":8080", nil)
}
Note that the previous tests were rerun to ensure no significant variance in timings. The next set of test will be to see if we can keep sub-0.300s for template based content (as opposed to hard-coded HTML)
Now what happens with Google adverts? we get a similar google ads penalty to last time, 1.5s penalty on document complete and fully loaded:
Document Complete | Fully Loaded | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
Load Time | First Byte | Start Render | DOM Elements | Time | Requests | Bytes In | Time | Requests | Bytes In | |
First View | 1.582s | 0.283s | 0.411s | 175 | 1.582s | 10 | 51 KB | 1.582s | 10 | 51 KB |
Repeat View | 1.184s | 0.210s | 0.523s | 175 | 1.184s | 2 | 6 KB | 1.184s | 2 | 6 KB |
Whats hidden in these numbers is a little gem - the ~0.200s saved using the EC2 instance is still there, i.e. this performs ~0.200s faster than S3 even when using Google Ads.
So even if you have a very heavy page, and are using CDN or other techniques to speed things up, you really need to see if you can get your TTFB down - and that may mean looking at async HTTP servers such as Go or Node.js
Here is the Go code for this example (the HTML is literal using back-quotes `), based on one of the Go examples:
package main
import (
"fmt"
"http"
)
func Hello(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w,
`
<!doctype html>
<html lang="en-GB">
<head>
<meta charset="utf-8">
<title>Croydon</title>
<meta name="description" content="Croydon">
</head>
<body>
<article>
<p>Croydon</p>
<p>Information on Croydon: shops, restaurants, property, schools, council &amp; government</p>
</article>
<script type="text/javascript"><!--
google_ad_client = "pub-7600935420912685";
google_ad_slot = "7690333966";
google_ad_width = 336;
google_ad_height = 280;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</body>
</html>`)
}
func main() {
http.HandleFunc("/", Hello)
http.ListenAndServe(":8080", nil)
}
Note that the previous tests were rerun to ensure no significant variance in timings. The next set of test will be to see if we can keep sub-0.300s for template based content (as opposed to hard-coded HTML)
No comments:
Post a Comment