Home > Article > PHP Framework > Is workerman easy to use?
Workerman is an open source high-performance PHP socket service framework developed purely in PHP.
In fact, Workerman is similar to a PHP version of nginx, and the core is also multi-process Epoll non-blocking IO. Each Workerman process can maintain tens of thousands of concurrent connections. Because it resides in memory, it does not rely on containers such as Apache, nginx, and php-fpm, and has ultra-high performance. (Recommended learning: workerman tutorial)
Supports TCP, UDP, UNIXSOCKET at the same time, supports long connections, supports Websocket, HTTP, WSS, HTTPS and other communication protocols and various customizations protocol. It has many high-performance components such as timers, asynchronous socket clients, asynchronous Mysql, asynchronous Redis, asynchronous HTTP, and asynchronous message queues.
1. Pure PHP development
Applications developed using WorkerMan can run independently without relying on containers such as php-fpm, apache, and nginx. This makes it very convenient for PHP developers to develop, deploy, and debug applications.
2. Support PHP multi-process
In order to give full play to the performance of the server's multi-CPU, WorkerMan supports multi-process and multi-tasking by default. WorkerMan starts a main process and multiple sub-processes to provide external services. The main process is responsible for monitoring the sub-processes. The sub-processes independently monitor network connections and receive, send and process data. Due to the simple process model, WorkerMan is more stable and efficient.
3. Support TCP and UDP
WorkerMan supports TCP and UDP two transport layer protocols. You only need to change one attribute to change the transport layer protocol, and no business code is required. change.
4. Support long connections
Many times require PHP applications to maintain long connections with clients, such as chat rooms, games, etc., but traditional PHP containers ( apache, nginx, php-fpm) are difficult to do this.
Using WorkerMan, as long as the server business does not actively call the close connection interface, you can use PHP long connection. A single WorkerMan process can support tens of thousands of concurrent connections, and multiple processes can support hundreds of thousands or even millions of concurrent connections.
5. Support various application layer protocols
The WorkerMan interface supports various application layer protocols, including custom protocols. Changing the protocol in WorkerMan is also very simple. It only requires configuring a field, and the protocol is automatically switched without any changes to the business code. You can even open multiple ports with different protocols to meet different client needs.
6. Support high concurrency
WorkerMan supports the Libevent event polling library (the Libevent extension needs to be installed). The performance of using Libevent is very excellent in high concurrency. If it is not installed Libevent uses PHP's built-in Select-related system calls, and its performance is also very powerful.
The above is the detailed content of Is workerman easy to use?. For more information, please follow other related articles on the PHP Chinese website!