Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

performance: find a way to stream the body into the parser #88

Open
syphar opened this issue Feb 20, 2023 · 4 comments
Open

performance: find a way to stream the body into the parser #88

syphar opened this issue Feb 20, 2023 · 4 comments

Comments

@syphar
Copy link
Member

syphar commented Feb 20, 2023

with ~150 lines of logs we "only" get around 2k RPS, with an empty body we get 50k RPS for the web-server component.

I'm not sure if this is possible with axum, but it would be good if we wouldn't need to convert the body to a byte buffer in the web handler.

So either pass the body to the background task and buffer it there, or even convert the parser into a streaming parser.

@syphar
Copy link
Member Author

syphar commented Feb 20, 2023

-- wrk.lua 
wrk.method = "POST"
wrk.body = [[
473 <131>1 2023-02-20T07:16:58+00:00 host app postgres.2595527 - [DATABASE] [10-1]  sql_error_code = 28000 time_ms = "2023-02-20 07:16:58.219 UTC" pid="2105602" proc_start_time="2023-02-20 07:16:58 UTC" session_id="63f31e6a.202102" vtid="2/2324671" tid="0" log_line="2" database="postgres" connection_source="110.87.46.194(52440)" user="postgres" application_name="[unknown]" FATAL:  no pg_hba.conf entry for host "110.87.46.194", user "postgres", database "postgres", SSL off
]]

wrk.headers["logplex-drain-token"] = "logplex_token"

then run wrk http://localhost:3000 -s wrk.lua -t24 -c24 -d30s

@syphar
Copy link
Member Author

syphar commented Feb 20, 2023

just did a short test that reads the body in the async task, this directly doesn't help.

Probably we need to combine this with the BodyStream extractor

@syphar
Copy link
Member Author

syphar commented Feb 20, 2023

BodyStream also doesn't make it faster, the reason has to be somewhere else.

@syphar
Copy link
Member Author

syphar commented Feb 20, 2023

( there is also a chance that wrk is slow?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant