views:

74

answers:

4

Hi; I want to know which language either php an interpreted language or Asp.net a compiled language to be adopted in the following scenario for better performance and why? Scenario: A business to business portal has to be made which will face 10,000+ users per hour traffic.

+3  A: 

The people at Facebook use HipHop for PHP which converts PHP code into C++ code, making it extremely fast.

Usually languages such as C/C++ are faster than others because they compile right down to assembly code. So I would choose one of those.

Luca Matteis
+1  A: 

Hard question, not much information... by the books ASP.net compiled language will give you a small boost on performance rather than an interpreted language like old asp, php, etc.

The reason behind that is that compiled languages are quicker as they have already compiled everything versus a php page that has to be read and compiled on the fly. But PHP has also some tricks to improve speed by compiling it...

At the end the speed of ASP.NET and PHP should be the same.

So this shouldn't be your main issue. You should have to focus instead on:

  1. Having an scalable web site that allows you to have several web servers in a cluster to allow your site to handle all the users

  2. Trying not to use session variables if possible to make easier the cluster

  3. DB stuff
  4. Price (if you are going to need a cluster of 5 web servers and 3 DB Servers, 5 Linux, 5 Apaches & 5 Postgres licenses are really less expensive than 7 Windows 2003 Servers + 3 SQLServer 2008)
cad
Thank you for your insightful answer Cad i really appreciate all the info you have provided especially the price.The confusion i had was that will my php page be interpreted again and again for every user that comes?
Mohsin Sheikh Khalid
@mohsin it isn't as bad as it seems to you. In real You won't ever notice that. Database backend will be source of 90% of performance issues, so this interpretation performance will be last thing you will have to care for.
Col. Shrapnel
@Col you are probably right :)
Mohsin Sheikh Khalid
Though there are some rather heavy PHP applications, such as Magento, which will cause you to wish you could squeeze a little extra speed out of PHP. Caching pages helps, but if there were an easy way to compile PHP code, it would be even better. Though, you could always write the processing-intensive stuff in a compiled language.
Lèse majesté
Col. Shrapnel is right. In real life you won't notice that...
cad
A: 

The speed of ASP.NET, Java and PHP (with accelerator such as APC or eAccelerator) are comparable. You will not see a big performance difference between them.

There are other factors that influence performance much more than programming language, such as your data model, your database and the algorithms you use.

There are other factors to consider when choosing a programming language. ASP.NET and Java both have a good standard library, where PHP is inconsistent and not fully object oriented.

Sjoerd
A: 

Performance is sometimes a complex topic, in a way that it might involve a number of tasks whose net/mean performance will determine your application's overall performance.

For example, if you break a large task into smaller ones, then the performance of the small tasks will affect the overall performance. Small tasks running in a separate thread of execution are not possible with PHP, so you cannot GET better performance this way.

PHP without the use of external libraries, will not allow you to optimize performance. From personal experience, and after some research it was clear that PHP could not meet the requirements for a high performance application, I had to develop. In a similar case, i found people having switched to java or .net for this.

In other words, PHP has it's pros and cons when it comes to specific topics such as performance. Be sure to understand the limitations of the language and runtime (if any) you are using before making any conclusions on it's ability to provide performance optimization.

Compiled code will be faster, but for this particular case PHP extensions can leverage the performance loss.

As said before me, other ways exists on boosting performance but some involve the compilation of your PHP code. Would you trust HipHop PHP for a large scale PHP application without looking out for stability, compatibility and other issues with the LAMP stack?

andreas
Threading is usually not an issue - when you handle multiple clients, you already have multiple threads of execution, provided usually by web server itself.
el.pescado
this comment clearly shows that my point was not made. maybe a complete rewrite will do the job.
andreas