Zubrag.com
September 19, 2019, 09:34:16 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Bandwidth savings ?  (Read 13096 times)
Eddy_P
Chief Researcher - PPHC Study Group (Australia)
Newbie
*
Posts: 23



WWW
« on: November 23, 2007, 06:53:13 PM »

I am re-constructing a website which may have over 70 html pages.
Each will contain the same Header, Footer, and Menu details.

Should each of these be placed in a remote file to save bandwidth ?

It is my understanding that once the remote file is called once, then the user’s cache supplies the file thereafter, thus not adding 69 x 3 lots of extra bandwidth.

Am I correct with this ?

Header holds  .212 kb of data,
Footer holds  .213 kb of data,
Menu holds 1.39 kb of data.,
totalling 1.815 kb,

but for all 70 html files, total is 127.05 kb.

If 1,000 visitors come to my website, then bandwidth would total 127 MB if all pages are viewed.

If calling remote files puts them in cache, then I would only use 1.815 MB for 1,000 visitors.

Is this how it works?
Is it worth the extra effort and reprogramming ?

Can Javascript call remote files to write data into my menu box, or just PHP ?

The Menu Box in question is at http://www.worldbreakingdiscoveries.com.au
.

Logged

Evidence of TIME TRAVEL presented and examined WORLD BREAKING DISCOVERIES
zubrag
Administrator
Hero Member
*****
Posts: 788


WWW
« Reply #1 on: November 26, 2007, 04:56:43 AM »

Putting some files on remote server will save bandwidth. Usually images or some other big files are placed on remote server. I think putting html on remote server is not a good idea. It would cause more troubles than help. Would not suggest doing so.

In order to save some bandwidth you could add "cache headers" to html, to inform browser when page expires (thus needs to be re-fetched). Like following
<META HTTP-EQUIV="EXPIRES" CONTENT="Mon, 22 Jul 2002 11:12:01 GMT">
But caching will also depend on users' browser settings. Some browser can be set up to fetch page from the server each time, no matter what is set in the page headers.

JavaScript can load text from other servers into your page. But it may not work on some browsers, and not search engine friendly (i.e. search engine will not see that content, so users will not be able to find your site using keywords from that content)
Logged
Eddy_P
Chief Researcher - PPHC Study Group (Australia)
Newbie
*
Posts: 23



WWW
« Reply #2 on: November 26, 2007, 07:03:17 AM »

Thanks for your reply.

I was thinking of changing my 70 html files to php, then use ‘include’ for the Header, Footer, and Menu details.
Or does php put extra load on my sever that may cause other problems ?

Am I correct in presuming that in this way for 70 pages called, only 3 files would be called for each visitor and put into the cache  (not including the php page itself): 1 for the Header, 1 for the Footer, and 1 for the Menu ?

Or to put it another way,
Would using ‘includes' in this way stop the equivalent of 69 extra lots of Header, Footer, and Menu code (in each page) from loading thus saving bandwidth ?

I hope I am making it clear as to what I wish to achieve.

Also, would
<META HTTP-EQUIV="EXPIRES" CONTENT="Fri, 21 Dec 2012 00:00:00 GMT"> keep my files in caches for five years ?
.
Logged

Evidence of TIME TRAVEL presented and examined WORLD BREAKING DISCOVERIES
zubrag
Administrator
Hero Member
*****
Posts: 788


WWW
« Reply #3 on: November 26, 2007, 08:00:24 AM »

The "includes" approach will not save bandwidth. PHP is a server side language, so it will include everything on your server before output to user. If you place header and footer on different server it will only increase your traffic.

All files on one server:
PHP loads body.php in the memory, loads header.php, loads footer.php. They are all on the same server, so no extra bandwidth.

Header/Footer on different server:
PHP loads body.php in the memory, loads header.php from different server (extra bandwidth), loads footer.php from different server (extra bandwidth).

Yes, this would inform browser that page is to expire in 5 years. But as i said before some browsers can ignore this tag, based on browser settings.
<META HTTP-EQUIV="EXPIRES" CONTENT="Fri, 21 Dec 2012 00:00:00 GMT">
Logged
Eddy_P
Chief Researcher - PPHC Study Group (Australia)
Newbie
*
Posts: 23



WWW
« Reply #4 on: November 26, 2007, 08:56:18 PM »

All files on one server:
PHP loads body.php in the memory, loads header.php, loads footer.php. They are all on the same server, so no extra bandwidth.

The first page loaded puts body.php into memory, then loads header.php, footer.php, and menu.php then prints the page to user’s screen.
It is the next 69 pages that I am querying.
Are the included ‘header.php, footer.php, and menu.php’ files taken from the users cache or again called from my server ?

Either this
page1.php + header.php, footer.php, and menu.php, then
page2.php + (header.php, footer.php, and menu.php) again, then
page3.php + (header.php, footer.php, and menu.php) again, then
…..etc

or
page1.php + header.php, footer.php, and menu.php, then
page2.php (+ header.php, footer.php, and menu.php from user’s cahce), then
page3.php (+ header.php, footer.php, and menu.php from user’s cahce), then
etc.

The second would have less bandwidth (ie. only 1 lot of header, footer, menu phps instead of 70)

Have I got it right that the second example would generally occur (assuming user’s cache is turned on) ?
.
Logged

Evidence of TIME TRAVEL presented and examined WORLD BREAKING DISCOVERIES
zubrag
Administrator
Hero Member
*****
Posts: 788


WWW
« Reply #5 on: November 27, 2007, 07:13:54 AM »

Both examples would work the same way.

User will see consolidated page, which consists of merged header.php, footer.php, menu.php, page1.php. So no matter how you do it on the server, user will still receive one page as a result. Browser just does not know footer, menu, header exists as they are merged on your server before passing to the user's browser.
Logged
mcmlxi
Newbie
*
Posts: 11


« Reply #6 on: January 04, 2008, 11:24:00 AM »

I would sincerely doubt that every visitor views every page on your (or any other) site. With the attention span of the average user, this is very unlikely to happen. Having maintained numerous websites over the past 12 years, I think I could count such dedicated visitors on one hand. Most of them stick to the same 10 pages or so. If you consider this, you'll lower your bandwidth needs drastically. Of course, you know more about your visitors and their patterns than I do.
Logged
Eddy_P
Chief Researcher - PPHC Study Group (Australia)
Newbie
*
Posts: 23



WWW
« Reply #7 on: January 13, 2008, 07:16:33 AM »

The content of my website may induce people to read and view nearly every page.

If not, then as you say, I will save on bandwidth.
Logged

Evidence of TIME TRAVEL presented and examined WORLD BREAKING DISCOVERIES
Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC