Workerman-A high-performance PHP socket framework

Source: Internet
Author: User

Workerman is a high-performance PHP socket server framework, Workerman based on PHP multi-process and Libevent event polling library, PHP developers as long as the implementation of one or two interfaces, you can open their own network applications, such as RPC services, chat room servers, Game server and so on.

Workerman's goal is to make it easier for PHP developers to develop socket-based, high-performance application services without having to understand PHP sockets and PHP multi-process details. Workerman itself is a PHP multi-process Server framework, with PHP process management and socket communication modules, so do not rely on PHP-FPM, Nginx or Apache and other such containers can be run independently.

Characteristics

    • Using PHP Development

    • Support for PHP multi-process

    • Support TCP/UDP

    • Support for various application layer protocols on the interface

    • Supports Libevent event polling library, supports high concurrency

    • Support Service Smooth Restart

    • Support PHP file update detection and automatic loading

    • Support for long PHP connections

    • Support to run child processes with the specified user

    • Supports Telnet remote control

    • Performance

Based on Workerman already have a lot of network applications, such as multi-person online tadpoles games, Php-json-rpc, php-thrift-rpc, php-websocket chat room, PHP statistical monitoring system and so on.

Example code:

 
  Count = 4;//Returns Hello $data to client after receiving data from client $ws_worker->onmessage = function ($connection, $data) {    //Send Hello $ to client Data    $connection->send (' Hello '. $data);};/ /Run Worker::runall ();

Performance Stress Testing

Test environment:

System: Ubuntu 12.04 LTS 64-bit memory: 8gcpu:intel®core i3-3220 CPU @ 3.30ghzx4

Business logic:

Hello World

Results:

Short link (Close the link after each request completes, next request to establish a new link): Condition: Test script Open 500 threads, each line subroutines connect Workerman 10W times, each link sends 1 request result: Throughput: 3w/s, cpu:60%, memory consumption: 4*8m = 32M
Long link (do not close the link after each request, the next request to continue to reuse this link): Condition: Pressure test script Open 1000 threads, each line subroutines Workerman 1 times, each link sends 10W request result: Throughput: 13w/s, cpu:68%, memory consumption: 4*8m = 32M
No flow jitter, no memory leaks, very powerful performance

Workerman Start Interface:

Workerman Status Viewing 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.