PDA

View Full Version : Smilies are slow at loading "Post New Thread" page.


chatbox
Aug 2nd, 2004, 10:28 PM
Thought of something that should free up some server resources.

Can you not embed the smilies images into the HTML page (well, you can, but will you?)? Because when the page loads, the browers then makes 20 something connections to the server to download the smilies. It's very inefficient for the server and browers (over head of the tcp/ip handshake and connection termination). But if you embed the smilies images into the HTML page, then it's all done with one page.

Any suggestions?

chatbox
Aug 4th, 2004, 10:45 AM
No one has any commment to my post? Hum...

Carnage
Aug 4th, 2004, 10:49 AM
Which would also make it harder to change later.

Hard coding the images would force you to manually edit the page and add/remove new images,etc.

And even hard coding it probably wouldn't speed it up much.

[H]ackerK
Aug 4th, 2004, 10:56 AM
Yea. sometimes I feel it is dead slow loading the icons too... But once it is cached, it should be ok.

chatbox
Aug 4th, 2004, 11:08 AM
Which would also make it harder to change later.

Hard coding the images would force you to manually edit the page and add/remove new images,etc.

And even hard coding it probably wouldn't speed it up much.

I don't think it's going to be that often that RFD will be changing these smilies icons...once per year maybe.

Might worth a try...

Now, the strange thing is, even when the icons are cached locally, the browser still seems to try to fetch them off the net...why's that?

Carnage
Aug 4th, 2004, 11:10 AM
But aren't you a programmer?

Suggesting that something be hard coded. You should know better. :cheesygri

chatbox
Aug 4th, 2004, 11:15 AM
But aren't you a programmer?

Suggesting that something be hard coded. You should know better. :cheesygri

LoL...hard coding isn't always bad. Hard coding can sometimes make processing faster, more stremlined.

The other thing the admin can try, instead of having the smilies coded into the HTML page (as my first suggestion). Maybe you can try to compress all the smilies into one package. So, the browser will cache this one particular package and if checking for up-to-date version of the package is needed, there's only one connection that needs to be made, rather than 20-something checking connections.

I just found out why somethings (and not always) the 20-something connections are made. The damn cache only cache files for the life-time of the particular process of the browser. So, if I close down the browser and start another one, then try to post a reply, the 20-something connections (check up-to-date files) are made. Where as if I keep the same browser running, the it only needs to load the images once. i.e. subsequent process of the browser don't seem to know the pre-existance of the locally cached files....

Carnage
Aug 4th, 2004, 11:32 AM
LoL...hard coding isn't always bad. Hard coding can sometimes make processing faster, more stremlined.


True.

But it can also make pages a nightmare to debug at a later date. Instead of changing one value, you need to change the hard coded value in the pages.

But regardless of that do they actually have the ability to do what you mentioned? I don't imagine they're going to want to start modifying a 3rd party board software.

chatbox
Aug 4th, 2004, 11:39 AM
True.

But it can also make pages a nightmare to debug at a later date. Instead of changing one value, you need to change the hard coded value in the pages.

But regardless of that do they actually have the ability to do what you mentioned? I don't imagine they're going to want to start modifying a 3rd party board software.

Embedding images into the page is easy really...Basically you just add the images data to the bottom/end of the page. And reference them from the HTML code. The code for the current images are hard coded anyway. You're just going to need to reference them from a slightly different location. Therefore, relatively speaking, it's not really more hard code than what it is now.

I'm pretty sure that they can mod the board software, just a matter of "will they". I do believe it can unload some stress from the server.

Carnage
Aug 4th, 2004, 11:57 AM
Well I'm pretty sure the smilies aren't hard coded in the way you're thinking. The page is done useing PHP. So those image tags are probably dynamically written when you load the page. Of course it's hard to say for sure without seeing the code itself.

Maybe I'm not following you, but I don't think what you're trying to say is really possible.

And even if they did make the changes you're saying, I really doubt it would make a whole lot of an impact on the server.

Daijoubu
Dec 12th, 2004, 10:34 AM
I wonder who the hell setup this...
A request is first made to http://www.redflagdeals.org (which is running Microsoft IIS 6.0 with Keep-Alive turned off) THEN an 302 Found header issued back to the browser redirecting him to http://www.redflagdeals.com (Apache with Keep-Alive)
So for every single file/images, a new connection have to be opened/closed, thus adding lots of overhead as you can see

When Keep-Alive is enable, a single connections can handle all requests and with pipelining enabled (not sure about IE, but it's enabled by default in Opera and optionally in FireFox), your browser can send multiple requests at the same time instead of waiting for a response file by file

The downside of having Keep-Alive (which is why I believe it's turned off) is that it adds some to the server load since connections are kept opened longer
By default, Apache will wait 30 secs before discarding it
This can be lowered to a more reasonable delay, like 3 to 5 secs, more than enough for most broadband users

If your guys are looking for a way to improve the site speeds, I strongly suggest you to use a thread based httpd, such as:
lighttpd (http://jan.kneschke.de/projects/lighttpd) - PHP via fastcgi (w/load balancing)
LiteSpeed (http://litespeedtech.com) - PHP via fastcgi

Static file hosting:
Boa (http://www.boa.org)
thttpd (http://www.acme.com/software/thttpd) - no keep alive support yet

Much faster than Apache at handling static content such as images ;)

Edit: Corrected servers confusion, .org = IIS, .com = Apache