Workerman-high-performance PHPsocket framework

Source: Internet
Author: User
Workerman-high-performance PHPsocket framework

Workerman is a high-performance PHP socket server framework. based on PHP multi-process and libevent event polling libraries, PHP developers can develop their own network applications by implementing one or two interfaces, such as Rpc, chat room servers, and game servers.

The goal of Workerman is to make it easier for PHP developers to develop socket-based high-performance application services, rather than understanding PHP socket and PHP multi-process details. Workerman is a PHP multi-process server framework with PHP process management and socket communication modules. Therefore, it can run independently without relying on php-fpm, nginx, apache, and other containers.

Features
  • PHP Development

  • Support for PHP multi-process

  • Support for TCP/UDP

  • Interfaces support various application layer protocols

  • Supports libevent event polling library and high concurrency

  • Supports smooth service restart

  • Supports PHP file update detection and automatic loading

  • Support for PHP persistent connections

  • Allows you to run sub-processes as specified users.

  • Supports telnet remote control

  • High performance

There are already many network applications based on workerman, such as multiplayer online games, PHP-Json-Rpc, PHP-Thrift-Rpc, PHP-WebSocket chat rooms, and PHP statistical monitoring systems.

Sample code:

 Count = 4; // after receiving the data sent from the client, return hello $ data to the client $ ws_worker-> onMessage = function ($ connection, $ data) {// send hello $ data $ connection-> send ('hello '. $ data) ;}; // Run Worker: runAll ();

Performance Stress testing

Test environment:

System: ubuntu 12.04 LTS 64-bit memory: 8 Gcpu: Intel®Core i3-3220 CPU @ 3.30 GHz x 4
Business logic:
hello world
Result:
Short link (the link is closed after each request is completed, and a new link is created next time): condition: the stress testing script opens 500 threads, and each thread links Workerman 10 times, result 1 request sent at each link: Throughput: 3 W/S, cpu: 60%, memory usage: 4*8 M = 32 M
Long link (the link is not closed after each request, and the next request continues to reuse this link): condition: the pressure test script opens 1000 threads, and each thread links Workerman once, result of sending 68% requests per link: Throughput: 13 W/S, cpu:, memory usage: 4*8 M = 32 M
No traffic jitter, no memory leakage, and extremely powerful performance

Workerman startup interface:

Workerman status display interface:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.