Skip to content

perf(mobile): reuse dev reqwest client#15444

Merged
Legend-Master merged 1 commit into
tauri-apps:devfrom
Legend-Master:reuse-mobile-dev-reqwest-client
May 29, 2026
Merged

perf(mobile): reuse dev reqwest client#15444
Legend-Master merged 1 commit into
tauri-apps:devfrom
Legend-Master:reuse-mobile-dev-reqwest-client

Conversation

@Legend-Master
Copy link
Copy Markdown
Contributor

@Legend-Master Legend-Master commented May 28, 2026

Reference #14097

This allows the reqwest connection pool to work and making thing a lot faster. I still don't quite understand why it takes so much time on the first request though (close to 1 sec to me)

Example timing logs on Android emulator:

05-28 10:05:00.752  7952  8008 I RustStdoutStderr: [tauri/crates/tauri/src/protocol/tauri.rs:209:3] now.elapsed() = 686.1753ms
05-28 10:05:01.231  7952  8008 I RustStdoutStderr: [tauri/crates/tauri/src/protocol/tauri.rs:209:3] now.elapsed() = 12.1876ms
05-28 10:05:01.634  7952  8008 I RustStdoutStderr: [tauri/crates/tauri/src/protocol/tauri.rs:209:3] now.elapsed() = 13.5335ms
05-28 10:05:01.946  7952  8008 I RustStdoutStderr: [tauri/crates/tauri/src/protocol/tauri.rs:209:3] now.elapsed() = 8.8892ms

@Legend-Master Legend-Master requested a review from a team as a code owner May 28, 2026 08:24
@github-actions
Copy link
Copy Markdown
Contributor

Package Changes Through 4e01525

There are 3 changes which include tauri-utils with patch, tauri-bundler with patch, tauri with patch

Planned Package Versions

The following package releases are the planned based on the context of changes in this pull request.

package current next
tauri-utils 2.9.2 2.9.3
tauri-bundler 2.9.2 2.9.3
tauri-runtime 2.11.2 2.11.3
tauri-runtime-wry 2.11.2 2.11.3
tauri-codegen 2.6.2 2.6.3
tauri-macros 2.6.2 2.6.3
tauri-plugin 2.6.2 2.6.3
tauri-build 2.6.2 2.6.3
tauri 2.11.2 2.11.3
@tauri-apps/cli 2.11.2 2.11.3
tauri-cli 2.11.2 2.11.3

Add another change file through the GitHub UI by following this link.


Read about change files or the docs at github.com/jbolda/covector

@Legend-Master
Copy link
Copy Markdown
Contributor Author

@DeTeam Hey, could you help give this change a try see if it improves the situation a bit?

From some investigation, the time was mostly spent in the request, and each one taking 500-1000ms like you mentioned in #15071, I still don't quite understand why since it doesn't happen in the emulator's browser, but this change at least helped with the subsequent requests

@FabianLars
Copy link
Copy Markdown
Member

I still don't quite understand why it takes so much time on the first request though (close to 1 sec to me)

Maybe cause it's a debug build? I could imagine that there's something funny in the clientbuilder in debug builds

@Legend-Master
Copy link
Copy Markdown
Contributor Author

I still don't quite understand why it takes so much time on the first request though (close to 1 sec to me)

Maybe cause it's a debug build? I could imagine that there's something funny in the clientbuilder in debug builds

Doesn't seem to be the case? I have tried with

[profile.dev.package.reqwest]
debug-assertions = false

[profile.dev.package.hyper]
debug-assertions = false

[profile.dev.package.tokio]
debug-assertions = false

[profile.dev.package.mio]
debug-assertions = false

no differences

When I enable tracing on hyper, I do see a big gap between

2026-05-28 14:59:40.213  4484-4601  hyper::proto::h1::conn  com.tauri.api                        V  [hyper::proto::h1::conn] flushed({role=client}): State { reading: Init, writing: KeepAlive, keep_alive: Busy }
2026-05-28 14:59:40.721  4484-4598  hyper::proto::h1::conn  com.tauri.api                        V  [hyper::proto::h1::conn] Conn::read_head

not sure what's in between though, the only hint I got is seanmonstar/reqwest#1116 (comment)

@FabianLars
Copy link
Copy Markdown
Member

I don't want to waste your time but how about testing non-hyper clients (ureq?) to see if it's maybe the server's fault or maybe some weird layer in android?

Since the use-case here is pretty simple i wanted to rewrite it to use hyper directly a while ago but not so sure now 😅 unless it's reqwest and not hyper 🤔

@Legend-Master
Copy link
Copy Markdown
Contributor Author

Legend-Master commented May 28, 2026

Just tried with ureq, results were pretty much the same (500ms-1000ms)

@Legend-Master Legend-Master merged commit 800eade into tauri-apps:dev May 29, 2026
19 checks passed
@Legend-Master Legend-Master deleted the reuse-mobile-dev-reqwest-client branch May 29, 2026 01:32
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

Successfully merging this pull request may close these issues.

2 participants