Analysis of PHP development of large Web applications (1) _ PHP Tutorial

Source: Internet
Author: User
Analysis of PHP development of large Web applications (1 ). The "large" application mentioned here does not mean the implementation of large websites such as Google, eBay, and Yahoo. I have no intention to persuade readers to give up their concepts and beliefs, I just hope that the "large" applications mentioned here do not mean the specific implementation of large websites such as Google, eBay, and Yahoo. I have no intention to persuade readers to give up their concepts and beliefs, I just hope that everyone's system can run faster and smoother, and more users can be hosted online. I hope this will help PHP beginners.

There are many articles on PHP execution efficiency on the internet. most of them start with the debate on PHP and Java camps and end with an uncertain expectation, with few clear conclusions. Indeed, the execution efficiency of the program is difficult to draw from the comparison. Different applications have different execution environments, and the efficiency varies greatly. Efficiency also needs to be weighed. everyone knows that the assembly language is very low-level and can write very efficient programs, but I still have very few. I should say that I have hardly seen anyone using assembly for Web development, in addition, those who have the ability to write efficient programs through compilation seem to be worthy of your attention. haha ~ We don't have to discuss the difference between PHP and assembly, as long as we know the difference between our PHP and other PHP.

First, we need to clarify the premise of this article: there must be one or more servers that can be manipulated by ourselves, rather than virtual host space. After all, the general systems that can run on virtual hosts already have a lot of classic works and mature frameworks, and efficiency mining has been done very well by our predecessors, many of their ideas have been inherited and developed by many PHP users. more and more so-called "frameworks" are like the stars, and I don't want to write any more, because first, my own level is not very good, I can't write any new things, and I am also smiling. second, I wrote too many articles and said too much, chaos is the biggest culprit in the death of many passionate talented programmers in the future.

Programs executed on independent servers are significantly different from those that can run on virtual hosts in terms of efficiency optimization. Of course, you can install a set of discuz on one or even a bunch of independent servers without modification. however, is it really the best performance optimization? are you really worthy of this pile of servers?

An independent server means that the user has full control over the machine, including installing and deleting software, configuring system parameters, and even modifying source code. Based on such an open hardware platform, the performance is not only reflected in speed, but also includes security and stability. Unlike virtual hosts, users must configure Web server parameters, install and configure PHP, databases, and install various messy things (which I like to say) on their own, and of course be responsible for them.

First, several terms are proposed: execution time, Template, database encapsulation, Cache, Buffer, Hash, Daemon, and crontab.

The execution time, everyone knows, is the time from the execution of a program to the end of the execution. Because the Web is instantaneous and stateless, the execution time is an indicator of the Web program execution efficiency. it is not suitable for measuring the C/S program or the background daemon program, because many of them are continuous. A typical example of page execution time is the explicit time at the bottom of the Discuz forum page. usually Discuz is several milliseconds to dozens of milliseconds, which is related to the platform, data volume, and current system pressure.

The template is familiar to everyone. although many people are only using it, they do not know why it is used. Traditionally, a template is a way to divide the logic layer. in the MVC structure, it separates the presentation layer from the lower layer. in actual use, it facilitates the division of labor between programmers and interface designers. However, in many cases, due to the improper use of templates, it does not promote the division of labor between programmers and interface designers, it turned out to be a hate affair between programmers and artists (as I have said in my previous post). many people complain that they have to spend a lot of time organizing templates.

Database encapsulation seems to have a greater relationship with Java. It provides a unified calling interface for multiple database systems, usually encapsulated classes, these classes sometimes complete some work, such as SQL check and filtering. The DB encapsulation, pear db, and Adodb in PHPLIB are well-known and widely used.1

...

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.