giza: Giza White Mage (Default)
[personal profile] giza
I just saw an article on Digg called 60 Performance and Optimization Tips for your Website. The title looked cool enough, so I clicked on the link.

I was treated to intelligent observations like:

"Use a quality NIC"
"Reduce the use of global variables"
"Avoid throwing exceptions" (!)
"Enable buffering"

The first one of that bunch, "Use a quality NIC", is so vague as to be useless. It doesn't say a thing thing what sort of features we should look for, mention specific cards, or even a specific vendor.

The second one about global variables, is good advice but fails to tell WHY we should not use globals. (Hint: it has to do with conserving the global namespace and writing modular code) I don't believe in "voodoo" -- I'm not going to do/not do something because someone that is supposedly in a position of authority says so. I want to know details, dammit.

Avoiding throwing exceptions? I'd sure like to know what kind of crack of the author is on. But, since he didn't elaborate on why exceptions should not be thrown, I can only speculate his reasons for saying that. Perhaps he meant to say, "make sure you have code that catches all exceptions so that the user doesn't see a traceback if there is an error".

And finally, "Enable buffering". Sure, it's a good idea because it causes more efficient use of disk and network resources, but again, the author fails to tell us this.

The end result is a guide that has some good advice, but completely fails to educate the beginner programmer. What a terrible waste.

(no subject)

Date: 2006-11-27 04:05 pm (UTC)
From: [identity profile] drleo.livejournal.com
Exceptions are expensive to throw and catch. Lots of them can have a noticable performance impact. Maybe that's why he says it.

(no subject)

Date: 2006-11-27 04:09 pm (UTC)
From: [identity profile] giza.livejournal.com

Maybe he should have told us that. :-/

(no subject)

Date: 2006-11-27 04:20 pm (UTC)
From: [identity profile] drleo.livejournal.com
Yeah, he should have. Although in the point above about "avoid catching unnecessary exceptions," he does make the mention exceptions incurring large overhead. He likely should have said "avoid throwing unnecessary exceptions" or "avoid using exceptions for control flow". I wouldn't say avoid throwing exceptions entirely, but they should only be used in exceptional circumstances, hence the name, for when something is really screwed up.

"Use a quality NIC" is kinda silly. At least he says that's only relevant to people hosting their own sites on their own hardware. I could see people taking that to mean that the NIC on your development station somehow has an effect. If the choice of hardware is that important, then you're getting into the realm where you need to start thinking about serious hardware with seriously-tuned servers. I don't think anyone running that ambitious a site will be looking at a list like this.

(no subject)

Date: 2006-11-27 06:05 pm (UTC)
From: [identity profile] simbab.livejournal.com
Web programming in general makes me want to hurt people...especially when I was running my own Wordpress installation and seemed like there was a security vulnerability every other week...

(no subject)

Date: 2006-11-27 09:39 pm (UTC)
From: [identity profile] giza.livejournal.com
I've been programming in PHP for 8 years. Wanna hurt me? :-)

Seriously, the problem with PHP is that it's like the new Visual Basic. People who have no technology background whatsoever get into it, and fumble their way through it. These are people who have no idea what big-O notation is, why modifying a hash table while you iterate through it is a bad thing, or have one-dimensional scalar arrays of unlike values in them.

And those people are expected to somehow understand security concepts such as shell meta characters and tained data? Ha. Good luck on that!

I'm not saying that the authors of Wordpress are anything like what I just described.

I am saying, however, that while PHP is an awesome tool, there is a whole class of people out there who simply do not know what they are doing and should not be writing in it, or any other programming language.

For further reading: http://thedailywtf.com/

(no subject)

Date: 2006-11-27 09:50 pm (UTC)
From: [identity profile] simbab.livejournal.com
I've seen that site...there's some funny stuff on there.

You clearly understand more about this stuff than I do, and what's more according to this (http://furry.wikia.com/wiki/Giza) you do weight training, so I think I am bested in both respects. :-)

**tips his hat**

(no subject)

Date: 2006-11-27 10:12 pm (UTC)
From: [identity profile] giza.livejournal.com

Eh, I've merely been doing it longer.

I've written code in years past that I would be ashamed of today. (Ditto for my weight training habits)

(no subject)

Date: 2006-11-28 07:26 am (UTC)
From: [identity profile] streakthetiger.livejournal.com
As I have no idea what any of that means becuase I have no programming or website making experience, I will just leave you a random comment with a friendly hug.






















*friendly hug*

(no subject)

Date: 2006-11-28 08:34 am (UTC)
From: [identity profile] jlick.livejournal.com
Unless you have a *broken* NIC, what kind you use will have no measurable difference in performance for most web servers. Heck, even a crusty old early 90s 10mbps card will be fine unless you have a T3 or better. And you really only see significant performance differences between different NICs when you get to gigabit or above. (With gigabit ethernet you would want a NIC with at least 8K jumbo frame support and in-hardware checksumming. The Intel ones are good.) But few web servers get anywhere near enough usage to generate that much bandwidth. (Your employer may be one of the exceptions.)

(no subject)

Date: 2006-11-28 09:01 am (UTC)
From: [identity profile] jlick.livejournal.com
Gah. There's some good advice in there but there's a bunch of moronic stuff as well.

"In a shared server environment (not dedicated hosting), find out how many other websites are on the same server as yours. Some web hosts will put up to 1 thousand sites on one server."

My servers have a couple of hundred sites on them. Less than 10 have any significant traffic. 1 busy site will be more painful to share a server with than 1 thousand seldom used sites.

"Use image ALT attributes sparingly. Each character adds to the size of the web page and to the load time."
"Use comments sparingly. While invisible when a web page is loaded in a browser, the comments are still transferred from the web server, needlessly wasting bandwidth."

ALT tags are REQUIRED in current HTML specs. Not using them makes usability by the handicapped difficult and can violate accessibility standards or laws. Moreover, ALT tags if done well will take up maybe 20-30 bytes extra per image. Comments are a little different but again they seldom take much extra room compared to any kind of image or multimedia content.

"Avoid unnecessary HTML tags: not all tags need a closing tag."

Again, this guy must not be up to speed on current HTML standards, and this will also have minor savings.

"Place external JavaScript tags, i.e. with src=[someurl], at the end of the document to delay loading."

Err, what?

"When specifying a URL without a web page, e.g. http://www.exclamationsoft.com, include the trailing slash, e.g. http://www.exclamationsoft.com/, to save a trip back to the web server."

Um, sorry?

"Use client-side validation controls to reduce server round-trips."

On the other hand this can be a disaster for security if server-side validation isn't also used.

(no subject)

Date: 2006-11-28 02:56 pm (UTC)
From: [identity profile] giza.livejournal.com
> "Avoid unnecessary HTML tags: not all tags need a closing tag."
>
> Again, this guy must not be up to speed on current HTML standards, and this
> will also have minor savings.

Oh yeah, I forgot about that one!

> "When specifying a URL without a web page, e.g.
> http://www.exclamationsoft.com, include the trailing slash, e.g.
> http://www.exclamationsoft.com/, to save a trip back to the web server."
>
> Um, sorry?

No, he's got a point. He just failed to explain it like so many others. If you hit the first URL, the webserver will redirect you to the second URL with the trailing slash. This is so that the browser can create the right URLs for links and images on that page. Otherwise it'll wind up with "http://www.exclamationsoft.comimage.gif", for example.

Though I do question if the 300 bytes or so in total to handle that redirect is such a big thing.

> "Use client-side validation controls to reduce server round-trips."
>
> On the other hand this can be a disaster for security if server-side
> validation isn't also used.

Oh yeah, I forgot about that one. That's another one that made me fall off my chair. :-P

(no subject)

Date: 2006-11-28 04:03 pm (UTC)
From: [identity profile] randomzen.livejournal.com
Welcome to digg - they suck. Somehow I'm on there 10 times a day, but no doubt is the site polluted with junk. Everyone wants to be an author, and everyone wants to submit things with the hopes of it making it to the front page. This means poor and inaccurate titles and terribly written articles.

Mostly, the titles are written to sound so exciting, yet all they endorse is a shitty article that under normal circumstances would never even be on the net, or at least never see traffic. Yet everyone votes them to the top because the subject matter is something they are a fan of. I continue to hear stats like 7 out of 10 voters don't even click through to the story. Like Nintendo? If it's in the title, and it sounds like it shows it in a positive light, it gets clicked on regardless.

After seeing the same things come up over and over, my instinct is to say "this news site has a major slant problem" - but then I remember it's the viewers that control it (as opposed to an owner with an agenda). Which is also kinda neat, because it reveals what kind of crowd contributes heavily on digg.

Try it yourself! Just write a short, inaccurate, or wholly unhelpful blog and then submit it. If you use any of the following themes, it will hit the front page:

Ubuntu good
Republicans bad
Wii good
PS3 bad
Mac good
Zune bad
Open source good
Media bad

Also accepted is any photo that is "AMAZING!!", a video that is a "MUST SEE!!!!11", or any half-assed guide or tips to anything. The more enumerated the better.

7 tips when setting up a Wii
Top 10 mistakes when running Ubuntu
16 reasons why not to buy a Zune
Etc.

But again, I only know this because I'm on it 10 times a day.

(no subject)

Date: 2006-11-28 04:05 pm (UTC)
From: [identity profile] giza.livejournal.com

Wow, so it's not just me that has had issues with some of the stuff on there.

(no subject)

Date: 2006-11-28 04:17 pm (UTC)
From: [identity profile] wildw0lf.livejournal.com
I took a couple programming classes before, and got totally lost when it came to arrays. I did enough programming to find out I really didn't like it.

Maybe this article that was being done wasn't even aimed at the average programmer at all, but at the average computer user, who doesn't know any programming at all.

(no subject)

Date: 2006-11-28 04:22 pm (UTC)
From: [identity profile] giza.livejournal.com
Eh, it's not like his article inconvenienced ME in my day job.

As for learning about computers, I recommend the book, "How Computers Work (http://www.amazon.com/How-Computers-Work-8th-Works/dp/0789734249/sr=1-1/qid=1164730868/ref=pd_bbs_sr_1/102-7660841-6754540?ie=UTF8&s=books). It is an illustrated, plain English book about the inner workings of computers.

(no subject)

Date: 2006-11-29 02:51 am (UTC)
From: [identity profile] jlick.livejournal.com
"No, he's got a point. He just failed to explain it like so many others. If you hit the first URL, the webserver will redirect you to the second URL with the trailing slash."

Ah, I understand what he's saying now. Though again his example is busted. There is no way in HTTP to access a URL http://www.example.com (what would be in the GET command then?). The client will always have to add the trailing slash. An accurate example would be http://www.example.com/dir versus http://www.example.com/dir/ where either one is a valid url but the first would require a redirect.

Profile

giza: Giza White Mage (Default)
Douglas Muth

April 2012

S M T W T F S
1234567
891011121314
15161718192021
22232425262728
2930     

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags