Hui Xinchen@Laruence is the most influential PHP technical expert in China, a core member of the PHP development team, a PECL developer, and an external consultant to Zend Company. He has worked for Yahoo, Baidu, and now Sina Weibo as the chief architect of the platform and data department and chief PHP consultant. Hui Xinchen is the core developer of PHP NG and the main developer of PHP5.4 and 5.5. As a PECL developer, he has contributed many excellent open source works such as Yaf, Yar, Yac, and Taint. He is also the maintainer of APC, Opcache, Msgpack and other projects.
From a beginner searching for PHP tutorials on the Internet to a core member of the PHP development team, Hui Xinchen feels that the whole process is like "fighting monsters and upgrading." PHP, which like Java is also known as a blue-collar language, in his view, is the cradle that can cultivate more programmers. In an era when everyone can program, more talented people who can promote technological progress are bound to be produced. He shares research, technology, and news related to the PHP language and Zend engine on his blog Fengxuezhiyu. Code on the left hand, poetry on the right hand.
Q: How did you become interested in programming?
The first time I did "programming" seemed to be on the Xiaobawang learning machine. Later, I studied computer science in college. When I was a graduate student, I was responsible for the campus construction of the school. I actively or passively did a lot of web development work, including the website of many secondary departments of the school at that time, the maintenance of the campus BBS, etc. Thinking about it, there seems to be no one thing or one opportunity that made me fall in love with programming. It felt very natural to work in this industry, and I didn’t feel like I didn’t like it, so I just continued doing it.
Q: How did you fall in love with PHP? How did you become a core member of the PHP development team?
When I was a graduate student, I wanted to make a website. When I didn’t know how to do it, I searched online and happened to find a PHP tutorial that taught me how to make a simple website, so I tried to follow it. After doing some research, I found that it was very convenient to install, deploy (there was no such centralized deployment tool at that time, but there were many tutorials on how to deploy LAMP), write code, and test. The syntax was very similar to C language, and even more The name of the API is also the same as that of the libc API. So began my indissoluble bond with PHP.
It should be in 2011. At that time, Ap (the predecessor project of Yaf) was developed for Baidu. It was used well internally at Baidu, so I thought about contributing to PECL and modifying it. After learning about it for a while, I changed its name to Yaf (Yet another framework, the name is also a bit self-deprecating, because PHP has many frameworks), and I sent an email to the PHP mail group. Because my English is poor, the process is still quite tortuous. Fortunately, Pierre Joye helped me a lot at that time and got Yaf into PECL.
In addition, before submitting Yaf, I had actually been studying the source code of PHP, so I also submitted a lot of bugs and fixes. For example, I remember one day at noon, Rasmus (the father of PHP) was in IRC It said a bug was found, and I provided a fix in almost 5 minutes.
After I gradually became familiar with some people and gained everyone's trust, I initiated an application, and then obtained the permission to submit the core code of PHP, and participated in the direct development and bug fixing of PHP. , and became a member of the development team.
As for the core, it is accumulated slowly. In fact, it is also a process of mutual trust. If everyone recognizes your work, then they will respect your opinion. I gradually became familiar with Dmitry Stogov, obtained submission permission for the core part of Zend, and submitted many core bug fixes and new features. Later, I became a Zend external consultant and slowly became a Core Developer.
It sounds like it’s like killing monsters and upgrading.
Q: Under what circumstances did you develop Yaf? How did Baidu support Yaf development at that time?
Before Yaf, there was actually a classic debate about using or not using frameworks: "Using frameworks will reduce performance, while not using frameworks will reduce development efficiency."
At that time, Baidu had many internal frameworks, including open source Yii, ZF, etc., as well as those written by some teams themselves. One problem is that in class libraries, some peripheral facilities cannot communicate with each other.
Another reason is that after many framework authors release the framework, they will find that different people will make various modifications to the framework. As a result, over time, when a framework is released, it becomes Various variants have emerged, making subsequent unified upgrades impossible.
So, I decided to use PHP extension to implement a framework to solve these problems. Of course, I was not very confident before writing this extension, and I didn’t know how much performance improvement the extension could bring. Fortunately, the final result is very good.
Q: Why did you choose to use C language to write Yaf?
PHP is written in C language, so its extensions are also written in C language, so C language was chosen to write Yaf.
Q: Why did you leave Baidu and come to Sina Weibo?
There are actually many reasons for this. For example, I was T7 at Baidu at that time, and I was less involved in business matters. I felt that I didn’t have so much to do, and I felt a bit wasted.
In addition, I was working in Baidu’s commercial search department at the time and was not directly exposed to systems with high traffic volume, so I also hoped to find a large platform to practice more, and Weibo happened to be such a platform. .
After coming to Weibo, I have indeed been exposed to many challenges that I have never encountered before, and I also feel that my knowledge has a bigger stage to use.
Q: What are you currently responsible for at Sina Weibo?
I am now in the Weibo Technology Department, leading a basic service team. Our main work is also divided into stages. The main work in the first two years is to optimize the performance of Weibo LAMP. Including various basic frameworks, tool development, environment optimization, specification formulation, etc.
In the past two years, Weibo’s LAMP architecture has become stable, and the overall performance has improved several times. We also have our own high-performance LAMP overall solution. So there is less work to optimize LAMP. Now the main focus is on the research and development of infrastructure, such as caching middle layer, transcoding service, communication platform, etc.
Question: Has PHP7 (PHPNG) considered the needs and pain points of using PHP on the Sina Weibo platform as important feedback?
Of course this is true. Since I joined the development team, I have had similar arguments with many other members: I think performance is important, but some people think that new features Very important, then we will have disputes when a new feature affects performance.
I am very obsessed with performance improvement, which is why I later collaborated more with Dmitry Stogov, because he was also particularly concerned about performance.
The main reason why I care about performance is that I have a very real understanding of the value that every 1% performance improvement can bring to Weibo, the largest LNMP platform in China. Although the overall performance of our Weibo has been greatly improved compared to two years ago, I realize that without affecting development efficiency, further improvements can only rely on language and environment performance improvements. So this part is Weibo’s demand for PHP.
Compared with WordPress 5.6, PHP7 has more than 100% real performance improvement (QPS). I believe that next year, after PHP7 is released, the various businesses of our Weibo’s overall LAMP platform will You can also get 100% performance improvement.
Q: What is the process like for you to participate in the development of PHP7 (PHPNG)? How do you collaborate with other development team members?
PHPNG was a secret project at the time. The original participants were only Dmitry and me. I still remember it was in the spring of this year. The JIT project we were working on at that time based on PHP5 was shelved because the effect was not satisfactory. Yes, everyone is depressed.
Dmitry said he had an idea to redesign ZVAL and compress the size to reduce memory usage. Then the two of us discussed it, because we actually have various ideas every day, so at that time we just thought: Well, this idea may work. But not very confident yet.
The main idea at that time was to quickly make a working prototype to test the effect. In this process, we mainly discuss ideas, then implement the parts we want to do, and then merge them.
The main tool for cooperation is Skype, but because he is in St. Petersburg and there is a time difference with us, he will also use email communication and review the code through Github.
Later, when the project was almost concluded, we realized, "Hey, this is a good idea and it works." Then it became public. After that, it became a normal collaboration mode. If you have ideas, you submit an RPC, submit a patch, vote, everyone reacts, and then merge.
Q: What features have been added or subtracted from PHP7 so far? How else will performance be improved before release?
There are many. In addition to the PHPNG branch, which mainly provides performance improvements, we also have AST (Abstract Syntax Tree) support, Uniform Variable syntax, 64bits length string supports, some new syntax sugar, and Recent Native TLS etc.
PHP7 will be officially released in October 2015. Before that, we still have some ideas to try, such as using zend_array to directly replace Hashtable; such as re-sectioning and sorting to reduce iTLB by specifying functions miss; for example, introducing some of the optimization methods of JIT (type overturning) into PHP, and using some type-specific OPCodeHandlers to speed up; another example is to further improve the locality of code data and reduce Cache misses, etc.
Of course, we also have a JIT project that we are working on in parallel, but I am very worried about whether this project will be ready when PHP7 is released.
Q: Will the new version of PHP be directly upgraded to PHP7 across PHP6? Why?
The main reason is that PHP had a development version called PHP6, but later this version failed and was not released. Therefore, this version should be PHP7.
Q: What is the relationship between the language Hack released by Facebook and PHP? Is the purpose of Hack to replace PHP? What are the advantages of these two languages over each other?
It doesn’t matter much, Hack is not PHP. As for replacement, I believe they (Facebook) may have such an idea, but it depends on whether the community accepts it.
I am not particularly familiar with Hack, so I can’t comment specifically.
Q: Some people think that because PHP is easy to learn and the threshold is low, some people who are not suitable for programming have come in. What do you think of this view?
I really don’t agree with this point of view. When I graduated from my undergraduate degree, I also tried to find some development jobs and interviewed with several units, but was rejected. Maybe in the eyes of those who interviewed me at the time, I was just a person not suitable for programming.
However, because PHP has a low threshold, people can quickly see the results of their "programming", which will have a positive feedback and incentive effect on novices, making interested people more interested. The more people program, the greater the probability that someone will emerge and contribute to the advancement of technology.
Moreover, future programming languages must develop towards ease of use, further lowering the threshold for programming. Maybe one day everyone can program!
Q: What is the knowledge structure of a qualified PHP engineer?
I remember there was a saying before: "PHP engineers are all panacea." In fact, this sentence is not only applicable to PHP engineers, but should be applicable to all engineers.
The knowledge structure must be broad. Web development involves a lot of technical points. In addition to HTML, CSS, JS, and SQL, you also need to know some common methods for configuration, maintenance, and troubleshooting of Nginx, Linux, and Mysql. You should know some of these.
Q: In addition to technical ability, what else do you focus on during the interview?
I will pay special attention to clear thinking, communication and speaking. In fact, to put it bluntly, if we work together in the future, will there be any obstacles and whether there is great potential for growth.
Question: Chen Bole, the former webmaster of phpe.net, is now selling men’s socks. What are your plans for the future? Will you always be a coder?
Actually, I am a very lazy person, I never think too far ahead, I am drunk now. So I’m actually not very clear about the future. I just think that now I still like programming, and I like to benefit everyone through my work and gain praise from the community. I think this is good, and I will continue to do it.