10 big comparisons between PHP and ASP!

Source: Internet
Author: User
Tags php and mysql hosting hosting companies

"Editor's note" This article focuses on the performance, cost, scalability, technical support, and complexity of open source PHP and non-open source ASP.

In the online forum, there are always hundreds of articles and posts in the discussion of PHP and ASP, who is the better platform? Unfortunately, most people's opinions are always biased, people will always consciously or unconsciously promote their favorite language.

In addition, if you notice the date of the controversy and the article, you will find that most of the information is outdated. It's a pity that the information provided in the previous articles of the search rankings is no longer valid. We also have to consider that both PHP and the ASP. NET are periodically versioned and optimized.

The authors guarantee that both programming languages can be used successfully on very large Web applications and websites, so their ability to handle large Web applications is beyond doubt.

Content Summary:

About performance: I will explain the factors that affect performance, and the results will prove that the choice of a programming language because of speed is meaningless in most cases.

About extensibility: The author will explain the factors that influence the extensibility, but in fact, as long as the programming method is correct, both languages can expand the performance is very strong.

About cost and technical support: Because PHP is open source, it usually runs on the open-source platforms of LAMP (i.e., Linux,apache,mysql and PHP). Therefore, PHP is better than ASP. NET to provide the most cost-effective solution and provide a lot of resources and support.

About average deployment time (that is, additional costs): Using ASP. NET code is twice times more expensive than PHP, so deploying time with PHP is cheaper and faster.

The author will carefully explain each aspect below, and attach the opinion.

1. Scalability and ease of maintenance

Whether you choose PHP or ASP, there's no impact on scalability and serviceability. The scalability and maintainability of WEB applications is primarily dependent on the following:

    • Programmer's Experience
    • Use the best coding practices
    • Use a robust programming framework
    • Follow programming guidelines and standards
2. Performance and Speed

There has been a lot of controversy about this, and most of the arguments are not objective and one-sided. These arguments do not provide a truly effective message, but they are trying to flatter one language and belittle the other.

When it comes to measuring the speed of WEB applications, there are a number of factors to consider. So that the speed of the programming language, most of the current site speed and performance impact, in fact, is negligible.

However, it is necessary to choose a programming language that can perform large tasks quickly if you want to use this language to accomplish a huge task on a daily basis such as Yahoo or Google, which is why Google and Yahoo have chosen multiple programming languages (mostly open source), each of which is used to perform the task that best suits it.

Below, I analyze a variety of common and uncommon scenarios and explain which tasks are more optimal.

The first common scenario

A common task for WEB applications is to access and query the database, and then output the results to a Web server, followed by a browser. Therefore, in this common scenario, all programming languages assume the role of communication or interface between the database server and the WEB server. In this scenario, the speed of the programming language has little effect on the entire process, and the speed of the process depends primarily on the database server, the Web server, the client's Web browser, and the bandwidth.

If you consider a common, mainstream database server, MySQL (now Oracle), Postgresql,mssql and Oracle are working to improve speed and performance. We see that each version of the database server upgrade will bring new features and better performance, so I think that as long as the database programmer using optimized and practical SQL query, and if necessary, such as the caching of advanced features, any of the above database server will be very superior performance.

Google, Facebook,youtube, Yahoo and FIFA, which recently won a huge audience for the World Cup, are using MYSQL. Therefore, the ability of the MySQL database server is beyond doubt.

Based on online statistical surveys, the communication and interface between PHP and MySQL is faster than ASP. NET and MSSQL, but not obvious.

The second common situation

Another common task for web programs is to access the file system, locate an image, and then send it to the Web server. In this case, the programming language task is still very small, and the burden of communication with the programming language mainly falls on the operating system and the file system.

Based on online surveys, the Linux operating system and the EXT4 (file system) perform better than the Windows operating system and NTFS (file system) as of the time of writing.

A third common situation

Most Linux/unix servers are simple to run, without any additional non-essential packages or GUI interfaces, so these operating systems use only a small amount of CPU and RAM, leaving more resources to the database and Web server.

Most Windows servers are cumbersome to run, with many redundant packages that consume a lot of CPU and RAM.

Obviously, the LAMP platform is more advantageous than the ASP, because it has more resources available.

The fourth less common case

ASP. NET is usually written in C #. In general, so far, C # is a faster programming language than PHP. (This situation can also change because the programming language will update continuously to improve speed) so, assuming that you need to perform 2,000,000 loops in order to complete a calculation, ASP. NET programs written in C # will run faster than PHP programs. However, this is a very rare situation where the number of cycles is calculated at a maximum of hundreds of times, rather than 2,000,000 times. And, in this case, you should consider why you should do a 2,000,000-time loop calculation.

Other factors that are not related to programming languages, but that can affect performance include:

    • Knowledge reserves and capabilities of programmers when writing code
    • Knowledge reserves and capabilities of programmers when writing SQL query statements
    • What you need to implement (some functions require more execution time on the ASP than on the PHP platform, some of which happen to be the opposite)

When it comes to performance, here are some professional application performance monitoring tools to talk about. It can be effectively optimized for code, SQL statements, and so on, reducing the impact of code writing on performance and speed.

AppDynamics

Newrelic

OneAPM

Figure for. NET application response time and throughput data monitored on ONEAPM

3. Cost

Php,mysql servers, PostgreSQL servers, Apache servers and Linux operating systems are used and upgraded for free. In addition, there is a separate backup host, or you need to run multiple servers to balance the load or build a server cluster without additional licensing fees.

LAMP (Linux, Apache, MySQL, and PHP) is also more popular in hosting companies. Compared to Windows hosts, the popularity of the LAMP host makes monthly hosting less expensive.

If you purchased a Windows operating system, then ASP. NET and IIS are free. Microsoft's Windows servers, SQL servers and future updates are expensive. For example, Microsoft server R2 64-bit Standard Edition price is around $1029, while Microsoft SQL Server 2008 for small businesses costs $1038.

If this site becomes popular, it is necessary to set up a separate backup host, or to run multiple servers to load balance, build a server cluster, the above costs will be greatly increased.

4. Support and resources

Because LAMP is open source, professional and friendly developers around the world continue to support the update and improvement of this open source platform. In addition, PHP and the LAMP platform have a lot of other resources and developers support.

I mention the word "friendly" because the developers who contribute to the open source community are not for the benefit of the economy. If you have a functional challenge in the coding process, ask for help in the PHP forum, and you will receive useful information from friendly handlers.

ASP. NET relies more on the improvements and updates made by Microsoft's limited number of developers. There are relatively few contributors that can help solve ASP.

5. Deployment Time

In contrast to PHP, ASP. NET requires lots or more lines of code to complete complex features and functions, and spend more time in the development process.

In addition, PHP is compiled on the server side, so when changing the functionality, there is no need for additional steps to see the change. On the contrary, ASP. NET code needs to be compiled each time it is modified. In other words, ASP. NET consumes more time than PHP during the development process.

6. Compilers and tools

PHP and MySQL have independent compilers, and PHP developers can get a richer number of compilers.

Most ASP. NET programmers rely on Microsoft Visual Studio compiler development. NET program. (Many ASP. NET programmers are love and hate for Microsoft Visual Studio)

This is a completely different programming style-programmers using PHP and open source developers prefer text editors like Vi,vim,notepad + +.

VI and VIM are very advanced standalone editors. Developers have complete knowledge of the performance of these editors and can perform complex programming quickly, efficiently and independently. As a result, they have more flexibility in controlling the code. When it comes to using or integrating with platforms such as Javascript,ajax,jquery, PHP developers tend to have the advantage of being familiar with the open source environment and using VI or VIM to hand code.

7. Platform Independence

PHP is platform independent and can be run on any platform in the Linux,unix,mac OS x,windows. ASP. NET will only run on Windows platforms.

8. What platform are the top sites running on?

The table below lists the platforms and languages used for the current popular site. Note:please don ' t confuse C with C # (pronounced C sharp)-they is completely different programming languages. ASP. Mostly programmed in C # (C sharp) or Visual Basic and not C.
Note: Do not confuse C with C #, they are two completely different programming languages. ASP. NET is usually programmed using C # or Visual Basic, not the C language.

site Settling Time Server Platform Programming Languages
google.com November 1998 Linux C, Java, C + +, PHP & MySQL
Facebook.com February 2004 Linux PHP, MySQL and C + +
YouTube.com February 2005 Linux C, Java and MySQL
Yahoo.com August 1995 Linux C + +, C, Java, PHP & MySQL
MSN.com (owned by Microsoft) August 1995 Windows asp
Live.com (owned by Microsoft) August 2008 Windows asp
Wikipedia January 2001 Linux PHP & MySQL
Amazon.com October 1995 Linux & Solaris C + +, Java, EE
WordPress.com November 2005 Linux PHP & MySQL
9. Prevalence level

The LAMP platform is more popular than the Windows platform. Based on the Netcraft July 2010 Data Survey for 205,714,253 Web servers, 112,945,968 (54.9%) of Web servers are hosted on Apache with 53,217,620 (25.87%) Web The server is hosted on Windows, and the rest is hosted on other platforms.

10. Availability and ease of deployment

The unfriendly misinformation about Linux has long been.

In fact, it depends on the user's platform build experience and knowledge reserve level.

But it has to be said that the current popularity of the improved Linux distribution has left a deep impression on the author. Distributions such as Ubuntu, Red Hat, centos,opensuse and Fedora are not only easy to install but also provide a straightforward GUI interface, making it easier to configure Linux servers.

Unfortunately, in my opinion, Microsoft's servers are becoming more and more unwieldy in usability, and server management has become increasingly clumsy and riddled with unnecessary features.

Original address: http://news.oneapm.com/php-asp-net-10/MORE: Http://www.oneapm.com/lp/ctapi

10 big comparisons between PHP and ASP!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.