ASP.NET MVC vs PHP YII. Performance comparison

Эта страничка доступна на русском языке - ASP.NET MVC или PHP YII. Сравнение производительности

I am a member of freelance team AdvanceDev. There are a lot of customers asking us to develope a website or a crm using php. They tell lots of fake reasons why php is better than mvc and tell nonsence to prove their point of view.

In this article I would like to destroy most common myths about By saying I mean mvc unless specified else. Old web-forms and mvc are two different technologies, it's like an apple and a pear, you cannot mix them up.

I am not trying to say that php is bad, my goal is to prove that mvc is not worse than php.

Okay, the most common "reasons" why customers do not want mvc in their projects

  1. is outdated, but php is a tech of tomorrow
  2. There are lots of php developers, which may rescue your project if something goes wrong. In the same time there are too few developers.
  3. Website developed in requires an expensive server and won't work if published to a shared host.
  4. websites work slower than php and getting even slower with large amount of users. is outdated, but php is a tech of tomorrow

This is a nonsense. PHP was developed back in 1994 and meant to be used in small websites. PHP - Personal Home Page, the name describes itself. Since that time php has grown up, a lot and the latest php 5.6 was released in Summer of 2014.

ASP.NET MVC was developed in 2007 and released to public use in 2009. Latest version mvc 5 was released in Summer of 2014.

In conclusion of these I may say that mvc is much newer technology, but both of them have great support by their teams.

There are lots of php developers, which may rescue your project if something goes wrong. In the same time there are too few developers

First of all we have to decide what means "developer". If and php show up in a picture then it would look like this: vs php It is obvious, that there are much more lumbermen which may use hacksaw that those which may operate gasoline-powered saw. If someone knows how to use the hacksaw that doesn't mean he may use gasoline-powered saw.

Basic knowledge of php is much more simple compare to, that is why everyone who knows php a little bit calling themself "php developer", but when it goes to the real big projects those "developers" fail terms and disappear.

There are many customers which ask us to "finish a php website, because their developer can't make such functionality" or "rework a php website, because it is very buggy and works very slow, but his creator got payment and disappeared". I could not remember any customer turning to us because of such problems with websites.

I think there are about the same number of good php and developers. It is very often when skilled developers may use both of the technologies.

Any developer, which has some big php and projects behind would tell you that php lacks a lot of useful features which make developer's life much more easy.

Website developed in requires an expensive server and won't work if published to a shared host

Another myth. Price for php and are about the same. Look here for an example:, for $7.95 a month you get everything you may need for an website.

You will need a dedicated server for big project and it does not matter which technology you use php or

It is preferably to use Linux operating system for php websites, it is free, but if you need you may port a php website on Windows server very easily.

Windows is native and best operating system for, however may work under Linux with some limitations.

To use Windows you have to pay for the license.

Monthly about 25 euro:

Buy lifetime license:

  • Windows 2008 R2 - from $250
  • Windows 2012 R2 - from $500

As I mentioned before, php lacks lots of features which has, that is why developing the same site using php requires more time, means more money. From our experience I could tell that price for a project developed in php would be 1.5-2 times more expensive than the same project developed in

Simple calculation:

ASP.NET MVC + Windows + MS-Sql Server

  • Website development - $2000
  • Operating system - $500
  • MS-Sql Server - free edition
  • Total $2500

PHP YII + Linux + MySql Server

  • Website development - $3000
  • Operating system - $0
  • MySql Server - free edition
  • Total $3000

As you may see the php variant is more expensive even if include Windows license price. If you are not satisfied with free edition of MS-Sql server, you always may choose MySql. MySql works great under windows and on pair with

If you are considering not only money, but also development time and website speed then has even more advantages over php. websites work slower than php and getting even slower with large amount of users

It might be the biggest reason why customers are "afraid" of Outdated web-forms is really slow, it consumes a lot of resources and it is very easy to mix everything up in the project. However mvc is not web-forms, you cannot mix them up! It is very common when php developers do not have any experience in and do now know what is mvc, but still claim that mvc is outdated and lose to php in every aspect.

I have made some real testing of php and performance, both php and were running at Linux and Windwos. A simple website was made for the benchmarks. The website is something like a small internet-shop, it contains set of products, set of customers, set of orders and set of order items. There are four testing scenarios.

In the all pictures:

  • left side – time in seconds
  • bottom side – number of users

I have shortened some names to minimize number of text in the diagrams.

  • win – windows
  • – mvc
  • ms-sql – ms-sql server
  • mysql – mysql server

1. Import from a text file

There is a text file which contains set of customers. The website reads data from the file, sort by alphabet, founds number of vowel letters in customer's name and displays the result to the user. mvc vs php benchmark result

As you may see from the result under windows insignificantly loses to php under linux with small number of users and goes ahead with large amount of users.

Php under windows and under linux shows very bad results here.

2. Export into excel file from data base

The website needs to select all customers from the database, sort them alphabetically, save to excel document and return download link to the user. mvc vs php benchmark result

In all cases mvc under windows + ms-sql server requires twice less time compare to php under linux + mysql. mvc + mysql shows almost the same result, under linux + mysql a little faster than php. Combination of php under windows and mysql again straggle behind.

3. Select and display products from database

Search for products by category and part of name. Display the result in an html table. mvc vs php benchmark result again leads over php in any combination. I have to note, that mysql caches query result by default, that is why mysql is faster than ms-sql in this test. If manually enable caching for ms-sql we will get about the same results.

4. Place an order

Select a random customer. Create a new order. Pick ten random products. Save order data and display information about the customer and his order to the user. mvc vs php benchmark result

In the latest test combination of mvc under windows + ms-sql shows significantly better result. Php under linux + mysql needs almost twice more time. + mysql under windwos and linux also shows good results. Php under windows is far behind as alway.

Average performance by four tests mvc vs php benchmark result

It is not difficult to notice that + ms-sql outperform php + mysql in any scenario, the more users, the greater the gap. + mysql under windows shows almost the same result as php + mysql, but still a little faster, + mysql under linux a little slower compare to windows,
and php under windows works very slow, I didn't even mention it in the final diagram.

All of the tests were performed on the same hardware. No other applications were running. Every test was performed four times and then took the average result.

Software configuration:

  • ASP.NET MVC 4, .NET 4.5
  • PHP 5.6 YII2
  • Windows 8, IIS8, MS-SQL Server 2012 Express, MySql 5.5
  • Ubuntu 14.10, Apache2, MySql 5.5
  • Ubuntu 14.10, Nginx + fastcgi-mono-server4, MySql 5.5

Hardware specification:

  • CPU: AMD Phenom II 965 x4
  • RAM: 4gb RAM
  • HDD: WD 1T

And in conclusion I want to give some examples of successfully running mvc websites.

  1. - forum for developer and more. About a million users a day.
  2. - a CRM for inventory management, very popular in USA and Australia.
  3. - website about
  4. - popular mail server and more.
  5. - service for online document generation.

Here you may read some statistics about mvc

And here about php

Written by on
Views: 28440 Comments: 4
SunnyRitter on 22 September 2015 08:34 says

Good day!

If we continue research in this area, a lot of people will thank you. By the fact that tired of making two choices and then to hear from customers who saw the difference in performance:"... amazing, and we are told that PHP is faster".

Matt Watson on 30 November 2015 06:09 says

If you are looking to do some performance tuning, there are a lot of different tools to help you find and optimize ASP.NET performance. I made a great list of 9 different types of tools. Check it out and see if any of these can help:

Elisa Gracedd on 15 December 2015 13:26 says

ASP.NET code executes lots faster as compared to PHP, when it's build in release mode, optimized, cached etc etc. But for websites 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 higher - in we usually use LINQ that 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. On other side, PHP is Faster for small programs and slower for medium-to-big programs.

Get more info here and here

Const on 15 December 2015 15:44 says

Elisa Gracedd, thank you for the input.

It's sad to say, but..
Due to the enormous amount of spam I have decided to disable comments on my website. Feel free to contact me through any other available channel.