 |
brainiac Offline [X]
|
Fred - thanks for a great web site which is one of my favourite places to go on the web. I know a lot of people feel that way.
Scrijptegs
--------------
> I believe the bandwidth hit to FM is caused by those images that are hosted by FM. Specifically, the PHP URL emits an HTTP header to suppress caching: this will cause all images to be refetched as readers flip between pages, or revisit the same page in a subsequent browser session.
I agree. FM hosted files are served as php scripts. I know from experience that doing that can be a source of slowdown. What I do whenever serving a jpeg via php is have the script that serves it simultaneously write the file to the server. If someone then requests the file again, it comes as a simple file path instead of this: [https://www.fredmiranda.com/forum/message.php?Action=downloadfile&FileID=218681
Fred, why don't you try caching jpegs instead of serving them as scripts? If you like I am happy to give you my own code which does exactly that.
Image Size
----------------
Images are served in sizes wider than the browser width. The server should serve files in a size which fits. The data-size of files served will drop dramatically. Again, Fred, I am happy to give you my php/javascript code which solves this problem and will lighten the load on your servers for jpegs hosted on FM.
Wasteful output
----------------------
Looking at the page source code of normal pages here, honestly Fred, I can halve the number of bytes being served. You are not harnessing the awesome collective power of your visitors computers by using javascript to expand content. You aren't even applying DRY (don't repeat yourself) principles in CSS. On this very page, the code
span style='color:#ffffff;font-weight:bolder;font-family:verdana,Arial,Helvetica,sans-serif;font-size:14px'
appears EIGHT TIMES! That's just one of hundreds of places in this page where your html/css is really wasteful. I might even do better than halving the output for an identical result.
Javascript is so universal now that you should be building the pages like this:
function dc(uid, uname, uaddr, avatarurl, comid, text){
write('blah blah ' + uname + )
write('blah blah<img src="/avatars/' + avatarurl + '.jpg">')
write('blahblah' + js_processors(text))
write('<input type=button id=' + comid + ' value="delete">' et cetera)
}
dc(4838,'brainiac','UK',129,128376886,'Thanks Fred...')
dc(4838,'brainiac','UK',129,128376887,'Thanks again...')
dc(4838,'brainiac','UK',129,128376888,'...and again')
dc(4838,'brainiac','UK',129,128376889,'...and again')
dc(1,'Fred','USA',2,128376984,'Shutup Brainiac')
i.e. get the 3GHz beast at the other end to draw the bloody page and take the load off your server...
Connection hogging
---------------------------
It might be worth checking whether jpegs hosted on external servers are keeping the connection alive to your server while those external files slowly download. I think it's unlikely but you never know.
Voting
---------
Finally, a very nice way to reduce wastage is to introduce a voting system per comment. Look no further than slashdot.org for an example of how to do that effectively. When a visitor is only viewing the most popular comments she will be loading the server far less. I have written a comment voting system which simply allows one incremental vote per comment per ip address. As before, you're welcome to that code, or just my ideas on how to do that.
Thanks for a great site Fred. There are lots of great people here, and we want to help make FM even better, not just to make you richer, but also to save ourselves time! ;-)
|
| Nov 06, 2007 at 03:30 PM |
| |
|
 |