Skip to content

Latest commit

 

History

History
188 lines (137 loc) · 2.61 KB

README_EN.md

File metadata and controls

188 lines (137 loc) · 2.61 KB

中文 | English

Apirec

A simple api record tool

Philosophy

  • Fast
  • Lightweight
  • Single file
  • Persistence

Deploy

Just download the executable file and run it directly

Interface

Adding App

address: 127.0.0.1:8000/api

method: POST

params:

{
    "app": "test1"
}

Sample returns:

{
    "code": 0,
    "msg": "success",
    "data": "Add app success"
}

Adding an Api to an App

address: 127.0.0.1:8000/api/test1

method: POST

params:

{
    "api": "ttt1"
}

Sample returns:

{
    "code": 0,
    "msg": "success",
    "data": "Success"
}

Adding Api Call Records

address: 127.0.0.1:8000/api/test1/ttt1

method: POST

params: None

Sample returns:

{
    "code": 0,
    "msg": "success",
    "data": 2498788
}

Get Api call records

address: 127.0.0.1:8000/api/test1/ttt1

method: GET

params: None

Sample returns:

{
    "code": 0,
    "msg": "success",
    "data": 2498788
}

Get all Api call records under App

address: 127.0.0.1:8000/api/test1

method: GET

params:

{
    "limit": 2,
    "sort": true,
    "apis": ["ttt1", "ttt2"]
}
  • limit: Limit the number of return items
  • sort: Sort or not
  • apis: Specify the api to be returned

Sample returns:

{
    "code": 0,
    "msg": "success",
    "data": {
        "total": 2498788,
        "apis": [
            {
                "api": "ttt1",
                "count": 2498788
            },
            {
                "api": "ttt2",
                "count": 0
            }
        ]
    }
}

Configuration

server_name = "apirec"
port = 8000
log_level = "info"
# day, hour, minute
log_split = "day"
# Sync interval (sec)
sync_interval = 30

Benchmarking

No suitable test method has been found, and the results on my laptop so far are as follows

  • CPU 12th Gen Intel(R) Core(TM) i7-1255U
  • Memory 16G 4267MHz LPDDR4x
.\rsb.exe -l -m POST -d 10  http://127.0.0.1:8000/api/test1/ttt1
Post "http://127.0.0.1:8000/api/test1/ttt1" with for 10s using 50 connections
▪▪▪▪▪ [00:00:10] [####################] 10s/10s (100%)
Statistics         Avg          Stdev          Max
  Reqs/sec       86257.56      1482.19       88056.00
  Latency        575.64µs      148.94µs       4.09ms
  Latency Distribution
     50%     460.55µs
     75%     510.74µs
     90%     543.59µs
     99%     570.45µs
  HTTP codes:
    1XX - 0, 2XX - 859995, 3XX - 0, 4XX - 0, 5XX - 0
    others - 0
  Throughput:   86859.69/s

Average of 8.6 million requests per second

License

MIT License