mirror of
https://github.com/mailscope/kumomta.git
synced 2026-09-10 12:32:13 +00:00
Explicitly spawn via the main tokio runtime when starting the http listener for TSA, so that the tasks spawned by axum are also spawned there. Previously, it would stick to whichever localset thread was used for initializing the lua context, constraining all http request decoding and dispatching to that same thread. With this change in place, in the NOP (stale log record) case I can get 180k qps, this is likely as fast as it will go on this particular machine, as it is 100% CPU bound on all cores. With a current log record I can get 90k qps. In that case, the sqlite performance is the limiting factor and the cores are around 70-80% saturated. For comparison, the rate I get with 2024.11.22-17fafff1 is 27k qps, so this series of commits overall represents a 3.3x improvement in performance. Note that the http server spawning change may also benefit kumod's http injection API. I deliberately left that as it was because it is worth being deliberate about benchmarking that before just shipping the same change--kumod has an http injection pool to explicitly manage performance and care should be taken to evaluate the impact on that.
59 lines
1.4 KiB
JavaScript
59 lines
1.4 KiB
JavaScript
// This is a k6 script that can be used to test the tsa-daemon publish endpoint
|
|
import http from "k6/http";
|
|
import encoding from "k6/encoding";
|
|
import { check } from "k6";
|
|
|
|
export const options = {
|
|
// How many concurrent connections should be established
|
|
vus: 100,
|
|
// How long the test should run for
|
|
duration: '30s',
|
|
};
|
|
|
|
export default function () {
|
|
const url = "http://127.0.0.1:8008/publish_log_v1";
|
|
|
|
const now = Math.floor(Date.now()/1000);
|
|
|
|
const content = {
|
|
"type": "TransientFailure",
|
|
"id": "1d98076abbbc11ed940250ebf67f93bd",
|
|
"sender": "user@example.com",
|
|
"recipient": "user@yahoo.com",
|
|
"queue": "something",
|
|
"site": "unspecified->(mta5|mta6|mta7).am0.yahoodns.net",
|
|
"size": 1024,
|
|
"response": {
|
|
"code": 421,
|
|
"enhanced_code": {
|
|
"class": 4,
|
|
"subject": 7,
|
|
"detail": 0
|
|
},
|
|
"content": "[TSS04] Messages from a.b.c.d temporarily deferred due to user complaints",
|
|
"command": "."
|
|
},
|
|
"timestamp": now,
|
|
"created": now,
|
|
"num_attempts": 1,
|
|
"bounce_classification": "Uncategorized",
|
|
"meta": {},
|
|
"headers": {},
|
|
"nodeid": "557f3ad4-2c8c-11ee-976e-782d7e12e173",
|
|
}
|
|
|
|
const payload = JSON.stringify(content);
|
|
|
|
const params = {
|
|
headers: {
|
|
"Content-Type": "application/json",
|
|
},
|
|
};
|
|
|
|
let response = http.post(url, payload, params);
|
|
// console.log(response);
|
|
check(response, {
|
|
"is status 200": (r) => r.status === 200,
|
|
});
|
|
}
|