Skip to content

Instantly share code, notes, and snippets.

> wrk -c 20 -d 60 http://localhost:3000
Running 1m test @ http://localhost:3000
2 threads and 20 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 798.91us 410.05us 16.46ms 98.70%
Req/Sec 12.88k 2.37k 17.12k 55.24%
1540481 requests in 1.00m, 110.18MB read
Requests/sec: 25632.06
Transfer/sec: 1.83MB
data = cbor.dumps([(200, 'OK'), headers, body])
dll.stator_http_reply(request['response_socket'], data, len(data))
dll = ctypes.find_library('libstator.so')
message_parser = CFUNCTYPE(py_object, c_uint64, c_void_p, c_size_t)
@message_parser
def parse_message(sock_id, buf, buf_len):
buf = BytesIO((c_uint8 * buf_len).from_address(buf))
return cbor.load(buf)
while True:
message = dll.stator_wait_message(_parse_message)
> ~/wrk -t 2 -c 20 -d 60 http://localhost:3000
Running 1m test @ http://localhost:3000
2 threads and 20 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 1.00ms 139.67us 4.67ms 83.31%
Req/Sec 10.01k 1.13k 11.34k 78.45%
1196618 requests in 1.00m, 107.35MB read
Requests/sec: 19910.54
Transfer/sec: 1.79MB
> ~/wrk -t 2 -c 20 -d 60 http://localhost:3000
Running 1m test @ http://localhost:3000
2 threads and 20 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 256.92us 17.19us 1.21ms 97.81%
Req/Sec 39.03k 1.86k 78.38k 97.59%
4665395 requests in 1.00m, 333.70MB read
Requests/sec: 77627.17
Transfer/sec: 5.55MB
> ~/wrk -t 2 -c 20 -d 60 http://localhost:3000
Running 1m test @ http://localhost:3000
2 threads and 20 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 0.99ms 77.49us 4.23ms 94.58%
Req/Sec 10.16k 607.35 20.74k 93.26%
1213859 requests in 1.00m, 108.91MB read
Requests/sec: 20197.32
Transfer/sec: 1.81MB
> ~/wrk -t 2 -c 20 -d 60 http://localhost:3000
Running 1m test @ http://localhost:3000
2 threads and 20 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 268.38us 21.87us 1.29ms 96.83%
Req/Sec 37.38k 1.44k 40.39k 91.17%
4462957 requests in 1.00m, 319.22MB read
Requests/sec: 74382.24
Transfer/sec: 5.32MB
stator [ 2 metrics/ 1 sec]: 0.00049 0.00040 0.00027 0.00027 0.00024 0.00024
stator [ 4 metrics/ 1 sec]: 0.00051 0.00035 0.00038 0.00066 0.00048 0.00055
stator [ 10 metrics/ 1 sec]: 0.00083 0.00063 0.00056 0.00082 0.00087 0.00060
stator [ 20 metrics/ 1 sec]: 0.00110 0.00107 0.00057 0.00055 0.00116 0.00120
stator [200 metrics/ 1 sec]: 0.00489 0.00352 0.00347 0.00385 0.00347 0.00352
stator [ 2 metrics/60 sec]: 0.00039 0.00032 0.00034 0.00043 0.00030 0.00044
graphiti [ 2 metrics/ 1 sec]: 0.00720 0.00588 0.00556 0.00590 0.00551 0.00602
graphiti [ 4 metrics/ 1 sec]: 0.00626 0.00572 0.00544 0.00417 0.00520 0.00563
graphiti [ 10 metrics/ 1 sec]: 0.00729 0.00577 0.00647 0.00575 0.00634 0.00517
graphiti [ 20 metrics/ 1 sec]: 0.00699 0.00622 0.00587 0.00629 0.00624 0.00604
while True:
v1 = random.randrange(10, 100)
v2 = random.randrange(100, 1000)/10.0
start = clock()
carbon.add("py.stator.random.int", v1)
carbon.add("py.stator.random.float", v2)
sleep(1)
end = clock()
print(format(end - start, '0.5f'))
[pid 21145] 00:42:22.812966 select(0, NULL, NULL, NULL, {1, 0} <unfinished ...>
[pid 21146] 00:42:22.813150 epoll_wait(3, <unfinished ...>
[pid 21145] 00:42:23.814146 <... select resumed> ) = 0 (Timeout)
[pid 21145] 00:42:23.814305 clock_gettime(CLOCK_PROCESS_CPUTIME_ID, {0, 28021316}) = 0
[pid 21145] 00:42:23.814508 write(5, "0x01", 4) = 4
[pid 21146] 00:42:23.814575 <... epoll_wait resumed> {{EPOLLIN, {u32=4294967295, u64=18446744073709551615}}}, 1024, -1) = 1
[pid 21146] 00:42:23.814604 read(4, "0x01", 128) = 4
[pid 21146] 00:42:23.814636 read(4, 0x7f235e8a7030, 128) = -1 EAGAIN (Resource temporarily unavailable)
[pid 21145] 00:42:23.814663 clock_gettime(CLOCK_PROCESS_CPUTIME_ID, <unfinished ...>
[pid 21146] 00:42:23.814674 sendto(6, "py.stator.random.int 15 1455144143\npy.stator.random.float 46.7 1455144143\n", 74, 0, NULL, 0 <unfinished