Compiled code of ASP NET will perform much faster than PHP. Does that mean ASP NET need less server than PHP to perform equivalent application? Thus, ASP NET development able to save cost in hardware?
Any widely used programming language will be able to perform faster than PHP. Nobody is using PHP because it is fast.
And unless you are building something that requires tons of resources, speed is definitely not your primary issue, because even a small increase in development costs will dwarf what you'd save hardware wise.
Here is a good article outlining your concerns. I have stripped out some of the points, but the following should answer your questions.
I. Scalability and Ease of Maintenance
Scalability and ease of maintenance have nothing to do with whether you select PHP or ASP.net platform. Web Application scalability and ease of maintenance primarily depend on:
Programmers' experience
Using the best programming practices
Using a solid programming framework
Following programming guidelines and standards
II. Performance and Speed
There has been much debate about this subject and most of the debates have been biased and have been tailored to promote one of the programming languages instead of informing the audience.
However, if the programming language needs to perform enormous tasks similar to the kind that sites such as Google or Yahoo do daily, then there should be a lot of consideration in selecting a very fast programming language for required enormous tasks — that is why Google and Yahoo use several programming languages (mostly open source), each selected to handle the tasks that the programming language is best at performing.
Below, I'm going to analyze the common and uncommon scenarios and explain which task is better than the other:
1st Common Scenario:
One of the common tasks of any web application would be to access and query the database and output the result to the web server and then to the browser. So on this common scenario, all the programming language is doing is communicating / interfacing with the database server and web server. On this common scenario, the speed of the programming language has almost no affect on this process; the speed of this process relies on the database server, web server, client's web browser / computer and bandwidth.
When it comes to the main and common database servers, MySQL (now owned by Oracle), PostgreSQL, MSSQL and Oracle are all fighting for speed and performance. We keep seeing new features and better performance by all database servers in each version upgrade so I will say that the above database servers will all have a great performance if the database programmers use optimized and practical SQL queries and if needed, use the advanced features such as caching.
MySQL is used by Google, Facebook, YouTube, Yahoo and recently on FIFA World Cup which received a huge audience around the World. So I would not question the capability of the MySQL database server.
Based on my research on a few online stats, as of this writing, the communication and interfacing between PHP and MySQL is faster than ASP.net and MSSQL but it is not very noticeable.
2nd Common Scenario:
One of the other common tasks of any web application would be to access the file system, find an image and send it to the web server. In this case, again, the programming language is doing very little — it is the Operating System and the file system that has the burden of communicating with the programming language.
Based on my research on a few online stats, as of this writing, the Linux OS and ext4 (file system) performs better (IO) than Windows OS and NTFS (file system.)
3rd Common Scenario:
Most Linux / Unix servers are run very lean without any extra un-needed packages or GUI interfaces and therefore the OS uses a lot less CPU and RAM which provides more allocation to the database and web server.
Most windows servers run clunky and with many un-needed packages and GUI which will be using much more CPU and RAM.
Obviously, a LAMP platform will have an advantage over the ASP.net platform because it will have more available resources.
4th Not Very Common Scenario:
ASP.net is usually written in C# (pronounced C Sharp) — generally speaking, as of this writing, C# is a faster programming language than PHP. (This may change as each programming language will come up with upgrades to fight for a better speed.) So if the programming language needs to run a 2,000,000 loop execution of a calculation, an ASP.net written in C# will win over PHP. However, this is a very uncommon scenario, the most loop executions of a calculation would be in 100s and not 2,000,000s. And in this case, there should be other concerns about why someone needs to do a 2,000,000 loop calculation.
Additional items that can have an effect on performance but have nothing to do with which programming language is selected are:
Ability and knowledge of programmer(s) to optimize the code
Ability and knowledge of programmer(s) to write proper and optimized SQL queries.
Functionality required (some functions may take longer to execute in the ASP.net platform and less time in PHP platform and vice versa.
III. Cost:
PHP, MySQL server, PostgreSQL server, Apache server, and Linux OS are all free and upgrades are also free. In addition, there is no additional licensing cost for having another hot standby server as a backup, or needing to run multiple servers for load balancing or server clustering.
LAMP (Linux, Apache, MySQL and PHP) is also much more popular among hosting companies, and its popularity results in a lower monthly hosting cost for LAMP hosting compared to Windows hosting.
ASP.net and IIS are free if you purchase Windows OS. There is a substantial licensing cost for a Microsoft Windows Server, Microsoft SQL Server and future upgrades. For example, Microsoft Server 2008 R2 Standard - 64-bit cost is about $1029 and Microsoft SQL Server 2008 Standard Edition For Small Business cost approximately $1038.
The above licensing costs for Microsoft can substantially increase if the site becomes popular and there is a need to run the site on multiple servers or requires server features such as load balancing, server clustering or hot standby.
V. Time to Deploy
It takes a larger amount (more lines) of code to accomplish complex features and functionality with ASP.net compared to PHP, adding more time to the development process.
Additionally, PHP is interpreted at the server, so when changing a functionality, no additional steps are required to see the changes. On the other hand, ASP.net needs to be compiled each time the code is modified. Again, the development process is more time-consuming when using ASP.net as opposed to PHP.
VI. Platform Independent
PHP is platform independent and can run on any platform — Linux, Unix, Mac OS X, Windows.
ASP.net is built to run only on Windows platform.
Ageed with gintas, but it's not only about development costs. For typical web tasks language performance is not a bottleneck, it's usually database and webserver performance that are. So you should be better concerned about database, OS and http server to consume more "server". :)
As usual, the answer is "it depends".
Many web applications are not constrained by the speed of execution on the web server layer - typically they run database queries or contact some other resource to magic things onto a page. This tends to have a far more noticable impact on performance than the difference between compiled and interpreted code.
Secondly, PHP and ASP.Net both use a lot of libraries, which are compiled; the total amount of code that executes for a given web request is far larger than the application code. This tends to reduce the impact of the difference between compiled versus interpreted code.
Thirdly, I have experience using both platforms; in practice, PHP and ASP.Net sites tend to have roughly comparable performance and scalability characteristics; if anything, PHP sites are slightly faster.
Related
We are planning to develop a email marketing system. We are trying to decide if we shall use LAMP stack or MS.NET with SQL server.
I understand MS.NET is faster/easier to develop and has support from MS but in the long run it will cost more considering the licensing cost.
I guess LAMP will cost less and can also be scaled as good as MS.NET and SQL server architecture.
Can you pl provide your valuable feedback considering following criteria:
Overall development and maintainance cost
Scalability of software using PHP/MySQL and MS.NET/Sql Server
Speed of development and availablity of development tools.
...anything criteria you deem important.
Also, what do you think about hybrid approach of MS.NET and MySQL. It will give RAD (rapid application support) of .NET and reduce database licensing cost.
From my experience with web development...
You're probably looking at a slightly higher development and maintainence cost with .Net. Generally, hosting is more expensive for .Net (although there is a free version of MS SQL) as the underlying software is more expensive. Naturally, it depends what you consider expensive / too expensive at this stage in your business - but you can't beat the cost of Linux.
I believe that .Net has the potential for more efficient scalability but it's pretty much a subjective topic, as the scalability will depend on the way that the system is programmed, the quality of the code produced and many other factors. Realistically, this unlikely to be an issue until the system is very large.
Development speed will depend on what your programmers are more comfortable with. .Net has a nice set of built-in controls and some really nice commercial packages to really speed things up (Telerik controls for instance, though they are not cheap!). There are also a number of very mature frameworks for PHP that can drastically reduce development time - I personally like CodeIgniter (free). I believe the determining factor on this point really does depend on your coders and their skills / experience with the languages.
The free version of MS SQL is free up to some very reasonable limits - the sort of limits that, if you hit them, you should be making enough money that upgrading isn't a problem!
At the end of the day, you should discuss what everyone feels most confortable developing with - if you want clean / good code, you're much less likely to get that if you're also learning a new language as you go. You should also decide what your limits are for the other factors to determine if there is enough of a difference that will realistically impact on your product - for instance you could try to compare performance between the two languages forever, but they're both almost certainly fine for your needs - so don't worry too much about it!
I work in both environments. Personally I lean towards PHP. I find that development time is a lot faster because the community (Open Source) is so much bigger. I never have to recreate the wheel. MS has a very cool IDE with a lot of drag and drop functionality but to be honest those controls have limitations and again I'm personally moving more towards a jQuery solution.
Obviously, maintenance and support is a huge issue. This would depend on the project. There are experts out there that you could hire to help if you needed. Some very big sites run on PHP and mySql.
As others have mentioned above, your team might be the final answer to your question. If you only have PHP programmers then I would use PHP. If you have .Net programmers then I would lean towards .Net... If you are hiring out of the box, PHP programmers are usually cheaper (unfortunately).
Just my 2 cents.
There is a free version of SQL server, but of course there is no support for it, so maintenance is entirely on your IT staff, just as it would be with LAMP. Both are equally scalable for most people's needs. PHP has some framework options which can make it just as easy to get an initial system up and running, just as you would with .NET, but no matter which language you choose, the speed of development is all going to be based on your development team.
Its not a fair comparisson if you compared .net with ms sql vs. php with mysql.
Compare using mysql in both, if you are willing to use mysql with php, why not with .net?
That aside, pre-existing skills in the team will make a Huge difference. This applies for both the development aspect and the infrastructure aspect (managing/monitoring the servers).
In my mind, the great advantage of ASP.NET over PHP is the ability to develop code that is shared across web and non-web apps. If you have complicated business logic, that needs to be implemented on your website and on desktop apps or background services, you can put in a .NET assembly and use it any any of them.
The closest platform I can think of that offers similar capabilities is server-side Java. Php simply can't do it.
Of course, you could implement the web UI in PHP, and implement the business logic in web services implemented in .NET or Java...
I was surprised to learn today that PHP is used widely in high-traffic websites.
I always thought that PHP is not strong in terms of performance, being a dynamic, scripting language (e.g. compared to statically typed, compiled language like C/Java/C# etc.).
So how come it performs so well?
What you'll usually find is that it's not as slow as you think. The reason a lot of sites are slow is because the hosts are overloaded.
But one primary benefit of PHP over a compiled language is ease of maintenance. Because PHP is designed from the ground up for HTTP traffic, there's less to build than with most other compiled languages. Plus, merging in changes becomes easier as you don't need to recompile and restart the server (as you would with a compiled binary)...
I've done a considerable amount of benchmarks on both, and for anywhere under about 50k requests per second (based upon my numbers) there really isn't a significant gain to using a compiled binary (FastCGI). Sure, it's a little faster using compiled C, but unless you're talking Facebook level traffic, that's not really going to mean significant $$$. And it's definitely not going to offset the relatively rapid rate of development that PHP will afford in comparison to using C (which more than likely will require many times the code since it's not memory managed)...
PHP, if properly written can be quite scalable. The limiting factors are typically in your database engine. And that's going to be a common factor no matter what technology you use...
Java deployments in a big enterprise setting are a mess...fighting with builds and code that might not compile for the slightest little things. Also, PHP runs on a fairly simple setup server-wise, not the bulky code that is Weblogic (or others), so others are right in that it's low cost to develop and cheap to deploy on several different machines. It certainly didn't help that I was soured by working in a large, VERY inefficient corporate setting while doing Java....
I wouldn't say that PHP developers are cheaper per se (I make more now as a PHP developer than I did as a Java UI developer) but I do know that my last employer paid me for a not-insignificant amount of time spent configuring, deploying, compiling, etc that is not required in PHP. We're talking probably one day/week of related configuration fussing due to new branch roll outs or release-related configurations. So, the extra I'm paid now is made up for by a significant amount more code that I'm able to work through each week.
PHP is certainly being helped by the fact that MySQL and Postgres (to a smaller extent) have become so much more powerful. They're not directly linked, but having that as a common pairing just sweetens the deal for those making decisions.
It doesn't really perform "so well", just well enough to be used. Keep in mind, though, that Java and C#.NET are also run as bytecode inside a VM. PHP, with tools such as Zend Optimizer, can also skip the compilation step and run as bytecode.
PHP will not run as fast as native, compiled C code, but websites such as Facebook compile PHP to C++ to make it run faster (see HipHop-PHP).
Most websites have performance bottle necks when querying a database etc. The amount of time the script spends executing is usually small compared to this. Using things like libmemcached can help mitigate this.
Many sites started as low-traffic sites. Once you have your PHP website running and suddenly you have to handle much higher traffic, it's cheaper just to buy more servers than to rewrite your app from PHP to something else. Moreover there are tools that improve PHP performance.
Also note, that there are other factors: database, caching strategy which affect performance more than PHP itself.
It doesn't, which is why there are projects like HipHop, but dynamic languages are often faster to develop in, and hardware is cheaper than developers.
In my opinion the stateless nature of PHP is the most important factor to it's scalability. It's been a while since I've done any web work with Java/ASP.NET, but I recall that both technologies have a central application "engine" that all requests are piped through. That's great, because information and state can be shared between instances, and a lot of bootstrapping (reading configuration files, connecting to databases, etc) can be done once, and then shared among instances. It's bad though because that central "engine" itself becomes a bottleneck for the whole application.
The lack of a central engine in PHP also means scaling your application is usually a simple matter of adding another web server to your rig (although scaling the database along with it is more complicated). I imagine scaling a Java/ASP.NET application is a good deal more complicated, and they reach a saturation point where adding more hardware gives less of a boost each time.
I have an idea for a website which i would like to run with. My background has always been in the microsoft products, originally coming up from a VB6/ASP to C# and ASP.Net webforms. I love the new asp.net MVC architecture but am worried if my site takes off and i have to scale it, i will be stuck with exhorbitant hosting fees.
Im considering using ASP.NET MVC with mono but am wondering whether i shouldnt just bite the bullet and switch to php with a framework like Zend. I would rather stick with asp.net MVC using mono and running on a linux box, but all the Garbage Collection issues with Mono worry me. My question is has anyone used it and scaled it for web developent or should i throw in the towel and join the LAMP ranks? Any serious suggestions without the fanboy comments on either side of the fence would be much appreciated.
Not sure where people get the idea that windows hosting is hideously expensive. Especially once you get to the point where you need dedicated facilities, at which point the expenses of the bandwidth, power and monitoring take care of any licensing fees you'd need to worry about.
Stick with technology that suits you the best, in which you are most productive. Don't switch just because of possible issues some day, LAMP for sure has it's own problems.
If your web site has so much visitors that you must scale to one or several dedicated servers, then you should have money for licenses, IMHO. Shared hosting on win is aslo cheap, and with speed of win server 2008+mvc, you can be several times faster than LAMP, so hw costs are lower.
If you're worried about costs, Microsoft has a program to help startups - the BizSpark program gives you an MSDN subscription as well as production licenses for Windows Server and SQL Server. And if your site really takes off you'll need a dedicated box or a VPS. If you are renting a box (not colo) hosting on Windows is only slightly more expensive than Linux - and some on some providers Windows is not more expensive at all.
With that said, I do .net during the day and build my side projects on Rails.
I have a friendly argument going on with a co-worker about this, and my personal opinion is that a ASP.NET-MVC compiled web application would run more efficiently/faster than the same project that would be written in PHP. My friend disagrees.
Unfortunately I do not have any solid data that I can use to back up my argument. (neither does he)
To this, I tried to Google for answers to try and find evidence to prove him wrong but most of the time the debate turned into which platform it is better to develop on, cost, security features, etc... For the sake of this argument I really don't care about any of that.
I would like to know what stack overflow community thinks about the raw speed/efficency of websites in general that are developed in ASP.NET with MVC versus exactly the same website developed with PHP?
Does anyone have any practical examples in real-world scenarios comparing the performance of the two technologies?
(I realize for some of you this may very well be an irrelevant and maybe stupid argument, but it is an argument, and I would still like to hear the answers of the fine people here at S.O.)
It's a hard comparison to make because differences in the respective stacks mean you end up doing the same thing differently and if you do them the same for the purpose of comparison it's not a very realistic test.
PHP, which I like, is in its most basic form loaded with every request, interpreted and then discarded. It is very much like CGI in this respect (which is no surprise considering it is roughly 15 years old).
Now over the years various optimisations have been made to improve the performance, most notably opcode caching with APC, for example (so much so that APC will be a standard part of PHP 6 and not an optional module like it is now).
But still PHP scripts are basically transient. Session information is (normally) file based and mutually exclusive (session_start() blocks other scripts accessing the same user session until session_commit() or the script finishes) whereas that's not the case in ASP.NET. Aside from session data, it's fairly easy (and normal) to have objects that live within the application context in ASP.NET (or Java for that matter, which ASP.NET is much more similar to).
This is a key difference. For example, database access in PHP (using mysql, mysqli, PDO, etc) is transient (persistent connections notwithstanding) whereas .Net/Java will nearly always use persistent connection pools and build on top of this to create ORM frameworks and the like, the caches for which are beyond any particular request.
As a bytecode interpreted platform, ASP.NET is theoretically faster but the limits to what PHP can do are so high as to be irrelevant for most people. 4 of the top 20 visited sites on the internet are PHP for example. Speed of development, robustness, cost of running the environment, etc... tend to be far more important when you start to scale than any theoretical speed difference.
Bear in mind that .Net has primitive types, type safety and these sorts of things that will make code faster than PHP can run it. If you want to do a somewhat unfair test, sort an array of one million random 64 bit integers in both platforms. ASP.NET will kill it because they are primitive types and simple arrays will be more efficient than PHP's associative arrays (and all arrays in PHP are associative ultimately). Plus PHP on a 32 bit OS won't have a native 64 bit integer so will suffer hugely for that.
It should also be pointed out that ASP.NET is pre-compiled whereas PHP is interpreted on-the-fly (excluding opcode caching), which can make a difference but the flexibility of PHP in this regard is a good thing. Being able to deploy a script without bouncing your server is great. Just drop it in and it works. Brilliant. But it is less performant ultimately.
Ultimately though I think you're arguing what's really an irrelevant detail.
ASP.NET runs faster. ASP.NET Development is faster.
Buy fast computer, and enjoy it if you do serious business web applications
ASP.NET code executes a lot faster compared to PHP, when it's builded in Release mode, optimized, cached etc etc. But, for websites (except big players, like Facebook), it's less important - the most time of page rendering time is accessing and querying database.
In connecting database ASP.NET is a lot better - in asp.net we typically use LINQ which translates our object queries into stored procedures in SQL server database. Also connection to database is persistent, one for one website, there is no need for reconnecting.
PHP, in comparison, can't hold sql server connection between request, it connect, grab data from db and destroys, when reconnecting the database is often 20-30% of page rendering time.
Also whole web application config is reloaded in php on each request, where in asp.net it persist in memory. It can be easily seen in big, enterprise frameworks like symfony/symfony2, a lot of rendering time is symfony internal processess, where asp.net loads it's once and don't waste your server for useless work.
ASP.NET can holds object in cache in application memory - in php you have to write it to files, or use hack like memcache. using memcache is a lot of working with concurrency and hazard problems (storing cache in files also have it's own problems with concurrency - every request start new thread of apache server and many request can work on one time - you have to think about concurrency between those threads, it take a lot of development time and not always work because php don't have any mutex mechanisms in language, so you can't make critical section by any way).
now something about development speed:
ASP.NET have two main frameworks designed for it (Webforms and MVC), installed with environment, where in PHP you must get a open-source framework. There is no standard framework in php like in asp.NET.
ASP.NET language is so rich, standard library has solutions for very much common problems, where PHP standard library is ... naked... they can't keep one naming convention.
.NET has types, where PHP is dynamic, so it means no control about source code until you run it or write unit tests.
.NET has great IDE where PHP IDE's are average or average-good (PHPStorm is still a lot worse than VS+resharper or even without it)
PHP scaffolding in symfony is fired from command line when ASP.NET scaffolding is integrated into environment.
If you have slow computer like my (one core 2,2ghz), developing asp.net pages can be painfull because you have to recompile your project on any change of source code, where PHP code refresh immediately.
PHP language syntax is so unfinished, unsolid and naked compared to C# syntax.
Strong types in C# and many flexible language features can speed up your development and make your code less buggy.
In my (non-hardbenchmarked) experience Asp.Net can certainly compete (and in some areas surpass) PHP in terms of raw speed. But similar with a lot of other language-choice related questions the following statement is (in this case) valid (in my opinion):
There are slow, buggy sites in language x (be it PHP or Asp.Net)
There are great, fast sites in language x (be it PHP or Asp.Net)
What i'm trying to say: the (talents of the) developer will influence the overall speed more than a choice between two (roughly equivalent in some abstracted extent) technologies.
Really, an 'overall speed' comparison does not make a lot of sense as both can catch up to each other in some way or another unless you're in a very specific specialist niche (which you have not informed us about).
I have done performance test.
Program : Sum of 10000000 Numbers
Given output proves that php is slower than C#............
I'd say ASP.net
Things to consider:
ASP.net is pre-compiled
ASP.net is usually written in C#, which should execute faster than PHP
Granted, the differences are very minor. There's advantages to both, I think PHP is much easier to deploy and can run on any server not just IIS. I am quite fond of ASP.net MVC though.
I am a developer expert on both technologies (ASP.Net c# and PHP5).
After years and years of working and comparing them in real production environments these are my impressions:
First of all, cant compare them making a loop of adding values 1.000.000, this is not a real case.
Is not the same comparing them in my development environment than a real production env. Eg: In development ASP.Net does not use IIS by default, use a Inner Development server which has different optimizations. In dev, there is no concurrency.
So my opinion is the next:
Looping 1.000.000 times c# is going to be faster.(no-sense)
Serving a real page, that access DB, shows images, has forms etc....
ASP.Net is slower than PHP.
Weight of ASPX pages is x10 heavier than PHP, so this makes the final user to be waiting more time to get the page.
ASPX is slower to develop than PHP, this is important because at the end is money. We develop a 35% faster in PHP than ASP.Net, because of having to compile and restart every time u want to check smthg.
In big projects, ASP.Net in long term is better for avoiding errors and have a complex architechture.
Because of Windows Servers, IIS, .... at the end u need a powerfull server to hold the same amount of users on ASP than PHP. Eg: We serve with ASP.net arround 20.000 concurrent users and in PHP, the same server can get arround 30.000 users.
The only important thing is not if looping which one is faster. The thing is when website is real and is in production, how many users they can hold, how heavy is the page (heavier== more waiting time from users, more net charge of server, more disk charge of server, more memory charge of server).
Try the checking times with concurrency and u will see.
Hope it helps.
Without any optimizations, a .net compiled app would of course run "faster" than php. But you are correct that it's a stupid and irrelevant argument because it has no bearing on the real world beyond bragging rights.
Generally ASP.Net will perform better on a given hardware than PHP. ASP.Net MVC can do better still (can being the operative word here). Most of the platform is designed with enterprise development in mind. Testable code, separation of concerns etc. A lot of the bloat in ASP.Net comes from the object stack within the page (nested controls). Pre-compiling makes this better performant, but it can be a key issue. MVC tends to allow for less nesting, using the webforms based view engine (others are available).
Where the biggest slowdowns in web applications happen tends to be remote services, especially database persistence. PHP is programmed without the benefit of connection pooling, or in-memory session state. This can be overcome with memcached and other, more performant service layers (also available to .Net).
It really comes down to the specifics of a site/application. this site happens to run MVC on fairly modest hardware quite well. A similar site under PHP would likely fall under its own weight. Other things to consider. IIS vs. Apache vs LightHTTPD etc. Honestly the php vs asp.net is much more than raw performance differences. PHP doesnt lend itself well to large, complex applications nearly so much as asp.net mvc, it's that simple... This itself has more to do with VS+SCC than anything else.
I'd tend to agree with you (that ASP.NET MVC is faster), but why not make a friendly wager with your friend and share the results? Create a really simple DYNAMIC page, derived from a MySQL database, and load the page many times.
For example, create a table with 1,000,000 rows containing a sequential primary key, and then a random # in the second column. Each of your sites can accept the primary key in a GET, retrieve the random # based on the passed in key, and display the random # in some type of dynamically generated html.
I'd love to know the results ... and if you have a blog or similar, the rest of the world would too (this question gets asked ALL the time).
It would be even better if you could build this simple little app in regular ASP too. Heck, I'd even pay you for these results if the test was well designed. Seriously - just express your interest here and I'll send you my e-mail.
Need to note that question is .NET MVC vs PHP, not .NET (Web Forms) vs PHP.
I don't have the facts, but general feeling is PHP websites run faster than .NET Web form sites (and I do .NET only). .NET web forms despite being compiled vs interpreted PHP is generally slow because all the chunk of code that is autogenerated by the .NET engine to render the HTML for each < asp:control > you use on design mode. Getting a .NET web form to compete in speed with PHP is a complete odisea that starts with setting EnableViewState = false, and can end on using every html control with runat=server... crazy uh?
Now, MVC is a different story, I had made two websites using .NET MVC2 and feeling is good, you can feel the speed now! and code is as clean as any PHP website. So, now, MVC allows you write clean code as PHP does, and MVC is compiled against PHP interpreted, it can only lead to one thing, MVC faster than PHP... time will prove, when the general sense is "MVC websites runs faster than PHP" then we will be right about what I say here today.
see/you/!
C++... Right now the fight will be between PHP and ASP.NET. PHP will win on ease of use, ASP.NET will win on performance ( in a windows server ecosystem). A lot of the larger websites that started with php have graduated to C++.
Is the LAMP (Linux, Apache, MySQL, PHP / Ruby / Python) stack appropriate for Enterprise use?
To be clear, by "Enterprise", I mean a large or very large company, where security, robustness, availability of skill sets, Total Cost of Ownership (TCO), scalability, and availability of tools are key considerations. Said another way, a company that looks for external adoption of frameworks / architecture - Something ubiquitous will be seen as more "valid" than something exotic / esoteric in this kind of environment.
I've seen use cases where Oracle, IBM, and Sun have implemented systems on the LAMP stack for various Enterprises. I've also seen examples where websites like yellowpages.com (Ruby on rails) and Facebook (php) are built on it. However, none of these examples are exactly what I'm looking for.
I'm really trying to find examples where it is an Enterprise standard at a very large bank (I.e., Citigroup), Telecom company (I.e., AT&T), or manufacturer (I.e., Proctor and Gamble). Just to be clear, I'm not looking for an example where it's used in a limited sense (Like at JPMorgan Chase), but where it's a core platform for systems like CRM, manufacturing systems, or HR management, as well as for internal and external websites.
The perception I've seen so far is that applications built on the LAMP stack perform slower and are less flexible. Some of the arguments I've heard are:
Linux is seen as not as well supported as Unix, Solaris, or Windows Servers.
Apache is harder to configure and maintain than web servers like BEA WebLogic or IIS.
MySQL is a "not ready for prime time" DB for hobbyists, and not a competitor for SQL Server or Oracle (Although PostgreSQL seems to have a reputation for being more robust).
PHP / Ruby on rails are optimized for CRUD (Create, Read, Update and Delete operations). Although this is an advantage when building CRUD-intensive web aplications, both perform slower than Java/Java EE or C# (which are both common Enterprise standards). Furthermore, a lot of applications and systems (like manufacturing systems) have a lot of non-CRUD functionality that may be harder to build with PHP or Ruby, or even Python.
Can anyone please provide arguments to support or refute the idea of the LAMP stack being appropriate for the Enterprise?
Thanks!
KA
UPDATE: Some times the LAMP Stack is Appropriate for Enterprise Use: Externally-Facing Blogs
"but where it's a core platform for systems like CRM and HR, as well as for internal and external websites"
First, find a LAMP CRM or HR application.
Then find a customer for the LAMP CRM or HR application.
Sadly, there aren't a lot of examples of item 1. Therefore, your case is proven. It can't be used for enterprise applications because -- currently -- there aren't any of the applications you call "enterprise".
Your other points, however, are very interesting.
Linux is seen as not as well supported as Unix, Solaris, or Windows Servers. I think Red Hat would object strongly to this. Give them a call. I think they'll make a very persuasive sales pitch. Read their success stories.
Apache is harder to configure and maintain than web servers like BEA WebLogic or IIS. By whom? Apache web site managers? Or IIS web site managers? This is entirely subjective.
MySQL is a "not ready for prime time" DB. Take it up with Sun Microsystems. I think they'd object strongly to this. Give them a call. I think they'll make a very persuasive sales pitch. Read their success stories.
PHP / Ruby on rails are optimized for CRUD, and both are slowly performing. Could be true. Java and Python might be faster. PHP and Ruby aren't the last word in LAMP.
Something ubiquitous will be seen as more "valid" than something exotic / esoteric in this kind of environment.
Although I personally wouldn't recommend PHP due to the many flaws in the language, it's most certainly ubiquitous. With the advent of phusion passenger, Rails support amongst shared-hosting companies is growing pretty quickly too. I give it another year or 2 at most before 90+% of shared-hosting accounts support rails out of the box. If that's not ubiquitous, what is?
Linux is seen as not as well supported as Unix, Solaris, or Windows Servers.
If this bothers you, purchase support from RedHat, or install Solaris and purchase support from Sun. Both of those will give you just as good support as Microsoft is likely to
Apache is harder to configure and maintain than web servers like BEA WebLogic or IIS.
I can't speak for BEA WebLogic, but having configured both Apache, IIS, and Tomcat, Apache is the easiest both to understand, and to find examples and documentation for by a long way.
MySQL is a "not ready for prime time" DB for hobbyists, and not a competitor for SQL Server or Oracle.
Oh really?. You should make it your mission to tell NASA, Google, CERN, Reuters etc that they're all using a hobbyist database that isn't ready for prime-time.
PHP / Ruby on rails are optimized for CRUD, and both perform slower than Java/Java EE or C# (which are both common Enterprise standards).
There are 2 things here:
Optimized for CRUD - This is totally irrelevant.
Rails and some of the python/php frameworks are optimized for CRUD apps. Many of the C#/Java frameworks are also optimized for CRUD apps. However, if the app you're building is a CRUD app (and 99% of web applications are), isn't this a Good Thing?
If you're not building a CRUD app, there are plenty of non-crud-optimized frameworks in ruby/python/php/java/C#. Net win: Nobody (hence it's irrelevant)
Perform slower than Java/C# - This is undoubtedly true, but it also doesn't matter. For a low-traffic site the performance difference isn't going to amount to anything, and for a high-traffic site your bottleneck will be the database, whether it be MySQL, oracle, or whatever.
What you trade-off for all of this is development time.
Once you've used all this advice to convince your boss that you won't lose out on anything by using LAMP, If you crunch the numbers and show your them that it is going to take 6 man-months to build the site in Java, and only 3 to build it in ruby/python then that's really what it comes down to.
If you hire idiots to implement it, C++ & Oracle will fail to scale.
If you hire people who are smart and get things done, PHP & MySQL will scale just fine.
Same argument goes for security & robustness.
Facebook, Digg, portions of Yahoo run on PHP.
Of course, they hire lots of PhD programmers.
Just thought I'd add another website to the list of those that run on LAMP - Wikipedia. Seventh biggest website in the world, written entirely in PHP and runs off MySQL, and they only have two or three paid developers. Of course, they have some assistance from volunteers, but it's not a lot, and it's scaled just fine. Don't know if you'd really call them 'enterprise', but for such a huge and popular website they seem to have done alright for themselves.
Linux is seen as not as well supported
as Unix, Solaris, or Windows Servers.
As others have said above, give Red Hat a call and I'm sure they'll beg to differ. And the amount of support out there for Linux absolutely free is astonishing.
Apache is harder to configure and
maintain than web servers like BEA
WebLogic or IIS.
That depends who you're asking. People who usually administer IIS servers will probably view it this way. People who usually administer Apache won't. It depends on who you hire, and if your stack is LAMP you won't want to be hiring people with no Apache experience anyway.
I just want to add that I've witnessed many times that clients only feel comfortable once they dish out serious $$$ for some solution, even if it makes enterprise integration even harder, despite what arguments you bring to the table.
I think the first criteria should be your team's skill level, comfort level jut to make sure what ever platform decisions are made works well with them. Whatever you decide think of scalability and maintainability of your code. Tools are awesome no matter what stack you choose.
I personally would break it down into 3 stacks-
The Java Stack where you have Solaris or Enterprise Linux like ( RedHat ) with Weblogic/Websphere/Tomcat etc and Java Enterprise along with Hibernate,Spring etc technologies. Most would opt for Oracle as DB.
The Microsoft Stack with some Open Source if needed Win Server - IIS - .net/C# (ASP.net etc) - NHibernate, NUnit (unit testing) etc. Most likely you would want to use SQL Server as DB
None of the above stack with Enterprise Linux running a whole buffet of open source stuff like MySQL (now under Sun's domain so can be looked at seriously), Apache (there are apache gurus out there), Ruby ( not my personal choice)/ PHP (good luck) / Python (I like it because its a mature language). I would advocate python or ruby from the managing code point of view. Maybe for some it could be PHP..i am not into it.
strictly a subjective opinion but I personally find MySQL and to a lesser extent PHP to be a bit of a weakness, but certainly there's plenty of people who disagree and big companies who went LAMP.
I'd prefer to see postgres or even SQLite take chunks out of the MySQL market, and I'd like to see mono or jsp or cocoon based apps more. I guess LAMP is a bit too specific for an umbrella term. :)
Linux/Apache are hardened, lean and each comes with plenty of people(for the right price of course) who will provide support, plenty of useful tools, many at exceptionally high levels of utility which work with them and which have been built upon them.
Not sure about the other two, however. In particular MySQL seems to have taken a strange turn for the worse since their being acquired by Sun, contrary to the posts in this thread suggesting that Sun may be a good influence:
http://www.reddit.com/r/programming/comments/7gb8j/oops_we_did_it_again_mysql_51_released_as_ga_with/
The reason for not finding Enterprise applications built on LAMP is not because they aren't enterprise level but something entirely different in my opinion. A lot of the big players use LAMP or similar--Facebook and MySpace immediately come to mind. So its clearly not an issue of scale and perf.
That said, the reason I find that there aren't any enterprise apps built on LAMP is because of their intrinsic open nature. I don't want to build an actuarial module as a PHP file because anyone can steal the logic. On the other hand if I have a DLL I can retain control. You don't find a lot of 30-trial apps built on PHP for this very reason but it's much easier to achieve that kind of protection with say ASP.NET.
You have some real bad myths in your posting:
JavaEE Myths:
-App Servers easier to configure than apache, nope apache is easier.
-You imply that only JavaEE full solution is enterprise, nope.
CRUD Myths:
-CRUD is slower than JavaEE? WTF? POJO and EJB is using CRUD.
The limiting factor is not crud, its server throughput
There are 3 limiting bottleneck areas no matter what technology even MS..server implementation, persistence layer, and app layer..the technology chosen is not the speed factor as you can exchange advantages in one layer for disadvantages in the other layer.
Fro example we could spee dup Java by using document store instead of normal DB..
Most new Rails implementations use non apache servers that are faster by a factor of 3 to 5 than Apache..even a well tunned Apache server can outperform some javaEE stacks..just ask yahoo as they use Symfony on some of their properties..
I think you will find that many enterprises use Linux servers, often supported by Redhat, Novell or IBM, and that Apache is also commonly used.
But many enterprises tend to use databases like Oracle or IBM DB2 instead of open source offerings - although there are many enterprises that don't really need the kind of power those systems provide and could get away with MySQL or PostgreSQL.
And for the web-server language, I think you can use just about anything. However, if you use Apache it is probably easier to use PHP, Ruby or Python, whereas if you use IIS or Weblogic or Domino it will be easier to do it in Java / C#.
IMO there are no good general arguments against Linux and Apache; You can certainly get enterprise-level support for Linux if you're prepared to pay for it (and a good approximation of it for free if you're willing to play by the community's rules). And Apache is not that hard to configure unless you need its more complex features, which is unlikely in an application server.
You can certainly make a case against MySQL since some of the most important features in regard to data safety have been added only recently. If you're concerned about that, use PostgreSQL instead.
As for the language you write your app in: PHP has definitely proven to be able to run extremely large and complex systems; I'd be more concerned about maintainability than performance. And Ruby on Rails is "optimized for CRUD" only in asmuch as a simple CRUD webapp can be written in nearly no time (literally minutes), but that does not mean it is somehow less suited to more complex apps, just that it will take much more time (still less than with many other languages)
I suppose that large commercial CRM and HR applications might be biased toward delivering large commercial RDBMS products as the foundation for their products. If nothing else they will I'm sure prefer to unite against a common threat.
And they have a harder time justifying license and support fees if they integrate products that don't have them.
My 2c:
Linux: Since kernel 2.6 came out, I would say it is definitelly a high-quality OS. Version 2.4 wasn't quite there and 2.2 was a joke, but 2.6 is really good. Be careful with a choice of distribution, though. In my experience, RedHat/CentOS is very good, and apparently Debian (original, not Ubuntu!) can be set up nicely if you have a good admin. My experience with OpenSUSE was not very good.
Apache: Haven't used it, but I don't see why it would be a problem.
MySQL: This is the weakest point of the stack. I am not going to go into details here - look into comments at reddit.programming if you are interested. Better look at PostgreSQL.
PHP/Perl/Ruby/Python: I have worked with Perl and to a lesser extent with Python. They are probably OK for web-based applications where the bulk of the work is done by the web server and DBMS anyway. However, I do prefer static type system and would rather pick Java/C# for a business application and C++ for system programming.
I would like to suggest that we identify the scalability requirements of Enterprise systems and how they differ compared to Web Applications. Look at some of the most scalable systems like Wikipedia, Flickr, Wordpress, Facebook, MySpace and a host of others. You will see LAMP stack there. I am more of a Python fan (since I feel that the language has a cleaner feel) but I listen to experts like Cal Henderson (Flickr) who wrote a book on scalability talking about how he scaled a bank of MySQL servers.
What are the essential features of an enterprise system?
Support, availability of expertise, stability of the platform/language probably count.
But LAMP has other features like faster development, easier extensibility, lots of available libraries for reuse, several documented stories of scalability, maturing web frameworks.
Here are a couple of pointers to building Scalable systems (I am talking about Web Scale). I always wondered in the light of all this evidence, why the perception of LAMP as not being ready for Enterprise apps keep popping up.
As for Apache, every Netcraft study shows a very different adoption story. By the sheer number of servers, there may be more people with knowledge to configure, tune and extend the web server.
Scalable Web Architectures
Please Look at Market Share of all Servers Aug 1995 to Jan 2009
Linux is used a lot.
Apache and Tomcat are used a lot.
MySQL may be robust now. I'd use PostgreSQL instead. Banks will use Oracle, but there's good support for Java and Tomcat there.
PHP is used a lot, but many big companies would prefer Java.
You're best off arguing for a Linux, (possibly commercially supported version of) Tomcat, Java, Tomcat|Oracle|MSSQL solution, in my opinion.
You'll need a Linux sysadmin, especially as the number of servers ramps up, although I'm sure you can get a part time one in before that time arises. If the company already has Windows sysadmins then arguing for Linux is going to be tough.
I believe it's not that the technology is premature or something which keeps biggies like AT&T to go ahead with a full implementation at enterprise level. These companies have such a big budget for IT spends that the last thing they would have on mind is to spend more on the customization and enhancement required on the open source techs to suit their business needs.
So what they look for (which comes from my consulting experience) is buy and run product pack and don't have to spend more on the research and hack part. Companies which use open source build have developed their own support groups globally to cater to any support demands, which large enterprises are not much willing to do. They need thing done fast and for sure and they can pay.
There are two main issues for large enterprises using LAMP stacks:
TCO: taking into consideration that LAMP basically comes free, enterprises still achieve a lower total cost of operation with other commercial solutions
Supportability: enterprises have no problem paying the extra buck to get around-the-clock professional support from their commercial vendors
Redhat and IBM give full support for Linux, Sun bought MySQL, Yahoo uses Php, numerous companies use a LAMP stack, but many use parts.
I personally don't see Linux as being less well supported than the other OS mentioned; in fact hardware vendors typically DO support Linux over any other OS (except for Windows, which they do generally support quite well provided you use maintream distributions).
Provided you don't use a bizarre flavour (Tip: Just use RHEL or Centos which is its free equivalent), Linux is very well supported.
MySQL may have some shortcomings, but in my opinion it has many strengths; we use it at a large scale in ways not intended, but it still works quite well generally (most of the problems are due to our versions being out of date or badly configured).
What "P" stands for in LAMP is debatable. I feel that PHP is not enterprise-ready, because it has so many individual shortcomings (e.g. poor unicode handling, no namespaces, inconsistent APIs, inconsistent syntax, poor version backwards compatibility, duplicated/obsolete functionality) that they add up to making it difficult to implement a maintainable system.
But given an appropriately experienced team, even if you choose PHP it can be used to make an extremely high quality application.
If it's good enough for Google, trust me, it's good enough for you.