tags:

views:

287

answers:

6

Hi,

I am thinking to save server load, i could load common javascript files (jquery src) and maybe certain images from websites like Google (which are almost always never down, and always pretty fast, maybe faster than my server).

Will it save much load?

Thanks!

UPDATE: I am not so much worried about saving bandwidth, as I am reducing Server Load because my server has difficulty when there are a lot of users online, and I think this is because there are too many images/files it loads from my single server.

+2  A: 

This is known as a content delivery network, and it will help, although you should probably make sure you need one before you go about setting it all up. I have heard okay things about Amazon S3 for this (which Twitter, among other sites, use to host their images and such). Also, you should consider Google's API cloud if you are using any popular javascript libraries.

Paolo Bergantino
thanks, i didn't know it was called that. I will get jquery from google.
chris
+1  A: 

It really depends on what your server load is like now. Are there lots of small web pages and lots of users? If so, then the 50K taken up by jQuery could mean a lot. If all of your pages are fairly large, and/or you have a small user base, caching jQuery with Google might not help much. Same with the pictures. That said, I have heard anecdotal reports (here on SO) that loading your scripts from Google does indeed provide noticeable performance improvement. I have also heard that Google is not necessarily 100% uptime (though it is close), and when it is down it is damned inconvenient.

If you're suffering from speed problems, putting your scripts at the bottom of the web page can help a lot.

Robert Harvey
i have to try moving my scripts to the bottom of the page. Does this include css scripts as well?
chris
No, CSS style sheets go at the top of the page. For more info and other best practices, see http://developer.yahoo.com/performance/rules.html
Robert Harvey
+1  A: 

I'm assuming you want to save costs by offloading commonly used resources to the web at large.

What you're suggesting is called Hotlinking.. that means directly linking to other people's content. While it can work in most cases, you do lose control of the content, that means your website may change without your input. Since image hosted on google are scoured from other websites, the images may be copyrighted, causing some (potential) concern, or they may have anti-hotlinking measures that may block the images from your webpage.

If you're just working on a hobby website, you can consider hosting your resources on a free web account to save bandwidth.

futureelite7
re: free web account idea: If I move my images to a Google Sites account, do you know if Google Sites' servers are just as fast as Google.com?
chris
They should be served using the same infrastructure, so I reckon that it will be just as fast. They do have the option for additional bandwidth at cost, but you can just use the free bandwidth until you get an idea of the bandwidth needed.
futureelite7
+3  A: 

You might consider putting up another server that does nothing but serve your static files using an ultra efficient web server such as lighttpd

Don Neufeld
A: 

Here is an article which tells you what are the ways to speed up your page

webdevelopertut

Webdevelopertut
+2  A: 

Well, there are a couple things in principle:

  1. Serving up static resources (.htm files, image files, etc) rarely even make a server breathe hard except under the most demanding of circumstances (thousands of requests in a very short period of time)
  2. Google's network is most likely faster than yours, and most everyone else. ;)

So if you are truly not experiencing any bandwidth problems, I don't think offloading your images, etc will do much for you. However, as you move stuff off to Google, then it frees your server's bandwidth up for more concurrent requests and faster transfer on the existing ones. The only tradeoff here is that clients will experience a slight (most likely unnoticable) initial delay while DNS looks up the other servers and initiates the connection to them.

routeNpingme