5

how is the website http://dftba.com/ so fast?

when i click a link it loads right then? what makes it work like this? how do i make it work like this on my site?

some of the objects on the site are being hosted by a website called ecogeek-cdn.net? who is this company and why do they host the images of this site?

i have been looking into this site some time because i want this site to be like mine site

they site use Apache
they site use Python (when asked the developer told me this)
they site use jquery and jqueryui
they site is custom built not using wordpress
they site is ownedhosted by liquidweb
they site gets a million users a month
they site launched in january
they site uses cpanel
they site does not have SSH or FTP (i tried to connect but it denied me all) they does have SSH and FTP but only allowed by their addresses

Please;
my english is not as good as yours

5
  • 1
    this doesn't sound remotely like spam... Jun 27, 2011 at 18:06
  • 7
    You and @samarudge share an IP address. What is your relationship with him?
    – John Conde
    Jun 27, 2011 at 19:41
  • 6
    That's what I thought when I first read this. user8628 seems like a sock puppet set up to promote the site in question. The question is about a specific site, and the developer of the site just happens to see it and post a very detailed answer within half an hour.
    – Kibbee
    Jun 27, 2011 at 20:01
  • Related, recent good read: Performance is a Feature
    – Paul DelRe
    Jun 27, 2011 at 20:31
  • Holy Ad-spam, Batman!
    – Drew
    Jul 1, 2011 at 5:33

2 Answers 2

17

#BestQuestionEver =)

I'm the developer of the site so I should be able to answer most of these questions

You brought up some interesting points.

In terms of backend (Backend is rarely the source of bottle-necks in page loading, it's mostly loading but it's still worth going over the tech), the site runs on 2 dedicated servers from LiquidWeb (Both with 12xAMD Quad core 1.9Ghz processors and 128GB RAM) using Python and PHP (PHP for the cart/PayPal stuff, Python for the main frontend). We also use MongoDB, Redis and Memcached to speed up processing even more.

The frontend is where it gets interesting though. As John says, we minify all our CSS and Javascript. Also all external resorces are served by the 'ecogeek-cdn' site. Ecogeek is the company that owns the servers that the site runs on, ecogeek-cdn.net points to our self-hosted content distribution network which, depending on your location will ether be served directly by our servers or by EdgeCast (We use some clever DNS stuff I don't fully understand to figure out the best/fastest option). The reason we use the domain ecogeek-cdn.net instead of cdn.dftba.com or something similar is summed up quite nicely by the sstatic site (The CDN used by StackExchange - I.E. this site)

When the browser makes a request for a static image and sends cookies together with the request, the server doesn't have any use for those cookies. So they only create network traffic for no good reason. You should make sure static components are requested with cookie-free requests. Create a subdomain and host all your static components there.

If your domain is www.example.org, you can host your static components on static.example.org. However, if you've already set cookies on the top-level domain example.org as opposed to www.example.org, then all the requests to static.example.org will include those cookies. In this case, you can buy a whole new domain, host your static components there, and keep this domain cookie-free. Yahoo! uses yimg.com, YouTube uses ytimg.com, Amazon uses images-amazon.com and so on.

Another benefit of hosting static components on a cookie-free domain is that some proxies might refuse to cache the components that are requested with cookies. On a related note, if you wonder if you should use example.org or www.example.org for your home page, consider the cookie impact. Omitting www leaves you no choice but to write cookies to *.example.org, so for performance reasons it's best to use the www subdomain and write the cookies to that subdomain.

All of the static content is served through NGINX with keep-alive and very high expire times so it's cached by the users browser for as long as possible, this makes subsiquent page loads very fast because next-to no resorces need to be loaded. We've also started playing about with things like pre-loading images and pages to make things even faster.

But I think the main thing that contributes to our speedy page loads is using AJAX, this means every time your browser requests a page it only loads the resources required for that page, everything else stays where it is. We can also use things like animations to make the page look faster, even if it isn't (It's a psycological thing, if an image takes 1 second to load but for the last 0.25 seconds you're fading in the image, users will feel as though it loaded in 0.75 seconds because things are happening).

There are lots of tricks to getting a fast website (Hint: Time spent trying to speed up your backend is probably wasted. Simple things like using CDNs, minifying files, using CSS sprites etc. can shave half a second of your page load time, you'd have to spend days maybe weeks performance tuning your backend to get that kind of improvement), consult the suggestions on Google PageSpeed and Yahoo YSlow then Google to figure out how to best to impliment it for your site.

11
  • your help is good. thankyou. can i email you to ask more?
    – user8628
    Jun 27, 2011 at 14:04
  • 5
    @user8628 Why do you want to email me? This is a Q&A site so I'll be happy to answer any questions publicly so other people can learn/critisize =)
    – Blank
    Jun 27, 2011 at 14:06
  • @samarudge i had read some things about multiple domains. how do you get this to work with images? for the cache to work each image be served at the same domain else not? see one image is on dftba1.ecogeek-cdn.net. how to make sure it always goes to the same place? and how do they make pages in AJAX?
    – user8628
    Jun 27, 2011 at 14:09
  • 1
    @user8628 Multiple subdomains are easy, every file has a numeric timestamp for when it was added (POSIX time), if you divide this by 4 and take the remainder you will always get the same subdomain if that makes sense. So say an image has the timestamp 1309187478, doing (1309187478%4)+1=3. So we use dftba3.ecogeek-cdn.net as the domain for that media. That domain will always be the same because the timestamp never changes. If you were working with MySQL you could do this based on the primary key of the object but any non-changin integer will work
    – Blank
    Jun 27, 2011 at 14:12
  • 5
    @samarudge You and the question asker seem to share an IP address. What is your relationship to each other?
    – John Conde
    Jun 27, 2011 at 19:40
6

Things I noticed:

  • Their static content is served from a third party sites which allows more files to be downloaded in parallel.

  • It looks like they use a Content Delivery Networks which allows for files to be downloaded from a server closest to thee nd user.

  • Most of the CSS is minified which makes the files size smaller

  • Most of their JavaScript is located at the bottom of the page which allows the browser to load the page first and then processs the JavaScript which will be transparent to the user

  • They cache static files with an expires date far in the future

Interestingly enough they get a low score from Google Page Speed (73 out of 100). I noticed they don't compress their text files with gzip. They'd be even faster if they did.

1
  • I think the low page speed score is mostly down to the images. We need to optimize them but I haven't got round to doing that yet. Also CSS sprites would be better but there are a few things I should probably look at =)
    – Blank
    Jun 27, 2011 at 14:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.