Skip to content

Instantly share code, notes, and snippets.

Avatar

YuanSheng Wang membphis

  • apiseven.com
  • Zhuhai, China
View GitHub Profile
View gist:fd0e71f98af99e898f03ac99af7dbb12
master_process on;
worker_processes 1;
error_log logs/error.log warn;
pid logs/nginx.pid;
worker_rlimit_nofile 20480;
events {
View gist:e3e3e0866309e8cc2f57ad743bb09b54
rain@MBPro  ~/Downloads/lua-resty-libr3   master ✔ 
$ make
git clone -b 2.0.2-iresty https://github.com/iresty/r3.git
Cloning into 'r3'...
remote: Enumerating objects: 29, done.
remote: Counting objects: 100% (29/29), done.
remote: Compressing objects: 100% (19/19), done.
remote: Total 4308 (delta 14), reused 18 (delta 10), pack-reused 4279
Receiving objects: 100% (4308/4308), 1.42 MiB | 548.00 KiB/s, done.
Resolving deltas: 100% (3041/3041), done.
View gist:f0e914f37cc23de64e7c9b2a07d96799
[root@iZ8vbhq8oa47y8mscofouwZ apisix]# ./benchmark/run.sh
+ '[' -n '' ']'
+ worker_cnt=1
+ mkdir -p benchmark/server/logs
+ mkdir -p benchmark/fake-apisix/logs
+ sudo openresty -p /root/apisix/benchmark/server
+ trap onCtrlC INT
+ sed -i 's/worker_processes [0-9]*/worker_processes 1/g' conf/nginx.conf
+ make run
mkdir -p logs
View gist:f6ad71ebafc39d70b7be07b467ecc75a
local json_encode = require("cjson.safe").encode
local clear_tab = require("table.clear")
local tostring = tostring
local type = type
local pairs = pairs
local cached_tab = {}
local _M = {
version = 0.1,
View gist:1cd270f98a130596ac07405168f67178
{
"node": {
"nodes": [{
"value": {
"upstream": {
"nodes": {
"127.0.0.1:1980": 1
},
"type": "roundrobin"
},
View gist:a63aa0e5771f118e0cfb848e2214acb0
=== TEST 1: set route(id: 1)
--- config
location /t {
content_by_lua_block {
local t = require("lib.test_admin").test
local code, body = t('/apisix/admin/routes/1',
ngx.HTTP_PUT,
[[{
"methods": ["GET"],
"upstream": {
@membphis
membphis / gist:05064f2edc6fb4081c6af04fac43ba49
Created Jul 3, 2019
benchmark apisix 0.5 with fake apisix server
View gist:05064f2edc6fb4081c6af04fac43ba49
# ./benchmark/run.sh
+ '[' -n '' ']'
+ worker_cnt=1
+ mkdir -p benchmark/server/logs
+ mkdir -p benchmark/fake-apisix/logs
+ sudo openresty -p /root/apisix/benchmark/server
+ trap onCtrlC INT
+ sed -i 's/worker_processes [0-9]*/worker_processes 1/g' conf/nginx.conf
+ make run
mkdir -p logs
View gist:f1960fd8ef7c93781a97545fa8ff8812
机器配置:macbook pro 15寸,4core/8thread i7 cpu,内存 8G。
先贴上单独用 wrk 压测结果(此时 nginx 的4个 worker 是处于 100% 工作状态)。
$ wrk -d 10 -t 4 -c 1000 --latency http://test.com/
Running 10s test @ http://test.com/
4 threads and 1000 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 162.01ms 308.50ms 1.98s 84.93%
Req/Sec 10.61k 1.43k 15.45k 68.50%
View gist:88b8809dc997d6ba406dc667b0337179
# vim:set ft= ts=4 sw=4 et fdm=marker:
use lib 'lib';
use Test::Nginx::Socket::Lua;
use Cwd qw(cwd);
workers(5);
#worker_connections(1014);
master_process_enabled(1);
#log_level('warn');