Home >PHP Framework >Workerman >Is worker efficient?

Is worker efficient?

(*-*)浩
(*-*)浩Original
2019-12-12 09:32:372328browse

workerman itself is a PHP multi-process server framework with modules for PHP process management and socket communication, so it can run independently without relying on containers such as php-fpm, nginx or apache.

Is worker efficient?

Pure PHP development

workerman is completely developed using PHP. Applications developed using workerman do not rely on php-fpm, apache, nginx containers can run independently. This makes it very convenient for PHP developers to develop, deploy, and debug applications. (Recommended learning: workerman tutorial)

Support PHP multi-process

In order to give full play to the performance of the server's multi-CPU, workerman supports multi-process multi-process by default Task. Workerman starts a main process and multiple sub-processes to provide external services. The main process is responsible for monitoring the exit signals of the sub-processes and generating new sub-processes to handle services. This not only improves the performance of the application, but also makes Workerman more stable.

Support TCP, UDP

workerman supports TCP and UDP two transport layer protocols. You only need to change one field of the configuration to change the transport layer protocol and business code. No changes are required.

Support high concurrency

workerman supports Libevent event polling library (Libevent extension needs to be installed). Using Libevent has excellent performance in high concurrency. If Libevent is not installed, Use PHP's built-in Select related system calls.

Support various application layer protocols

The interface supports various application layer protocols, including custom protocols. The protocols supported by Workerman by default include HTTP, WebSocket, and the simple Text protocol. At the same time, Workerman provides a common protocol interface, and developers can easily develop their own protocols based on this interface.

Support long connections

Many times it is necessary for PHP applications to maintain long connections with clients, such as chat rooms, games, etc., but traditional PHP containers (apache, nginx, php-fpm) it is difficult to do this.

Use workererman to easily use PHP long connections. A single PHP process can support thousands or even tens of thousands of concurrent connections, and multiple processes can support hundreds of thousands or even millions of concurrent connections.

Built-in monitoring

Workerman has an internal monitoring and statistics module, which can count some of Workerman's own data, such as the number of process exits and exit status, and the memory occupied by each process. The size and listening IP port, the startup time of each process, the service name of the process running, the number of requests processed by each process, the number of connections, the number of failed packet transmissions, etc. This information can be viewed locally by running php start.php status locally.

Support heartbeat detection

Gateway/Worker development model supports server-side heartbeat detection, which can regularly send application layer heartbeats to the client and detect client extremes in a timely manner Offline situations (power outage, sudden network failure, etc.).

The above is the detailed content of Is worker efficient?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn