Skip to content

Performance analysis #1499

@j00101162

Description

@j00101162

The network topology looks like this:
HTTP client ------- APISIX ------- HTTP server
The HTTP client and APISIX are running on the same host, the HTTP server uses the httpbin package. Coraza runs inside a WebAssembly virtual machine via Proxy-Wasm.

APISIX hardware information looks like this:
Memory: 32GB
CPU: Intel(R) Xeon(R) CPU E5-2640 v4 @ 2.40GHz

The config looks like this, has 669 rules:
"Include @owasp_rules_conf/modconf1.conf",
"SecDebugLogLevel 2",
"SecRuleEngine detectiononly",
......

The test command looks like this:
wrk -t2 -c10 -d60s --latency http://x.x.x.x/status/200

Performance test data looks like this:
Image

After enabling the security rules, the performance drops to 1/10 of the original level, which is a severe performance degradation
(1376.39 * 100%) / 356.15 / 40% = 9.66

The Flame Graph looks like this:
Image

Based on the flame graph analysis, wasmtime_setjmp accounts for 72.49%, indicating a large amount of context switching between the host and the virtual machine. How can this be optimized?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions