Analysis on how to break through the technical bottleneck of PHP programmers

Source: Internet
Author: User

First, clarify the PHP engineering question I mentioned. After graduation, I used PHP for WEB system development and did not work in the language. Work experience is about 3 ~ In the past four years, the development of common WEB Systems (Millions of accesses, less than million pieces of data, or business logic is not particularly complex) has been quite handy and there is no problem. But they will:

Except for PHP, shell scripts may be used in other languages.
Poor understanding of PHP (except for libraries)
Narrow knowledge (in addition to using PHP and mysql, I do not know other solutions in the face of requirements)
PHP code is mainly process-oriented, and the implementation of object-oriented is too difficult to understand.
PHPer lacks ideas when it comes to projects or business logic that require high performance, high concurrency, and a large amount of data (the system needs to solve the problem of multi-domain businesses. We cannot analyze the nature of the problem and have poor technical judgment. We can quickly find a temporary solution to the problem. However, in the constant temporary solution, the system and itself are gradually collapsing. How can we improve ourselves? How can we challenge a more difficult system?

Where are the higher challenges? Based on my own experience, I will list some specific challenges to give you a perceptual knowledge first.

Where are the challenges of high-performance systems?

How to select a WEB server? Do you want to use the fast-cgi Mode?
Do you want to use the reverse proxy service? Choose full memory cache or hard disk cache?
Do I need Server Load balancer? Is it based on the application layer or the network layer? How can we ensure high reliability?
What is the performance of your PHP code? What is the performance of the optimization tool? Where is the performance bottleneck? Do I need to write C extensions?
What are the features of user access? Is there more reads or writes? Do I need read/write splitting?
How to store data? What is the write speed and read speed? How does data increase and access speed reading change?
How to Use cache? How to consider invalidation? How can we ensure data consistency?
Where are the challenges of high-complexity systems?

Can I identify the business domains? Is one or more?
Can we reasonably abstract the business at a very small cost when business rules change?
Is data consistency and security guaranteed?
Whether or not the object-oriented analysis and design methods are supported
You can answer all the questions I have listed. I think you may have become an architect technically. You still cannot answer the question. You need to strengthen the question in the following ways.

If you cannot answer the question, you need to strengthen it in the following ways:

Analyze the principle and running mechanism of the technology you are using, which can improve your technical judgment and correctness of your technical solution selection;
Learn important knowledge, operating system principles, data structures, and algorithms during the university period. I know that you used to take exams, but now you need to learn for yourself and let yourself know why.
Start learning C language again, although you have already studied it in college. This is not only because you may need to write PHP extensions, but also because, in C applications, there is an environment that always cares about performance, memory control, variable lifecycle, data structures, and algorithms.
Learning Object-oriented analysis and design is an effective way to solve complex problems. Learning abstraction is the only way to solve complex problems.
"How long does it take to learn so many things "? If you work hard, you have a good plan. It may take 1 ~ 2 years.

Effective learning is a big problem. I have some practices, but they are scattered and difficult to summarize. Before going to bed last night, I suddenly thought of the core of RUP, "architecture-centric, case-driven, iterative development". I used this idea to learn effective methods, it can be expressed as follows: Taking Principle, model or mechanism as the center, task-driven, iterative learning.

A little abstract. Here is an example to illustrate how to learn. Objective: To learn how to improve processing performance.

Iterative-driven task: locate the region by IP address.

This is a common task of WEB applications. The IP database records about 10 million rows.

First iteration: implement functions without considering performance (implemented using PHP ). Because you cannot directly search for a region through the KEY (IP), it is not feasible to directly store the data or associate the array. The idea is to sort the data before searching.

How can I search through IP addresses? For sorted data, binary search is the fastest.
How to sort? You can use the library function sort, of course, but you can also learn it, so you should implement quick sorting by yourself.
Objective: To learn the Sorting Algorithm and search algorithm.

PHPer generally has a poor data structure and algorithm base, and does not have such tasks at ordinary times, so it lacks knowledge. However, the problems solved by programming will eventually come down to the data structure and the algorithm used to operate on this data structure. If the data structure algorithm is always in mind, the internal structure of the data structure can be clearly recognized in the case of problems, and the solution will naturally generate.

The second iteration: optimizes data loading and sorting. If you do the first step, it is basically unavailable because the data needs to be loaded and sorted every time, which is too time-consuming. The solution is to put the data in a place that can be accessed by every PHP process after being loaded and sorted at a time.

Put it in memcache, which is easy to think. In fact, it is faster to put it in shared memory (which is supported by accelerators such as EA), because memcache has more network operations. Whether the data is integrated into the shared memory or segmented, how can we test the performance? How to analyze the bottleneck (xdebug )? Driven by these problems, you will learn.

Objective: To learn how to detect, locate, and optimize PHP performance. The impact of PHP implementation structure on performance.

The third iteration: Compile PHP extensions. The performance is still not good, and you have to enter the world of C/C ++, but from now on, you will not just be a PHPer server full-team engineer, of course, this is a huge challenge for those who have not done C/C ++. I can't simply talk about how to learn C/C ++ here. For more information, see PHP programmers learning C ++.

Objective: To learn C/C ++ and compile PHP extensions

How can we determine the mechanisms and principles to be learned? How can we find a learning-driven task? I have no idea what to learn. How can I answer the above two questions?

Find out the focus of learning from the positioning of this technology, that is, how it achieves (mechanism) and why it does (model or principle)
List the most common applications of this technology, as a learning task, from simple to difficult to practice.
If I want to learn Javascript, I have some perceptual knowledge about HTML and CSS. First, I learned that JS is a dynamic language in the WEB field and mainly solves the dynamic interaction of WEB pages. The main points to learn are as follows:

How JS interacts with HTML (mechanism)
What is the difference between the dynamic features of JS and other dynamic languages? (Language Model)
If you are completely self-taught, it is not easy to find the key points (mechanisms, models, and principles) to be learned and set learning tasks. If you find an experienced person to guide you or add a Learning Team, the learning speed will indeed be greatly improved.

Related Article

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: 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.