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

栏目: PHP · 发布时间: 8年前

内容简介:通用服务器 hi-nginx-v1.2.3 发布,开始支持 PHP

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

主要更新:

  • 实现 PHP 7+开发支持

用法:

            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


以上所述就是小编给大家介绍的《通用服务器 hi-nginx-v1.2.3 发布,开始支持 PHP》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

深度学习

深度学习

[美]特伦斯·谢诺夫斯基(Terrence Sejnowski) / 姜悦兵 / 中信出版集团 / 2019-2 / 88

全球科技巨头纷纷拥抱深度学习,自动驾驶、AI医疗、语音识别、图像识别、智能翻译以及震惊世界的AlphaGo,背后都是深度学习在发挥神奇的作用。深度学习是人工智能从概念到繁荣得以实现的主流技术。经过深度学习训练的计算机,不再被动按照指令运转,而是像自然进化的生命那样,开始自主地从经验中学习。 本书作者特伦斯·谢诺夫斯基是全球人工智能十大科学家之一、深度学习先驱及奠基者,亲历了深度学习在20世纪......一起来看看 《深度学习》 这本书的介绍吧!

JS 压缩/解压工具
JS 压缩/解压工具

在线压缩/解压 JS 代码

XML、JSON 在线转换
XML、JSON 在线转换

在线XML、JSON转换工具

Markdown 在线编辑器
Markdown 在线编辑器

Markdown 在线编辑器