2017 © Pedro Peláez
 

library server

Uniondrug Server Component for uniondrug/framework

image

uniondrug/server

Uniondrug Server Component for uniondrug/framework

  • Friday, July 6, 2018
  • by wsfuyibing
  • Repository
  • 2 Watchers
  • 0 Stars
  • 366 Installations
  • PHP
  • 3 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 33 Versions
  • 61 % Grown

The README.md

UniondrugServer 基于Swoole的PHP应用服务器

基于Phalcon的uniondrug/framework项目中,使用本应用服务器可以提高性能。, (*1)

安装

$ composer requre uniondrug/server
$ cp vendor/uniondrug/server/server.php.example config/server.php

使用

$ php server --help
   __  __      _             ____                  
  / / / /___  (_)___  ____  / __ \_______  ______ _
 / / / / __ \/ / __ \/ __ \/ / / / ___/ / / / __ `/
/ /_/ / / / / / /_/ / / / / /_/ / /  / /_/ / /_/ / 
\____/_/ /_/_/\____/_/ /_/_____/_/   \__,_/\__, /  
                                          /____/   Server 1.0.0
Usage:
 server [command] [option]

Options:
  -d, --daemon   Run server as daemon, Do not ask any interactive question
  -t, --path     Web root relative path. Default: /path/to/current/workspace
  -e, --env      Environment. Default: development
  -h, --help     Show this help

Available commands:
  start   Start the server
  stop    Stop the server
  reload  Reload the server
  status  Show the server status [default]

配置

server.php 中配置的是Swoole服务器的运行参数,详细参数请参考swoole文档:, (*2)

return [
    'default'    => [
        'host'      => 'http://0.0.0.0:9527',
        'class'     => \Uniondrug\Server\Servitization\Server\HTTPServer::class,
        'options'   => [
            'pid_file'        => __DIR__ . '/../tmp/pid/server.pid',
            'worker_num'      => 1,
            'task_worker_num' => 1,
        ],
        'processes' => [],
        'listeners' => [
            [
                'class' => \Uniondrug\Server\Servitization\Server\ManagerServer::class,
                'host'  => 'tcp://0.0.0.0:9530',
            ],
        ],
    ],
    'development' => [
        'autoreload' => true,
        'processes' => [
                // 开发环境,自动监控文件改动,改动后自动Reload服务
                \Uniondrug\Server\Processes\ReloadProcess::class,
        ],
    ],
    'production' => [
        'options' => [
            'worker_num' => 5,
        ],
    ],
];

数据库

Swoole的Worker会保持数据库的长连接,如果长时间服务器没有请求发生,可能会出现数据库服务器断开连接的情况。, (*3)

可以通过在数据库的配置文件,增加一个参数,启动定时器来让worker进程与数据库服务器保持心跳。配置文件:database.php,配置参数 interval。参数为0时不启动定时器,大于0时,作为心跳间隔,单位:秒。, (*4)

return [
    'default'    => [
        'adapter'    => 'mysql',
        'debug'      => true,
        'useSlave'   => false,
        'interval'   => 0,
        'connection' => [
            'host'     => '127.0.0.1',
            'port'     => 3306,
            'username' => 'root',
            'password' => '',
            'dbname'   => 'dbname',
            'charset'  => 'utf8',
        ],
    ],
];

任务分发

进程管理

进程间通信

The Versions

06/07 2018

dev-master

9999999-dev

Uniondrug Server Component for uniondrug/framework

  Sources   Download

MIT

The Requires

 

by Uniondrug Dev Team
by Uniondrug R&D Team

06/07 2018

2.8.11

2.8.11.0

Uniondrug Server Component for uniondrug/framework

  Sources   Download

MIT

The Requires

 

by Uniondrug Dev Team

06/07 2018

2.x-dev

2.9999999.9999999.9999999-dev

Uniondrug Server Component for uniondrug/framework

  Sources   Download

MIT

The Requires

 

by Uniondrug Dev Team
by Uniondrug R&D Team

28/05 2018

2.8.10

2.8.10.0

Uniondrug Server Component for uniondrug/framework

  Sources   Download

MIT

The Requires

 

by Uniondrug Dev Team

10/05 2018

2.8.9

2.8.9.0

Uniondrug Server Component for uniondrug/framework

  Sources   Download

MIT

The Requires

 

by Uniondrug Dev Team

09/05 2018

2.8.8

2.8.8.0

Uniondrug Server Component for uniondrug/framework

  Sources   Download

MIT

The Requires

 

by Uniondrug Dev Team

26/04 2018

2.8.7

2.8.7.0

Uniondrug Server Component for uniondrug/framework

  Sources   Download

MIT

The Requires

 

by Uniondrug Dev Team

26/04 2018

2.8.6

2.8.6.0

Uniondrug Server Component for uniondrug/framework

  Sources   Download

MIT

The Requires

 

by Uniondrug Dev Team

25/04 2018

2.8.5

2.8.5.0

Uniondrug Server Component for uniondrug/framework

  Sources   Download

MIT

The Requires

 

by Uniondrug Dev Team

23/04 2018

2.8.4

2.8.4.0

Uniondrug Server Component for uniondrug/framework

  Sources   Download

MIT

The Requires

 

by Uniondrug Dev Team

23/04 2018

2.8.3

2.8.3.0

Uniondrug Server Component for uniondrug/framework

  Sources   Download

MIT

The Requires

 

by Uniondrug Dev Team

23/04 2018

2.8.2

2.8.2.0

Uniondrug Server Component for uniondrug/framework

  Sources   Download

MIT

The Requires

 

by Uniondrug Dev Team

03/04 2018

2.8.1

2.8.1.0

Uniondrug Server Component for uniondrug/framework

  Sources   Download

MIT

The Requires

 

by Uniondrug Dev Team

29/03 2018

2.8.0

2.8.0.0

Uniondrug server. Based on Swoole, supported by FastD.

  Sources   Download

MIT

The Requires

 

by Uniondrug R&D Team

23/03 2018

2.7

2.7.0.0

Uniondrug server. Based on Swoole, supported by FastD.

  Sources   Download

MIT

The Requires

 

by Uniondrug R&D Team

21/03 2018

2.6

2.6.0.0

Uniondrug server. Based on Swoole, supported by FastD.

  Sources   Download

MIT

The Requires

 

by Uniondrug R&D Team

09/03 2018

2.5

2.5.0.0

Uniondrug server. Based on Swoole, supported by FastD.

  Sources   Download

MIT

The Requires

 

by Uniondrug R&D Team

06/03 2018

2.4

2.4.0.0

Uniondrug server. Based on Swoole, supported by FastD.

  Sources   Download

MIT

The Requires

 

by Uniondrug R&D Team

01/03 2018

2.3

2.3.0.0

Uniondrug server. Based on Swoole, supported by FastD.

  Sources   Download

MIT

The Requires

 

by Uniondrug R&D Team

28/02 2018

2.2

2.2.0.0

Uniondrug server. Based on Swoole, supported by FastD.

  Sources   Download

MIT

The Requires

 

by Uniondrug R&D Team

28/02 2018

2.1

2.1.0.0

Uniondrug server. Based on Swoole, supported by FastD.

  Sources   Download

MIT

The Requires

 

by Uniondrug R&D Team

27/02 2018

2.0

2.0.0.0

Uniondrug server. Based on Swoole, supported by FastD.

  Sources   Download

MIT

The Requires

 

by Uniondrug R&D Team

23/02 2018

1.10

1.10.0.0

Uniondrug server. Based on Swoole, supported by FastD.

  Sources   Download

MIT

The Requires

 

by Uniondrug R&D Team

09/02 2018

1.9

1.9.0.0

Uniondrug server. Based on Swoole, supported by FastD.

  Sources   Download

MIT

The Requires

 

by Uniondrug R&D Team

06/02 2018

1.8

1.8.0.0

Uniondrug server. Based on Swoole, supported by FastD.

  Sources   Download

MIT

The Requires

 

by Uniondrug R&D Team

24/01 2018

1.7

1.7.0.0

Uniondrug server. Based on Swoole, supported by FastD.

  Sources   Download

MIT

The Requires

 

by Uniondrug R&D Team

23/01 2018

1.6

1.6.0.0

Uniondrug server. Based on Swoole, supported by FastD.

  Sources   Download

MIT

The Requires

 

by Uniondrug R&D Team

18/01 2018

1.5

1.5.0.0

Uniondrug server. Based on Swoole, supported by FastD.

  Sources   Download

MIT

The Requires

 

by Uniondrug R&D Team

16/01 2018

1.4

1.4.0.0

Uniondrug server. Based on Swoole, supported by FastD.

  Sources   Download

MIT

The Requires

 

by Uniondrug R&D Team

16/01 2018

1.3

1.3.0.0

Uniondrug server. Based on Swoole, supported by FastD.

  Sources   Download

MIT

The Requires

 

by Uniondrug R&D Team

12/01 2018

1.2

1.2.0.0

Uniondrug server. Based on Swoole, supported by FastD.

  Sources   Download

MIT

The Requires

 

by Uniondrug R&D Team

12/01 2018

1.1

1.1.0.0

Uniondrug server. Based on Swoole, supported by FastD.

  Sources   Download

MIT

The Requires

 

by Uniondrug R&D Team

11/01 2018

1.0

1.0.0.0

Uniondrug server. Based on Swoole, with FastD support.

  Sources   Download

MIT

The Requires

 

by Uniondrug R&D Team