Openresty安装

清疚 2022-02-01 04:31 337阅读 0赞

一、依赖环境安装(如果已安装可跳过)

  1. yum install -y gcc openssl-devel readline-devel pcre-devel perl

二、 openresty安装

下载地址 http://openresty.org/cn/download.html

  1. curl -R -O https://openresty.org/download/openresty-1.13.6.1.tar.gz
  2. tar xzvf openresty-1.13.6.1.tar.gz
  3. ./configure --user=root --group=root --prefix=/usr/local/openresty-1.13.6.1 --with-luajit --without-http_redis2_module --with-http_iconv_module --with-http_ssl_module --with-http_stub_status_module --with-pcre --with-http_realip_module
  4. gmake && gmake install

三、HelloWorld

  1. $ cat /usr/local/openresty/nginx/conf/nginx.conf
  2. worker_processes 1;
  3. error_log logs/error.log info;
  4. events {
  5. worker_connections 1024;
  6. }
  7. http {
  8. server {
  9. listen 81;
  10. location / {
  11. content_by_lua 'ngx.say("hello world.")';
  12. }
  13. }
  14. }
  15. -- 启动nginx
  16. $ /usr/local/openresty/nginx/sbin/nginx
  17. -- 检查nginx
  18. $ curl http://127.0.0.1:81/
  19. hello world.

四、性能测试

  1. -- 安装压力测试工具
  2. $ yum install httpd-tools
  3. -- 测试
  4. $ ab -c10 -n50000 http://localhost:8003/
  5. This is ApacheBench, Version 2.3 <$Revision: 1430300 $>
  6. Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
  7. Licensed to The Apache Software Foundation, http://www.apache.org/
  8. Benchmarking 127.0.0.1 (be patient)
  9. Completed 5000 requests
  10. Completed 10000 requests
  11. Completed 15000 requests
  12. Completed 20000 requests
  13. Completed 25000 requests
  14. Completed 30000 requests
  15. Completed 35000 requests
  16. Completed 40000 requests
  17. Completed 45000 requests
  18. Completed 50000 requests
  19. Finished 50000 requests
  20. Server Software: openresty/1.13.6.1
  21. Server Hostname: 127.0.0.1
  22. Server Port: 81
  23. Document Path: /
  24. Document Length: 13 bytes
  25. Concurrency Level: 10
  26. Time taken for tests: 4.270 seconds
  27. Complete requests: 50000
  28. Failed requests: 0
  29. Write errors: 0
  30. Total transferred: 8800000 bytes
  31. HTML transferred: 650000 bytes
  32. Requests per second: 11710.28 [#/sec] (mean)
  33. Time per request: 0.854 [ms] (mean)
  34. Time per request: 0.085 [ms] (mean, across all concurrent requests)
  35. Transfer rate: 2012.70 [Kbytes/sec] received
  36. Connection Times (ms)
  37. min mean[+/-sd] median max
  38. Connect: 0 0 0.4 0 8
  39. Processing: 0 1 1.0 0 15
  40. Waiting: 0 0 0.9 0 15
  41. Total: 0 1 1.1 0 15
  42. WARNING: The median and mean for the processing time are not within a normal deviation
  43. These results are probably not that reliable.
  44. Percentage of the requests served within a certain time (ms)
  45. 50% 0
  46. 66% 1
  47. 75% 1
  48. 80% 1
  49. 90% 1
  50. 95% 3
  51. 98% 5
  52. 99% 6
  53. 100% 15 (longest request)

发表评论

表情:
评论列表 (有 0 条评论,337人围观)

还没有评论,来说两句吧...

相关阅读

    相关 Openresty安装

    yum安装 你可以在你的 CentOS 系统中添加 openresty 仓库,这样就可以便于未来安装或更新我们的软件包(通过 yum update 命令) ①添加Ope

    相关 Openresty快速安装

    1. 场景描述 软件老王帮同事初始化服务器,需要安装下Openresty,安装过好多次,但是命令还是记不住,这次又安装记录了下,直接按下面的命令next-next就行了,

    相关 openresty安装

    一、简介 OpenResty是一个基于Nginx与Lua的高性能Web平台,其内部集成了大量精良的Lua库、第三方模块以及大多数的依赖项。用于方便地搭建能够处理超高并发、扩展