June 5th, 2008 PLEASE FORWARD
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Tips, Tricks, News and Reviews for Web Coders
by Kevin Yank (techtimes@sitepoint.com)
Read the HTML version of this newsletter, with graphics, at:
http://www.sitepoint.com/newsletter/viewissue.php?id=3&issue=192
Note: This newsletter is supported solely by advertisers like the
one below. We stand 100% behind every ad that we run. If you ever
have a problem with a company that advertises here please contact
us and we will try to get it resolved. -- Kevin Yank
IN THIS ISSUE - - - - - - - - - - - - - - - - - - - - - - - - - -
- Introduction
- Did Rails Sink Twitter?
- Serve JavaScript Frameworks Faster with the Google AJAX Library
- New Technical Articles
- Techy Forum Threads
- More Techy Blog Entries
SPONSOR'S MESSAGE - - - - - - - - - - - - - - - - - - - - - - - -
* Experience Award-Winning Customer Service with a Leading Global Hosting Provider at Rackspace *
Our sole mission is to keep your infrastructure up and running so
you and your company can stay focused on growth. Our managed hosting
allow you to retain full control of your OS and application
infrastructures.
- 24x7x365 Fanatical Support(tm)
- Windows and Linux Certified
- Zero-Downtime Network(tm)
- 1-Hour Hardware Replacement Guarantee
Click here to experience our Fanatical Support Promise
http://www.rackspace.com/383?CMP=sitepoint_techtimes_newsletter_june_0605
INTRODUCTION - - - - - - - - - - - - - - - - - - - - - - - - - -
Starting this issue, the Tech Times is going weekly! Please join
me in welcoming Andrew Tetlaw, one of SitePoint's sharp technical
editors, who will be helping me put the newsletter together for
you each week. We'll bring twice the web tech to your inbox for
the same low, low price!
In this issue, I'll look at the difficulties Twitter [1] has had
scaling its service to meet the demands of its users. Some have
suggested that Ruby on Rails, the framework used to build
Twitter, is the root of the problem. Could there be any truth to
this?
SitePoint has just released Simply Rails 2 [2], so this is
an especially timely question for us. Imagine if we found
ourselves publishing a book about Ruby on Rails just as the
framework was revealed to be a dud! Read on for my conclusions.
Also this issue, Andrew takes a look at a new service from
Google that could make life easier for any web developer who
uses JavaScript. Seriously: don't miss this one—it would
be like throwing away money!
[1] <http://www.twitter.com/>
[2] <http://www.sitepoint.com/launch/7d1fc1>
DID RAILS SINK TWITTER? - - - - - - - - - - - - - - - - - - - - -
Twitter [1] is arguably the most heavily used Ruby on Rails
application in the world. Almost since its inception, Twitter
has fostered a wildly passionate cult following. Also from the
beginning, Twitter has suffered from chronic outages under that
load.
In the past month, record downtime [2] has prompted fresh outcry
within its ever-growing user base. This, along with increased
attention from mainstream media, has forced Twitter to publicly
acknowledge these issues, and to reveal a few details about the
source of these problems.
Though there has been much speculation about the source of
Twitter's performance issues, the closest we've had to a
real peek under the hood has been this Twitter Developer Blog
post [3]:
"Twitter is, fundamentally, a messaging system. Twitter was not
architected as a messaging system, however. For expediency's
sake, Twitter was built with technologies and practices that are
more appropriate to a content management system.
But wait, what exactly do they mean by a?oetechnologies and
practices?a?? Could they mean Ruby on Rails?
TWITTER AND THE CURSE OF THE FRAMEWORK
Ruby on Rails is a Model-View-Controller (MVC) framework. To
build an application in Rails, you start by defining a
collection of objects that model the things your application
will do, then you write controllers that juggle your model in
response to user requests, and finally you write the views that
present your application to its users.
As separate as these three elements are, the performance of an
app can depend largely on how they work together. If your model
isn't optimized for the way your controllers will use it,
you could find yourself facing some surprising performance
issues. This is the kind of problem that I expect Twitter is
faced with.
Let's look at a simplified example of what Twitter's problem
might look like on the inside.
Twitter is a site where users post short messages called Tweets,
and follow the Tweets of other users. When the original
developers behind the site first sat down to define their model,
the simplest thing to do would have been to have a database table
for all the Tweets, another table for all the users, and a third
table to keep track of who's following whom.
This approach closely resembles the model you might build for a
content management system (CMS) like a blog: each post has an
author, so you can easily get a list of all the posts (i.e.
Twitter's public timeline [4]), or just the posts in a given
category (e.g. my tweets [5]).
What this fails to take into account is the most common type of
request that Twitter receives: show me the most recent tweets
from just the users that I'm following. With a CMS-style model,
this common request will generate a lot of work for the
application, as it has to filter the timeline of Tweets for each
individual user.
If the original developers of Twitter had realised just how many
requests of this type it would be fielding, Twitter’s model
would probably have been designed very differently. As mentioned
in the blog post quoted above, Twitter really is a messaging
system, and its model should reflect that.
Here's how the model of a messaging system might look: whenever
a user posts a Tweet, the model looks up which users are
following the author and places a copy of the Tweet into those
users' private timelines. Tweets are queued up for their
recipients when they're posted, shifting the processing burden
away from the more common "show me my tweets!" request.
Now, let me be clear: both models could be built with Ruby on
Rails. The CMS-style model is just the direction that the
framework will lead you in if you don't stop and think
about the characteristics of your application. Any good
framework will handle for you the things that most web
applications have in common, so you can focus on the unique
aspects of your app. The curse of the framework is that it can
be very tempting to let the framework itself take the lead in
handling those unique aspects too.
The fact is, Twitter's developers were in a hurry, and took
every opportunity to let the framework do the thinking for
them. Just about every general-purpose web framework out there
would have led them down the same road. "The fault, dear
Brutus, is not in our stars, but in ourselves." The
message here is not that Rails is a bad frameworka?"just
that no framework can do the important thinking about how an app
should work. That's what developers are for.
Like any framework, Rails has strengths and weaknesses. Those
who love Rails believe that its strengthsa?"the virtual
elimination of the scut work of building web apps using a fresh,
expressive programming languagea?"far outweigh weaknesses
like scaling being a non-trivial undertaking. Truth is, if
you're building a service intended for mass adoption and
you don't design it to support that, no framework in the
world is going to keep your app from collapsing in on itself.
SitePoint's new book, Simply Rails 2 [6] is now available.
Get it [7], and build your own Twitter killer!
Think Rails could be doing a better job of protecting developers
from themselves? Leave a comment to let me know:
Ruby on Rails Blog: Get on Track
by Kevin Yank
Did Rails Sink Twitter?
<http://www.sitepoint.com/blog-post-view.php?id=179093>
[1] <http://www.twitter.com/>
[2] <http://blog.twitter.com/2008/05/i-have-this-graph-up-on-my-screen-all.html>
[3] <http://dev.twitter.com/2008/05/twittering-about-architecture.html>
[4] <http://twitter.com/public_timeline>
[5] <http://twitter.com/sentience>
[6] <http://www.sitepoint.com/launch/7d1fc1>
[7] <https://sitepoint.com/bookstore/go/140/7d1fc1>
SPONSOR'S MESSAGE - - - - - - - - - - - - - - - - - - - - - - - -
Maintaining a website can be both fun and sometimes frustrating
especially if the web host does not catch up to your needs. The
owners behind WebHostingBuzz have experienced it all.
We have been there and done it. We know what YOU want when it comes
to running a script oriented website. We know what YOU want when it
comes to value for your web hosting dollars. We host over 150,000
domains across the globe. Surely we can host yours!
Get 3 free domains for life, 1125 GB Space and 15,000 GB transfer
for only $119.4/year.
http://www.webhostingbuzz.com/website-hosting.shtml?host_shared-hosting
SERVE JAVASCRIPT FRAMEWORKS FASTER WITH THE GOOGLE AJAX LIBRARY -
Google has announced [1] an extension to its Google AJAX APIs
[2] service: the AJAX Library APIs [3]. Google has assembled a
collection of the most common JavaScript libraries and made them
available on its content delivery network.
A common criticism leveled at JavaScript framework libraries is
that the same code is downloaded from all the sites that use
them, wasting bandwidth and creating duplicate files in the
browser's local cache. Google's initiative is an effort to
relieve that burden and create a kind of JavaScript Shangri La
[4] where all the frameworks hang out together, making efficient
use of their time and possibly singing. If there's a better way
to ruin a decent plane-crash-survival movie [5] than singing I
haven't seen it! Frank Capra has a lot to answer for.
Anyway, the more sites use the Google CDN for their JavaScript
libraries, the better the chance that the browser has already
cached a local copy of it, and can avoid having to download it
again. Everyone reaps the performance benefits!
Using the service is simple. You can directly reference the
libraries via a URI like so:
<script type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/prototype/1.6.0.2/prototype.js">
</script>
Alternatively, you can use Google's API thusly:
<script type="text/javascript"
src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("prototype", "1.6.0.2");
</script>
The first argument is the name of the library and the second is
the desired version.
The JavaScript that comes down the wire is gzipped when
supported by the browser (the 124K Prototype library is
compressed to about 30K) and comes with appropriate cache
headers. An excellent feature of the service is the control it
provides over versioning. The above examples download a very
specific version of Prototype: 1.6.0.2. But you can specify any
increment level; it will serve up the latest version. For
example, if you specify version 1.6 you'll get the latest 1.6
incremental version, whatever that may be. The same happens if
you specify version 1, and if you don't specify any version,
you'll get the latest version available.
However, I noticed something even niftier when I was doing some
testing: the Cache-Control header value is adjusted to suit the
request. When specifying a specific incremental version, the
header value looks like this:
Cache-Control: public, max-age=31536000
This informs any caching mechanism that cares to honor
Cache-Control headers that the content is safe to cache for up
to a year. When a more general version is specified, you get
this:
Cache-Control: public, max-age=3600, must-revalidate,
proxy-revalidate
This informs caches that the content should be checked for
changes hourly, to ensure the latest version is delivered.
Currently, Google hosts:
- jQuery
- prototype
- script.aculo.us
- MooTools
- dojo
Despite the rantings of some grumpy old curmudgeons [6], the
use of JavaScript framework libraries is only increasing and
improving. I can remember the old days of DHTML, when every
script available had its own version of the addEvent method;
there was so much wasteful duplication of code! The availability
of common frameworks has stopped the duplication and offers a
useful level of abstraction. I think Google's new service is a
great step in the right direction.
Will you use this in your next JavaScript project? Read the full
blog entry and post a comment to let me know:
JavaScript & CSS Blog: Stylish Scripting
by Andrew Tetlaw
Serve JavaScript Frameworks Faster with the Google AJAX Library (8 comments)
http://www.sitepoint.com/blogs/2008/05/28/serve-javascript-frameworks-faster-with-the-google-ajax-libraries-api/
[1] <http://googleajaxsearchapi.blogspot.com/2008/05/speed-up-access-to-your-favorite.html>
[2] <http://code.google.com/apis/ajax/documentation/>
[3] <http://code.google.com/apis/ajaxlibs/documentation/index.html>
[4] <http://en.wikipedia.org/wiki/Shangri-La>
[5] <http://en.wikipedia.org/wiki/Lost_Horizon_%28film%29>
[6] <http://www.sitepoint.com/blogs/2008/04/17/youre-fat-and-i-hate-you/>
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
See you next week, when Andrew will take a look at Google App
Engine!
Kevin Yank
techtimes@sitepoint.com
Editor, The SitePoint Tech Times
SPONSOR'S MESSAGE - - - - - - - - - - - - - - - - - - - - - - - -
Morae: Usability Testing for Software & Web Sites. An all-digital tool
that enables you to:
-Quickly identify website and software design problems
-Affordably conduct user testing. Quickly calculate metrics & graph results.
-Deliver professional results in a fraction of the time.
http://www.techsmith.com/morae.asp?cmp=StPtUX3
NEW TECHNICAL ARTICLES - - - - - - - - - - - - - - - - - - - - -
How to Code HTML Email Newsletters
by Tim Slavin
Browser idiosyncracies, spam registers, and various mail clients
are just some of the pitfalls that must be faced by email
marketers. Make sure your HTML email gets through with Tim's
essential how-to.
http://www.sitepoint.com/article/1422
Create Scalable Applications with ColdFusion Components
by Ben Davies
Is the code in your ColdFusion web application out of control?
Do you have six versions of the same function spread across many
different files? Ben shows how easy it is to write and use
ColdFusion components, take back control of your application
code, and shift your development practices into high gear!
http://www.sitepoint.com/article/1643
TECHY FORUM THREADS - - - - - - - - - - - - - - - - - - - - - - -
Improving Web Application Security
<http://www.sitepoint.com/forums/showthread.php?threadid=550058>
Micro$oft extends life of XP!
<http://www.sitepoint.com/forums/showthread.php?threadid=551968>
Adobe Launches Acrobat 9 and Acrobat.com: PDFs Get Flash!
<http://www.sitepoint.com/forums/showthread.php?threadid=551828>
Is it fair for Web designers to use CMS's?
<http://www.sitepoint.com/forums/showthread.php?threadid=551728>
Whose fault is it? The Browser Developer, the Website Developer
or the user?
<http://www.sitepoint.com/forums/showthread.php?threadid=551694>
Microsoft urges web developers/designers to get ready for IE8
<http://www.sitepoint.com/forums/showthread.php?threadid=550840>
Facebook Platform to be released as Open Source
<http://www.sitepoint.com/forums/showthread.php?threadid=550562>
Adobe releases Dreamweaver, Fireworks and Soundbooth CS4 betas!
<http://www.sitepoint.com/forums/showthread.php?threadid=550555>
Google to reveal a bit of their search algorithm
<http://www.sitepoint.com/forums/showthread.php?threadid=550158>
MORE TECHY BLOG ENTRIES - - - - - - - - - - - - - - - - - - - - -
ColdFusion Blog: INFUSED
The Week in ColdFusion: 28 May a?" 3 June: Another CFML engine
goes open source)
http://www.sitepoint.com/blogs/2008/06/06/the-week-in-coldfusion-28-may-%e2%80%93-3-june-another-cfml-engine-goes-open-source/
The leadup to WebDU: web conference with a difference (2
comments)
http://www.sitepoint.com/blogs/2008/06/03/the-leadup-to-webdu-web-conference-with-a-difference/
The Week in ColdFusion: 21-27 May: Better late than never (1
comment)
http://www.sitepoint.com/blogs/2008/06/01/the-week-in-coldfusion-21-27-may-better-late-than-never/
Web Tech Blog: TECHNICALLY SPEAKING
Goosh: Google From The Command Line)
http://www.sitepoint.com/blogs/2008/06/05/goosh-google-from-the-command-line/
@media 2008: From Scaffolding Or From Scratch? (1 comment)
http://www.sitepoint.com/blogs/2008/06/01/atmedia-2008-day-two/
@media 2008: Exploring The Alternative Web (2 comments)
http://www.sitepoint.com/blogs/2008/05/30/media2008-day-one/
15 Million Reasons Why Twitter Sucksa?| (15 comments)
http://www.sitepoint.com/blogs/2008/05/29/15-million-reasons-why-twitter-sucks%e2%80%a6/
Adobe Flex/AIR Article Competition: And The Winners Are... (2
comments)
http://www.sitepoint.com/blogs/2008/05/26/adobe-flexair-article-competition-and-the-winners-are/
Ruby on Rails Blog: GET ON TRACK
Simply Rails 2: Your Rails 2 beginners book (5 comments)
http://www.sitepoint.com/blogs/2008/06/02/simply-rails-2-your-rails-2-beginners-book/
PHP Blog: DYNAMICALLY TYPED
PHPBench.com: Live PHP benchmarks, demystifying "best practices"
(12 comments)
http://www.sitepoint.com/blogs/2008/06/02/phpbench-live-php-benchmarks-best-practices/
Debugging PHP (6 comments)
http://www.sitepoint.com/blogs/2008/06/02/debugging-php/
.NET Blog: DAILY CATCH
ASP.NET MVC Preview 3 is Out!)
http://www.sitepoint.com/blogs/2008/05/29/mvc-preview-3-is-out/
ADVERTISING INFORMATION - - - - - - - - - - - - - - - - - - - - -
Find out what thousands of savvy Internet marketers already know:
email newsletter advertising works! (You're reading an email ad
now, aren't you?)
Find out how to get YOUR sponsorship ad in this newsletter and
reach 95,000+ opt-in subscribers! Check out
http://www.sitepoint.com/mediakit/ for details, or email us at
mailto:adinfo@sitepoint.com
HELP YOUR FRIENDS OUT - - - - - - - - - - - - - - - - - - - - - -
People you care about can take charge of their Website by
effectively using the information and resources available on the
Internet. Help them learn how - forward them a copy
of this week's SitePoint Tech Times.
ADDRESSES - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Send suggestions and comments to:
techtimes@sitepoint.com
To subscribe, send a blank email to:
subscribe@sitepoint.com
The Archives are located at:
http://www.sitepoint.com/newsletter/archives.php
The SitePoint Tech Times is hosted by SparkList:
http://www.sitepoint.com/newsletters/sparklist/
The SitePoint Tech Times is (c) 1998-2008 SitePoint Pty. Ltd. All
Rights Reserved. No part of this Newsletter may be reproduced in
whole or in part without written permission. All guest articles
are copyright their respective owners and are reproduced with
permission.
SitePoint Pty. Ltd.
48 Cambridge Street
Collingwood, VIC 3066
AUSTRALIA
You are currently subscribed to The SitePoint Tech Times as:
ignoble.experiment@arconati.us
To change the email address that you currently subscribe with:
http://sitepoint.com/newsletter/manage.php
To switch to the HTML version of this newsletter:
<http://sitepoint.com/newsletter/htmlplease.php?email=ignoble.experiment@arconati.us>
To leave this list, send a blank email to:
leave-2039759-2266608.e57363ef99c8b59c8667cca2fd106cbe@sitepoint.sparklist.com
Do Not Reply to this email to unsubscribe.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
No comments:
Post a Comment
Keep a civil tongue.