Feb 6, 2011

Why PHP is succeeding in web 2.0?

IMO, there are 3 key reasons:
  1. Apache web server
  2. Developer community
  3. Performance
It may be ironic to write this blog as a strong advocate of Java for more than a decade but the truth is that PHP is succeeding in the web, especially in the 2nd generation web computing. I accept it. I am coding PHP and have 2 PHP books. Do I like the language semantics? Well, it can be improved little bit more and doesn't match Java quality :-) But PHP got all the goodies to build a rich web app.

In a very broader context, we have 3 technology stacks:
  1. Java
  2. LAMP
  3. .NET
I am leaving out #3 as this is not very relevant in the modern web computing architecture. It's mostly for internal IT applications. I am seeing some traction for Scala(as it runs on JVM) and also the some flavors of Ruby & Python. But not going to discuss them as the focus here is about PHP.

Web 1.0

The birth of Java & commercial Web 1.0 was nearly happened at the same time and brilliant engineers of Sun Microsystems was able to make Java as the defacto standard for web with some key inventions like Servlets, JSP, JDBC, JMS and the container model for building & deploying apps. Also, not to forget the external contributions like struts framework, various Apache products, etc.

So, Java model was a super fit for the 3 tier web 1.0 architecture-
  1. Webserver - for static content
  2. Appserver - for business logic
  3. RDBMS - for data storage
Time moves on. Technology evolves. Architecture model changes. Business requirements changes. Scale became an important factor in the web 2.0 for obvious reasons like broadband, #of users, more devices, etc.

Java also evolves. I admit that it doesn't evolve as quickly in the front end web app domain compared to PHP. Java is heavily used in building the back end infrastructure and even data frameworks like Hadoop are written in Java. Java is still a major force in the web architecture and will continue to be...

Web 2.0
The question here is why PHP succeeding in Web 2.0?
In the web2.0 type architecture, there is no clear separation of web server & app server. The static content is mostly served by CDN. Then data is brought closer to the app tier using memcache for performance. So, the architecture is 2 tier: webserver + data storage.

So in this 2 tier architecture model, PHP makes perfect sense as it runs inside the Apache itself as a module. This completely eliminates the need to have a separate tier for business logic for the web app.
  1. Apache web server is a high performance engine. Also it's a modular architecture- we can add modules based on demand. So this is a natural choice for most.
  2. Then having PHP running inside Apache itself as a module helps to deploy the complete app inside the Apache and avoids yet another layer + network hop. This gives good performance.
  3. Like Java, PHP also has a great developer community. Once you have the mass, you will get lot's of support + rich libraries.
In a nutshell, supper rich PHP web app can be built & deployed on high performance Apache web server itself. Then for any back end processing, Java is a great match with REST API.

Summary
If you are starting to build a scalable web application, think PHP! If you have any scalable concerns, think whether your app is bigger than Facebook or Zynga! I love to hear it.

3 Comments:

At 2/06/2011 10:50 PM, Blogger Prakash said...

Just so that it is clear, Facebook uses an internally developed tool called "HipHop" to convert PHP into C++ code. The C++ code is then compiled to get better performance. This has allowed Facebook to get much more performance out of its web servers.

 
At 2/07/2011 8:37 AM, Blogger Uday said...

@Prakash: Thanks. I am aware of "HipHop" and make sense.

Long ago, while consulting for HP in the virtual call center product, I have to do a similar job- use a tool called "TowerJ" to convert Java byte code into native HP-UX binary for performance. But it was not successful.

In computing, what goes out yesterday will come back tomorrow!

 
At 4/08/2011 5:19 AM, Blogger e-Definers Technology - Web Design Company said...

This comment has been removed by the author.

 

Post a Comment

<< Home