View Single Post

  #34 (permalink)  
Old 02-21-2008
The Natural Philosopher
 
Posts: n/a
Default Re: Advantages and disadvantages of PHP?

Tony wrote:
> Tony wrote:
>> Toby A Inkster wrote:
>>> Jonathan Sachs wrote:
>>>
>>>> Speaking technically, it seems to me that PHP is likely to be a poor
>>>> choice for large-scale services where hundreds or thousands of users
>>>> will be hitting the web site at the same time.
>>>
>>> It seems to have worked well enough for Yahoo, Facebook and Wikipedia.
>>>

>>
>> You know, I keep hearing that argument, but I've never seen any
>> substantial evidence to back it up.

>
> I just realized that my post could be read wrong - the argument that I
> haven't seen substantial supporting evidence for is the argument that
> PHP is not good for high-traffic sites.


That confuses me even more!

Anyway when you go to high traffic volume in any software, you run into
a bottleneck at some point.

It's never the same bottleneck twice in my experience.

In one case, we replaced apache with Zeus. Suddenly memory use was way
down. speed was way up. Great.

In another case appropriate indexing on SQL tables resulted in massive
speed increases.

In a third increasing memory and retuning the server for more disk cache
made an enormous difference (in the days when you had to do this: its
largely automatic these days)

Sometimes an algorithm change is all it takes,

Sometimes its a question of recoding a time critical bit in a different
language.

I used to mingle a lot of assembler in my C at one point for that reason..

An interpreted language lile PHP is always likely to be slower than a
complied on like C, but if that isn't the bottleneck, its not relevant.

With a highly loaded server, memory is more likely to be an issue: that
and bandwidth. Only if CPU is getting shagged would you start to look at
the software and try and see why...

Finally, recoding 'slow' bits into another language is no big deal if
the applications is so commercially successful that it needs it.


I regard PHP as a lightweight shim between my MySql databae, the disk
operating system and the apache web server. Frankly it doesn't DO much
other that run MysQL queries and format them for the browser. Thats not
exactly a computationally intensive exercise.

If for example I wanted to analyse 10,000 points and do a least squares
fit and draw a graph..I'd probably say, "bugger PHP, this is one for
some C" and have the PHP point to a C program that would do that jOb and
output an image. For example.

PHP is a good fast prototyping language for rapid web development. Its
popular, its well documented, and its free. It interfaces well to MySql,
and has reasonable graphics support. Its not perfect, but what is? It
has some OOP stuff, but this is not mandated. I like that. It hacks
well, which is useful if you are in a hurry.

I'd say use it till it proves to be inadequate, rather than trying to
find a perfect language from scratch.

You an always recode into something else, once the program logic is
established. Should it be necessary.



Reply With Quote