Swoole 2019: turning multiplication into simplification, breaking cocoon into butterfly.

  Asynchronous, coroutine, php, swoole

SwooleOpen source projects from2012The first edition began to be released in, and it is nearly now.7Years of history. During these seven years:

  • Submitted8821Secondary code change
  • Published287Versions
  • Receive and resolve1161nextissueFeedback
  • Merged603nextpull request
  • in common100A developer contributed code
  • InGitHubHarvest11940A star



2018We launched a brand newSwoole4Version, prior to thisSwooleThe main programming method is synchronous blocking mode or asynchronous callback. New Implementation Based on ConcordeCSPProgramming has gradually become usOnlyRecommended programming mode. Concorde greatly simplifies the complicated asynchronous programming. UseSwoole4Synergy is both simple and powerful. In the futureSwoole5Version, we plan to delete non-synergetic related features and codes, reduce historical burden, improve stability, reduce complexity, reduce unnecessary options, and purely synergize.

In the past6Our team mainly took part-time development as its main task in 2008. Most of the team members came from top-tier domestic Internet companies such as Tencent, Ali, Didi, Baidu, 360 and Xiaomi, and some of them were from abroad.PHPDevelopers, evenPHPLanguageZendVMKernel authorDmitry StogovHe also askedSwooleContributed to the code. In addition, we have also recruited some college studentsSwooleWrite code to gradually train the younger generation of developers.

In2018Year7In January, we formed a full-time development team focused onSwooleKernel andSwoole CloudDevelopment of cloud primary components and ecological chains. Say goodbye to the rebellious team in the past and transform it into a professional open source technology research and development team.

Our goal is to makeSwooleThe project becameNode.jsGoThis kind of industrial technology, becomePHPIn Asynchronous of Programming LanguageIOAnd network communication.

Research and development management

After setting up a full-time research and development team, we have gradually established a very perfect research and development management system to upgradeSwooleThe quality of the software. Mainly includes the following aspects:

Test driver (TDD)

Now we are devoting a lot of energy to implement unit test scripts, pressure test scripts and automated tests to improve unit test coverage. At present, it already exists680Item test case,17Item pressure test items, inTravis-CIThe platform can see every timeCommitAndPull RequestThe compilation and test results of.

The research and development work is also based onTDD, in the development of new features, reconstruction,Bug FixWhen, will write the corresponding unit test script first, the test covers all scenarios of code changes.


Code Review

The team members cross-checked the codes and exchanged opinions with each other.Code ReviewTo fully evaluate and discuss the details of code changes.

Major changes will be made by the team.Review, spend hours or even days discussing the details of each line of code change.

RFC mechanism

For nonBug Fix, non-performance enhancement, non-refactoring, new features or changes that may change the underlying behavior, we will divide into4Three steps were taken.

  1. InitiateRFCOf the United States of America,https://github.com/swoole/rfc …The content of the proposal will elaborate on the antecedents and consequences of the change, related configuration items, scope of impact, usage and examples.
  2. In the discussion of the proposal, we will fully discuss the proposal, dig into the root of the problem, analyze the advantages and disadvantages, and weigh the details. After all the issues have been discussed clearly, the project will finally be approved and will begin to be implemented.
  3. Development manager createsgitBranch, write unit test script, write code, realize all contents in the proposal, and finally initiatePull Request
  4. Cross-review, code check, suggestions for improvement, feedback to development manager, continue to improve the details. Finally merged into the trunk.

The whole process is inGitHubThe platform is open, rightSwooleInterested in the projectPHPerAll can participate.

Swoole RFC

Grayscale test

In order to ensure the stability of the official version, we will conduct gray scale tests on the internal items before the release to check the stability of the new version.

In addition, we and most of themSwooleThe authors of the framework have established contact and the new version will be sent to the authors of the major frameworks for trial use in advance. There are significant underlying changes, or incompatibilities, that will advance with otherSwooleThe author of the above open source project.


In the past few years,SwooleThe project is not very professional, there are manyBUGAnd many users stepped on many pits.After setting up a full-time R&D team in the past six months, we have made rapid progress in R&D management.SwooleIn terms of stability and maturity, it is no longer what it used to be.. Stability is always the first, we will be more cautious and rigorous in the future to ensure quality.


2018In the second half of this year, we have refactored the underlying code many times and optimized the code structure, readability, reusability and encapsulation. MakeSwooleThe software is more concise and elegant.

In terms of programming language, we are gradually using it now.C++SubstituteCLanguage.C++The provided object-oriented, smart pointer, containers, templates and other features can help us further improve the team’s development efficiency.

I also welcome all of you here.PHPerparticipate inSwooleProject, contribution code.


SwooleIt is also an aspect widely criticized by developers. In2018In 2003, our team gradually increased its investment in documentation. Rewrite and sort out documents, add rich example programs, add more detailed diagrams, fix detailed problems, delete emotional statements, and be more objective, neutral and rigorous.

Future 2019

In the new year, we mainly have3We will exert our strength in all directions.

Do subtraction

Deleting non-cooperative features, deleting unnecessary modules, reducing historical burden, improving stability, reducing complexity, reducing unnecessary options, simplifying complexity and making it simpler.

SwooleThe kernel level will continue to restructure and streamline, reduce the number of lines of code, clean up redundant code and reuse code as much as possible.

In-depth project

In2018At the end of the year, we have gradually started to use it in large quantities in the production environment.SwooleThe establishment of contacts between enterprises, includingTencent cloudRead articlesGood futureMomoYouxinSuch as enterprises. Understand the actual application scenarios and business models, conduct in-depth communication and cooperation, provide suggestions, help enterprise technical teams to better solve business problems, and accept feedback to improve the bottom layer.

Ecological chain

2019We will be based onSwoole4Xie Cheng developed some supporting tools and components to make up for it.PHPInCloud NativeDeficiencies in the ecological chain of the times.