当前位置:网站首页>[swoole Series 1] what will you learn in the world of swoole?
[swoole Series 1] what will you learn in the world of swoole?
2022-07-01 23:23:00 【Ma Nong Lao Zhang ZY】
stay Swoole In the world of , What are you going to learn ?
In the next study , What we are going to touch , It will be PHP A very famous framework in the extension , That's it Swoole . Maybe you have used it in the production environment , Maybe you just read the official documents and wrote a few examples , Of course , More likely, you just heard its name .
Don't worry too much , Through our study , You will master the basic Swoole Development knowledge , Some simple knowledge of computer operating system and network , And a very similar Laravel Of Swoole frame . Believe that through these , You can try to use it in your real project Swoole To do some projects , Experience PHP A super strong solution to the most criticized efficiency problem .
Swoole
Let's take a look first Swoole What is it? .
Swoole send PHP Developers can write high-performance and high concurrency TCP、UDP、Unix Socket、HTTP、 WebSocket Etc , Give Way PHP No longer limited to Web field .Swoole4 The maturity of the collaborative process will PHP Into an unprecedented period , It provides a unique possibility for performance improvement .Swoole Can be widely used in the Internet 、 mobile communication 、 Cloud computing 、 Network game 、 The Internet of things (IOT)、 Car networking 、 Smart home and other fields . Use PHP + Swoole Can make the enterprise IT The efficiency of the R & D team has been greatly improved , More focus on developing innovative products .
The above paragraph is about Swoole Explanation . Looking at it, I feel tall ? Actually ,TCP、UDP、Unix Socket、HTTP、 WebSocket these , We are ordinary PHP Can also do , however , Usually we are doing ordinary Web When developing , With the help of a server application , for instance Apache perhaps Nginx To match fastcgi To implement . And in the Swoole in , Just run Swoole Services can realize the mounting of these services . Of course , We can also put it on the outside Nginx , This makes it easier to manage application addresses ( domain name ).
Besides , In the official description , High performance is a key word , To what extent can the performance be improved ? We will have an example demonstration later .
And traditional PHP Conceptual differences
Even if you haven't done it Java perhaps .NET、C/C++ And so on , I've heard that they need to be compiled to generate a running file before they can be officially deployed online . And our traditional PHP It seems that there is no such situation , Update a file at any time , Throw it on the server to run . This problem is about static and dynamic languages .
In general ,Java This kind of language can be summed up as static language , They have fixed variable types , You have to compile to run , The feature is that one load will directly load the code into memory . Typically, it's like various applications on our computers , Directly execute a program .exe file , This program runs on your computer . If you use a text tool to open this exe perhaps Java Of Jar Word of the file , What you will see is a pile of binary content like garbled code .
and PHP This kind of , Can be classified as dynamic language , The characteristic is that variables do not need to specify types , Any file can be run directly . I believe you must have thought of ,Python、JavaScript This is how it works . Even if JS Of npm compile , In fact, the code is only confused and formatted , Not fully compiled into a similar jar An intermediate code execution file like package .
For the compilation and operation mode of these two languages , Static languages load code into memory at one time , Efficiency will obviously improve a lot , After all, the speed gap between memory and hard disk is still quite large . and , Static languages will integrate many initial objects at once , Class template file loading , There is no need to reload instantiation when calling , Performance will have further room for improvement . however , Static languages usually need to be compiled into an executable intermediate file , If there are code updates , You must restart the whole program .
ok , The advantages and disadvantages of dynamic language are obviously the reverse of static language . Dynamic language runs one script at a time , You need to load all relevant files once , And if there is no other optimization ( such as OPcache), All relevant files should be read from the hard disk 、 Load memory 、 Instantiate these steps from the beginning . As one can imagine , Its efficiency and performance cannot be compared with static language . however , The advantages are also clear , Modify a file at any time, and you can go online at any time , Online business without interruption .
therefore ,PHP It is usually the first choice for start-ups , Because it's convenient , Fast update iteration , Little impact on online business . But when the company develops to a certain scale , But it is easy to be Java、Golang Wait for language to replace . After all , A server can resist 5 The pressure of servers , The cost can be saved a lot , More importantly , When the company reaches a certain scale , For hot updates 、 Standardize online and other related operations , It will also make problems such as the need for static languages to compile or restart services become marginal minor problems . Performance efficiency is often the more important consideration of large and medium-sized companies .
The above content is only based on my own understanding , Doesn't mean it's completely correct , But the general direction should be no problem . That must be the point , You can guess Swoole How to solve the problem of efficiency and performance . It is by loading code directly into memory , It's like Java They also start a process , Realization PHP High performance execution of code . meanwhile , Try to keep the code written in the traditional way , For us PHP Programmers provide a high-performance solution .
Tutorial framework
This series of tutorials is also in the form of articles and videos , We will divide it into two big modules .
The first module is based on official documents , Simply learn Swoole The contents of the framework , At the same time, try your best to explain some relevant computer and network knowledge .
The second module is one I use in the production environment Swoole frame Hyperf Relevant configurations of use . This frame is connected with Laravel Very similar , Good to start with . If you have chased our previous Laravel series , Then it should not be too difficult .
alike , There won't be too many actual projects , After all, these things are too much , Just search a bunch of .
References are also based on Swoole Official documents and Hyperf Based on official documents . Official documents are always the most important reference materials for you to learn , Not one of them. , What I wrote is just an extension of the official documents .
Last , There is also an explanation ,Swoole It was developed by our people : Han Tianfeng bosses . The document is in Chinese without pressure , similarly ,Hyperf It was also developed by Chinese leaders , The same pure Chinese document . Thank you guys !
summary
Okay , There's not much left to say , Let's hurry into Swoole In the world! .
ps. Due to limited personal level , In this series of article tutorials , If there is any mistake, please criticize and correct !
边栏推荐
- Zhongang Mining: it has inherent advantages to develop the characteristic chemical industry dominated by fluorine chemical industry
- Redis数据类型和应用场景
- Jerry's burning of upper version materials requires [chapter]
- Advanced skills of testers: a guide to the application of unit test reports
- Daily three questions 6.29
- 从第三次技术革命看企业应用三大开发趋势
- 日本购物网站的网络乞丐功能
- 2022年起重机司机(限桥式起重机)考试试题及模拟考试
- Practical application and extension of plain framework
- 转行软件测试,知道这四点就够了!
猜你喜欢

CKS CKA CKAD 将终端更改为远程桌面

CADD课程学习(3)-- 靶点药物相互作用

Glass mosaic
![Jielizhi Bluetooth headset quality control and production skills [chapter]](/img/3e/571d246d211a979e948dae1de56e93.png)
Jielizhi Bluetooth headset quality control and production skills [chapter]

The digital summit is popular, and city chain technology has triggered a new round of business transformation

Matplotlib常用設置

问题随记 —— /usr/bin/perl is needed by MySQL-server-5.1.73-1.glibc23.x86_64

from pip._internal.cli.main import main ModuleNotFoundError: No module named ‘pip‘

You probably haven't noticed the very important testing strategy in your work

问题随记 —— file /usr/share/mysql/charsets/README from install of MySQL-server-5.1.73-1.glibc23.x86_64 c
随机推荐
The digital summit is popular, and city chain technology has triggered a new round of business transformation
dat. GUI
Compare the version number [double pointer to intercept the string you want]
openresty 负载均衡
Jerry's records are powered by Vbat with a power supply voltage of 4.2V [chapter]
2022安全员-C证考试题模拟考试题库及模拟考试
MySQL -- convert rownum in Oracle to MySQL
共享电商的背后: 共创、共生、共享、共富,共赢的共富精神
物联网开发零基础教程
Paramètres communs de matplotlib
2021 RoboCom 世界机器人开发者大赛-高职组复赛
每日三题 6.29
mysql ---- Oracle中的rownum转换成MySQL
Matplotlib common settings
会声会影2022智能、快速、简单的视频剪辑软件
y53.第三章 Kubernetes从入门到精通 -- ingress(二六)
Istio、eBPF 和 RSocket Broker:深入研究服务网格
Redis数据类型和应用场景
数字峰会人气火爆,城链科技引发新一轮商业变革
Linux基础 —— CentOS7 离线安装 MySQL