y4t3h4igb3wik/flarum-s

为Flarum设计的异步PHP网络服务器。

dev-master 2022-06-20 17:44 UTC

This package is auto-updated.

Last update: 2024-09-20 23:14:15 UTC


README

Build Status Total Downloads Latest Stable Version License

关于Flarum

Flarum是一个简单易用的网站讨论平台。它快速且易于使用,拥有您运营成功社区所需的所有功能。它设计成

  • 快速且简单。没有杂乱,没有臃肿,没有复杂的依赖。Flarum是用PHP构建的,因此快速且易于部署。界面由Mithril提供支持,这是一个性能出色且占用空间很小的JavaScript框架。

  • 美观且响应式。这是为人类设计的论坛软件。Flarum经过精心设计,能够在各种平台上提供一致和直观的体验。

  • 强大且可扩展。自定义、扩展和整合Flarum以适应您的社区。Flarum的架构非常灵活,拥有强大的扩展API。

screenshot

要求

安装(Flarum + Swoole)

您必须能够访问具有PHP 7.2+MySQL 5.6+的服务器,并安装Composer

安装Swoole

$ pecl install swoole

安装Flarum-S项目

$ composer create-project flarum/flarum flarum-s --stability=beta

为Flarum-S安装HTTP服务器Swoole

$ composer require knik/flarum-s:dev-master
$ composer update -o
$ cp -rf vendor/knik/flarum-s/bin/ bin/
$ chmod 755 bin/flarum-s

配置IP和端口

Change `bin/config.php`: listen_ip, listen_port

命令服务

使用方法

$ cd bin/
$ ./flarum-s service start
        ___________.__
        \_   _____/|  | _____ _______ __ __  _____
         |    __)  |  | \__  \_  __ \  |  \/     \
         |     \   |  |__/ __ \|  | \/  |  /  Y Y  \
         \___  /   |____(____  /__|  |____/|__|_|  /
             \/              \/                  \/

Server         Name:      flarum-httpd
System         Name:      linux
PHP            Version:   7.3.3-1+ubuntu18.04.1+deb.sury.org+1
Swoole         Version:   4.3.1
Coroutine      Mode:      enabled
Listen         Addr:      127.0.0.1
Listen         Port:      9501
Reactor        Num:       4
Worker         Num:       4

打开您的浏览器到http://127.0.0.1:9051以验证您已启动并运行。

基准测试

使用4个CPU / 1 GB内存 / PHP 7.3 / Ubuntu 18.04.4 x64

基准测试工具:wrk

wrk -t4 -c100 http://your.app

PHP7.3

$ cd public/
$ php -S 127.0.0.1:8080
$ wrk -t2 -c50 -d5s https://:8080

Running 5s test @ https://:8080
  2 threads and 50 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency     1.07s   526.15ms   1.91s    56.52%
    Req/Sec     8.04      4.20    20.00     80.36%
  62 requests in 5.02s, 326.41KB read
  Socket errors: connect 0, read 62, write 0, timeout 39
Requests/sec:     10.35
Transfer/sec:     65.02KB

Swoole HTTP服务器

wrk -t2 -c50 -d5s https://:9501

Running 10s test @ https://:9501
  2 threads and 50 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency   807.75ms  225.06ms   1.91s    74.43%
    Req/Sec    27.83     17.37    70.00     51.72%
  266 requests in 5.11s, 1.81MB read
  Socket errors: connect 0, read 0, write 0, timeout 4
  Non-2xx or 3xx responses: 9
Requests/sec:     52.05
Transfer/sec:    362.00KB

结论

4倍时间

[编程乐趣]

许可证

Flarum是开源软件,根据MIT许可证授权。