设为首页收藏本站

LUPA开源社区

 找回密码
 注册
文章 帖子 博客
LUPA开源社区 首页 业界资讯 软件追踪 查看内容

通用服务器hi-nginx-v1.2.3发布,开始支持PHP

2017-12-25 23:15| 发布者: joejoe0332| 查看: 292| 评论: 0|原作者: oschina|来自: oschina

摘要: 通用服务器hi-nginx-v1.2.3已经发布了。主要更新:实现PHP7+开发支持用法:location~\.php${ hi_php_scriptphp; }?php require_once'hi/servlet.php'; classhelloimplements\hi\servlet{ publicfunctionhandler(\hi\r ...

通用服务器hi-nginx-v1.2.3已经发布了。

主要更新:

  • 实现PHP7+开发支持

用法:

            location ~ \.php$  {
                hi_php_script php;
            }
<?php

require_once 'hi/servlet.php';

class hello implements \hi\servlet {

    public function handler(\hi\request &$req, \hi\response &$res) {
        $res->content = 'hello,world';
        $res->status = 200;
    }

}

详见

  1. php/hi/request.php,

  2. php/hi/response.php

  3. php/hi/servlet.php

压力测试:

笔记本:i5,双核,4 worker process

ab -c1000 -n 500000 -k http://localhost/hello.php

hi-nginx:

	location ~ \.php$ {
		#rewrite ^/(.*)\.phplus$ /$1.php break;
		hi_need_cache off;
		hi_cache_expires 1s;
		hi_need_headers on;
		hi_need_session on;
		hi_need_cookies on;
		hi_session_expires 300s;
		hi_php_script php;
	}
Server Software:        nginx/1.13.7
Server Hostname:        localhost
Server Port:            80

Document Path:          /hello.php
Document Length:        11 bytes

Concurrency Level:      1000
Time taken for tests:   13.837 seconds
Complete requests:      500000
Failed requests:        0
Write errors:           0
Keep-Alive requests:    495440
Total transferred:      156477200 bytes
HTML transferred:       5500000 bytes
Requests per second:    36136.00 [#/sec] (mean)
Time per request:       27.673 [ms] (mean)
Time per request:       0.028 [ms] (mean, across all concurrent requests)
Transfer rate:          11043.87 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    1  38.5      0    3014
Processing:     0   27  24.3     19     322
Waiting:        0   27  24.2     19     322
Total:          0   28  46.3     19    3085

Percentage of the requests served within a certain time (ms)
  50%     19
  66%     26
  75%     35
  80%     45
  90%     70
  95%     74
  98%     80
  99%     88
 100%   3085 (longest request)

仓库地址:

https://github.com/webcpp/hi-nginx

https://gitee.com/webcpp/hi-nginx


酷毙

雷人

鲜花

鸡蛋

漂亮
  • 快毕业了,没工作经验,
    找份工作好难啊?
    赶紧去人才芯片公司磨练吧!!

最新评论

关于LUPA|人才芯片工程|人才招聘|LUPA认证|LUPA教育|LUPA开源社区 ( 浙B2-20090187 浙公网安备 33010602006705号   

返回顶部