How PHP programmers break through technical bottlenecks _ PHP Tutorial

Source: Internet
Author: User
How can PHP programmers break through technical bottlenecks. I have a few friends who are engaged in PHP development and have come into contact with many PHP engineers. They often doubt their future technological growth and development. I often give them some suggestions, I hope they can break through several friends who are doing PHP development and have access to many PHP engineers. They often doubt their future technological growth and development. I often give them some suggestions, I hope they can break through and develop better.

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. However, they will have the following features:

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

  1. How can I search through IP addresses? For sorted data, binary search is the fastest.
  2. 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?

  1. 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)
  2. 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.

...

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.