Skip to main content

chunli

chunli

Distributed load test application


Documentation: https://dutradda.github.io/chunli

Source Code: https://github.com/dutradda/chunli


Key Features

  • Distributed load test application
  • Receive file with urls
  • Receive file with json lines
  • Receive python scripts *

* feature in development.

Requirements

  • Python 3.8+

Instalation

$ pip install chunli

Basic Example

Running the server (needs uvicorn installed):

uvicorn chunli:app

Create chunli's input file (needs gzip installed):

echo http://localhost:8001/hello | gzip > /tmp/hello-call.gz

zcat /tmp/hello-call.gz

Start chunli's job (needs curl installed):

curl -X POST \
    -i 'http://localhost:8000/run?duration=3&rps_per_node=1' \
    --upload-file /tmp/hello-call.gz
HTTP/1.1 100 Continue

HTTP/1.1 202 Accepted
date: Thu, 1st January 1970 00:00:00 GMT
server: uvicorn
content-type: application/json
content-length: 159

{"task_id":"4ee301eb-6487-48a0-b6ed-e5f576accfc2","start_time":"1970-01-01T00:00:00+00:00","status":"running","signature":"73b40a62fb5e","args_signature":null}

Gets chunli's job results:

sleep 5 && \
    curl -i 'http://localhost:8000/run?task_id=4ee301eb-6487-48a0-b6ed-e5f576accfc2'
HTTP/1.0 200 OK
date: Thu, 1st January 1970 00:00:00 GMT
server: uvicorn
content-type: application/json
content-length: 409

{"end_time":"1970-01-01T00:00:00+00:00","result":{"duration":1.0,"rampup_time":0,"requested_rps_per_node":1.0,"realized_requests":1.0,"realized_rps":1.0,"latency":{"mean":1.0,"median":1.0,"percentile99":1.0,"percentile95":1.0},"error":null,"nodes_quantity":1,"errors_count":0},"task_id":"4ee301eb-6487-48a0-b6ed-e5f576accfc2","start_time":"1970-01-01T00:00:00+00:00","status":"finished","signature":"73b40a62fb5e","args_signature":null}

Ramp-up Example

Running the server

uvicorn chunli:app

Create chunli's input file:

echo http://localhost:8001/hello | gzip > /tmp/hello-call.gz

zcat /tmp/hello-call.gz

Start chunli's job:

curl -X POST \
    -i 'http://localhost:8000/run?duration=10&rps_per_node=10&rampup_time=5' \
    --upload-file /tmp/hello-call.gz
HTTP/1.1 100 Continue

HTTP/1.1 202 Accepted
date: Thu, 1st January 1970 00:00:00 GMT
server: uvicorn
content-type: application/json
content-length: 159

{"task_id":"4ee301eb-6487-48a0-b6ed-e5f576accfc2","start_time":"1970-01-01T00:00:00+00:00","status":"running","signature":"73b40a62fb5e","args_signature":null}

Gets chunli's job results:

sleep 12 && \
    curl -i 'http://localhost:8000/run?task_id=4ee301eb-6487-48a0-b6ed-e5f576accfc2'
HTTP/1.0 200 OK
date: Thu, 1st January 1970 00:00:00 GMT
server: uvicorn
content-type: application/json
content-length: 409

{"end_time":"1970-01-01T00:00:00+00:00","result":{"duration":10.0,"rampup_time":5,"requested_rps_per_node":10.0,"realized_requests":73.0,"realized_rps":7.3,"latency":{"mean":1.0,"median":1.0,"percentile99":1.0,"percentile95":1.0},"error":null,"nodes_quantity":1,"errors_count":0},"task_id":"4ee301eb-6487-48a0-b6ed-e5f576accfc2","start_time":"1970-01-01T00:00:00+00:00","status":"finished","signature":"73b40a62fb5e","args_signature":null}

Json Lines Example

Running the server:

uvicorn chunli:app

Create chunli's input file:

echo '{"url":"http://localhost:8001/hello"}
{"url":"http://localhost:8001/hello","method":"GET"}' \
    | gzip > /tmp/hello-call.gz

zcat /tmp/hello-call.gz

Start chunli's job:

curl -X POST \
    -i 'http://localhost:8000/run?duration=1&rps_per_node=10' \
    --upload-file /tmp/hello-call.gz
HTTP/1.1 100 Continue

HTTP/1.1 202 Accepted
date: Thu, 1st January 1970 00:00:00 GMT
server: uvicorn
content-type: application/json
content-length: 159

{"task_id":"4ee301eb-6487-48a0-b6ed-e5f576accfc2","start_time":"1970-01-01T00:00:00+00:00","status":"running","signature":"73b40a62fb5e","args_signature":null}

Gets chunli's job results:

sleep 3 && \
    curl -i 'http://localhost:8000/run?task_id=4ee301eb-6487-48a0-b6ed-e5f576accfc2'
HTTP/1.0 200 OK
date: Thu, 1st January 1970 00:00:00 GMT
server: uvicorn
content-type: application/json
content-length: 409

{"end_time":"1970-01-01T00:00:00+00:00","result":{"duration":1.0,"rampup_time":0,"requested_rps_per_node":1.0,"realized_requests":1.0,"realized_rps":1.0,"latency":{"mean":1.0,"median":1.0,"percentile99":1.0,"percentile95":1.0},"error":null,"nodes_quantity":1,"errors_count":0},"task_id":"4ee301eb-6487-48a0-b6ed-e5f576accfc2","start_time":"1970-01-01T00:00:00+00:00","status":"finished","signature":"73b40a62fb5e","args_signature":null}

Json Array Lines Example

Running the server:

uvicorn chunli:app

Create chunli's input file:

echo '[{"url":"http://localhost:8001/hello"}]
[{"url":"http://localhost:8001/hello","method":"GET"}]
' \
    | gzip > /tmp/hello-call.gz

zcat /tmp/hello-call.gz

Start chunli's job:

curl -X POST \
    -i 'http://localhost:8000/run?duration=1&rps_per_node=10' \
    --upload-file /tmp/hello-call.gz
HTTP/1.1 100 Continue

HTTP/1.1 202 Accepted
date: Thu, 1st January 1970 00:00:00 GMT
server: uvicorn
content-type: application/json
content-length: 159

{"task_id":"4ee301eb-6487-48a0-b6ed-e5f576accfc2","start_time":"1970-01-01T00:00:00+00:00","status":"running","signature":"73b40a62fb5e","args_signature":null}

Gets chunli's job results:

sleep 3 && \
    curl -i 'http://localhost:8000/run?task_id=4ee301eb-6487-48a0-b6ed-e5f576accfc2'
HTTP/1.0 200 OK
date: Thu, 1st January 1970 00:00:00 GMT
server: uvicorn
content-type: application/json
content-length: 409

{"end_time":"1970-01-01T00:00:00+00:00","result":{"duration":1.0,"rampup_time":0,"requested_rps_per_node":1.0,"realized_requests":1.0,"realized_rps":1.0,"latency":{"mean":1.0,"median":1.0,"percentile99":1.0,"percentile95":1.0},"error":null,"nodes_quantity":1,"errors_count":0},"task_id":"4ee301eb-6487-48a0-b6ed-e5f576accfc2","start_time":"1970-01-01T00:00:00+00:00","status":"finished","signature":"73b40a62fb5e","args_signature":null}

Python Script Example

Running the server:

uvicorn chunli:app

Create chunli's input script:

# /tmp/get_calls_block.py

from typing import Generator

from chunli.call import Call


global get_calls_block


def get_calls_block() -> Generator[Call, None, None]:
    yield Call(
        url='http://localhost:8001/hello',
        method='GET',
        headers=None,
        body=None,
    )

Start chunli's job:

curl -X POST \
    -i 'http://localhost:8000/script?duration=1&rps_per_node=10' \
    --upload-file /tmp/get_calls_block.py
HTTP/1.1 100 Continue

HTTP/1.1 202 Accepted
date: Thu, 1st January 1970 00:00:00 GMT
server: uvicorn
content-type: application/json
content-length: 159

{"task_id":"4ee301eb-6487-48a0-b6ed-e5f576accfc2","start_time":"1970-01-01T00:00:00+00:00","status":"running","signature":"0ecc7ebf73bc","args_signature":null}

Gets chunli's job results:

sleep 3 && \
    curl -i 'http://localhost:8000/script?task_id=4ee301eb-6487-48a0-b6ed-e5f576accfc2'
HTTP/1.0 200 OK
date: Thu, 1st January 1970 00:00:00 GMT
server: uvicorn
content-type: application/json
content-length: 409

{"end_time":"1970-01-01T00:00:00+00:00","result":{"duration":1.0,"rampup_time":0,"requested_rps_per_node":1.0,"realized_requests":1.0,"realized_rps":1.0,"latency":{"mean":1.0,"median":1.0,"percentile99":1.0,"percentile95":1.0},"error":null,"nodes_quantity":1,"errors_count":0},"task_id":"4ee301eb-6487-48a0-b6ed-e5f576accfc2","start_time":"1970-01-01T00:00:00+00:00","status":"finished","signature":"0ecc7ebf73bc","args_signature":null}

Python Script With Body Example

Running the server:

uvicorn chunli:app

Create chunli's input script:

# /tmp/get_calls_block_body.py

from typing import Generator

from chunli.call import Call


global get_calls_block


def get_calls_block() -> Generator[Call, None, None]:
    yield Call(
        url='http://localhost:8001/hello-body',
        method='POST',
        headers=None,
        body={'name': 'Me!'},
    )

Start chunli's job:

curl -X POST \
    -i 'http://localhost:8000/script?duration=1&rps_per_node=10' \
    --upload-file /tmp/get_calls_block_body.py
HTTP/1.1 100 Continue

HTTP/1.1 202 Accepted
date: Thu, 1st January 1970 00:00:00 GMT
server: uvicorn
content-type: application/json
content-length: 159

{"task_id":"4ee301eb-6487-48a0-b6ed-e5f576accfc2","start_time":"1970-01-01T00:00:00+00:00","status":"running","signature":"0ecc7ebf73bc","args_signature":null}

Gets chunli's job results:

sleep 3 && \
    curl -i 'http://localhost:8000/script?task_id=4ee301eb-6487-48a0-b6ed-e5f576accfc2'
HTTP/1.0 200 OK
date: Thu, 1st January 1970 00:00:00 GMT
server: uvicorn
content-type: application/json
content-length: 409

{"end_time":"1970-01-01T00:00:00+00:00","result":{"duration":1.0,"rampup_time":0,"requested_rps_per_node":1.0,"realized_requests":1.0,"realized_rps":1.0,"latency":{"mean":1.0,"median":1.0,"percentile99":1.0,"percentile95":1.0},"error":null,"nodes_quantity":1,"errors_count":0},"task_id":"4ee301eb-6487-48a0-b6ed-e5f576accfc2","start_time":"1970-01-01T00:00:00+00:00","status":"finished","signature":"0ecc7ebf73bc","args_signature":null}

Metadata

Release files for chunli 0.11.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for chunli 0.11.3
File Size Uploaded
chunli-0.11.3.tar.gz 336.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for chunli 0.11.3
File Interpreter ABI Platform
chunli-0.11.3-py3-none-any.whl Python 3 none any Details

Total release size: 344.9 kB

Release files / chunli-0.11.3.tar.gz

Download URL chunli-0.11.3.tar.gz
Size 336.9 kB
Tags Source
SHA-256 checksum
How to use checksums
59f0926ba35928e2fcce599d085f39ccabd43a6e4facff8cd19a8d47f2feba2b
BLAKE2b-256 checksum
How to use checksums
b959901e1ca2c302320b249b80393d523812830644c8d948356fed289ba02655
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.23.0

Release files / chunli-0.11.3-py3-none-any.whl

Download URL chunli-0.11.3-py3-none-any.whl
Size 8.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0a66a1346907bfab02c100bef21a1d1eaf44bf316b81a6b5306f91ab20b45a05
BLAKE2b-256 checksum
How to use checksums
5d2309718e51c02708b78f95970366d1d79dfc788cf205909787ec336f7f4b77
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.23.0

Release history Release notifications | RSS feed

This release

0.11.3 This release

2 release files

0.10.4

2 release files

0.10.3

2 release files

0.10.2

2 release files

0.10.1

2 release files

0.9.0

2 release files

0.8.0

2 release files

0.7.0

2 release files

0.6.0

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page