Growth bottlenecks faced by PHP engineers. As one of the most widely used languages in Web development, PHP has a large number of fans. Are you a good programmer? During self-cultivation, have you ever wondered whether PHP is a large fan of any of the various languages that are most widely used in Web development, so are you a good programmer? During self-cultivation, have you ever thought about how to break through the bottleneck of myself in order to develop better?
PHP engineers are facing growth bottlenecks
First, we should clarify that the PHP engineer referred to here refers to the development of Web systems mainly using PHP, and has not worked in any 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 any other solutions ).
◆ PHP code is mainly process-oriented. I think 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? are there too many 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 object-oriented analysis and design methods are supported
All the questions listed here can be answered with certainty, indicating that you may have become an architect technically. You still cannot answer the question. you need to strengthen the question in the following ways.
How to improve and break through the bottleneck
If you cannot answer the question, you need to strengthen it in the following ways:
◆ Analyze the technical principles and mechanisms behind your use, 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 what it is;
◆ 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.
Effective Learning is a big problem. "Architecture-centric, case-driven, iterative development", with this idea, effective learning methods 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 to search by IP address? 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.
Learning Objectives: sorting algorithm and searching algorithm
PHPer's data structure and Algorithm basics are relatively poor, and there are no such tasks at ordinary times, and they do not learn themselves. Therefore, there is a lack of knowledge in this area. 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: Optimizing 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.
Third iteration: compile PHP extension
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 ++.
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 can do so. 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. The first thing we need to know is that JavaScript is a dynamic language in the Web field and mainly solves the dynamic interaction of Web pages. The main points to be learned are as follows:
◆ How JavaScript interacts with HTML (mechanism)
◆ What is the difference between the dynamic features of JavaScript 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.
Finally, I would like to say to you: PHP is easy to use, but it cannot limit our growth!
Why? Have you ever thought about the various ways of self-cultivation...