Skip to content

perf: Interrupt stats ticker and throttle mvds on messenger.pause#7440

Merged
alaibe merged 1 commit into
release/10.34.xfrom
perf/pause-non-critical-work
May 18, 2026
Merged

perf: Interrupt stats ticker and throttle mvds on messenger.pause#7440
alaibe merged 1 commit into
release/10.34.xfrom
perf/pause-non-critical-work

Conversation

@alexjba
Copy link
Copy Markdown
Contributor

@alexjba alexjba commented May 12, 2026

This commit aims to fix 2 issues identified on Android. While the messenger is paused we're still receiving lots of stat update events. These events will queue until the app is back into foreground and flood the app when changing state.

The second issue is with one of the mvds epoch goroutine. Every 300ms mvds will send messages and write an epoch to DB. This prevents the device from going into deep sleep and has a big impact on battery.

This commit stops the stats retrieval while paused - it's not used anyways. And throttles the mvds datasync to 5 minutes. This means that the ack is confirmed once every 5 minutes (as opposed to 300ms) while paused. Message sending is also disabled in this time frame.

status-im/status-app#20742

Status app PR status-im/status-app#20882

@alexjba alexjba force-pushed the perf/pause-non-critical-work branch from 033cd05 to 8426883 Compare May 12, 2026 15:17
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 12, 2026

⚠️ Companion PR Needs Update

#20882 is not using the latest status-go commit (bba1855e522df626cb9d6c0336b3ddf7a67c9801).

Update vendor/status-go in the companion PR.

@status-im-auto
Copy link
Copy Markdown
Member

status-im-auto commented May 12, 2026

Jenkins Builds

Click to see older builds (28)
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ 8426883 1 2026-05-12 15:21:40 ~4 min linux/status-go 📦zip
✔️ 8426883 1 2026-05-12 15:22:11 ~4 min macos/status-go 📦zip
✔️ 8426883 1 2026-05-12 15:23:18 ~5 min windows/status-go 📦zip
✔️ 8426883 1 2026-05-12 15:32:47 ~15 min tests-rpc 📄log
✔️ 8426883 1 2026-05-12 15:51:13 ~33 min tests 📄log
✔️ b21fce9 2 2026-05-12 15:29:36 ~4 min linux/status-go 📦zip
✔️ b21fce9 2 2026-05-12 15:30:01 ~4 min macos/status-go 📦zip
✔️ b21fce9 2 2026-05-12 15:47:17 ~14 min tests-rpc 📄log
✔️ b21fce9 2 2026-05-12 15:51:22 ~25 min windows/status-go 📦zip
✔️ b21fce9 2 2026-05-12 16:25:38 ~34 min tests 📄log
✔️ f47a616 3 2026-05-13 07:54:59 ~3 min linux/status-go 📦zip
✔️ f47a616 3 2026-05-13 07:55:46 ~4 min macos/status-go 📦zip
✔️ f47a616 3 2026-05-13 07:56:44 ~5 min windows/status-go 📦zip
✔️ f47a616 3 2026-05-13 08:06:13 ~14 min tests-rpc 📄log
✔️ f47a616 3 2026-05-13 08:24:38 ~33 min tests 📄log
✔️ d982c7b 4 2026-05-14 17:33:56 ~3 min linux/status-go 📦zip
✔️ d982c7b 4 2026-05-14 17:34:42 ~4 min macos/status-go 📦zip
✔️ d982c7b 4 2026-05-14 17:35:46 ~5 min windows/status-go 📦zip
✔️ d982c7b 4 2026-05-14 17:45:24 ~15 min tests-rpc 📄log
✔️ d982c7b 4 2026-05-14 18:04:32 ~34 min tests 📄log
✔️ 1b72e37 5 2026-05-15 06:34:36 ~4 min linux/status-go 📦zip
✔️ 1b72e37 5 2026-05-15 06:34:38 ~4 min macos/status-go 📦zip
✔️ 1b72e37 5 2026-05-15 06:36:40 ~6 min windows/status-go 📦zip
✔️ 1b72e37 5 2026-05-15 06:44:53 ~14 min tests-rpc 📄log
✔️ 1b72e37 5 2026-05-15 07:03:49 ~33 min tests 📄log
✔️ 7cab48c 6 2026-05-17 10:33:34 ~4 min macos/status-go 📦zip
✔️ 7cab48c 6 2026-05-17 10:35:05 ~5 min windows/status-go 📦zip
✔️ 7cab48c 6 2026-05-17 10:44:18 ~14 min linux/status-go 📦zip
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ a6d3f65 7 2026-05-18 06:04:35 ~4 min macos/status-go 📦zip
✔️ a6d3f65 7 2026-05-18 06:05:39 ~5 min windows/status-go 📦zip
✔️ a6d3f65 7 2026-05-18 06:14:15 ~14 min linux/status-go 📦zip
✔️ a6d3f65 8 2026-05-18 07:53:22 ~33 min tests 📄log
✔️ a6d3f65 8 2026-05-18 09:18:18 ~19 min tests-rpc 📄log
✔️ bba1855 8 2026-05-18 10:25:52 ~4 min linux/status-go 📦zip
✔️ bba1855 8 2026-05-18 10:26:10 ~4 min macos/status-go 📦zip
✔️ bba1855 8 2026-05-18 10:26:57 ~5 min windows/status-go 📦zip
✔️ bba1855 9 2026-05-18 10:36:22 ~15 min tests-rpc 📄log
✔️ bba1855 9 2026-05-18 10:55:58 ~34 min tests 📄log

@alexjba alexjba requested a review from Copilot May 12, 2026 15:21
@alexjba alexjba force-pushed the perf/pause-non-critical-work branch from 8426883 to b21fce9 Compare May 12, 2026 15:25
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 12, 2026

Codecov Report

❌ Patch coverage is 70.00000% with 39 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (release/10.34.x@2bbcf4a). Learn more about missing BASE report.

Files with missing lines Patch % Lines
pkg/messaging/layers/reliability/reliability.go 86.31% 8 Missing and 5 partials ⚠️
pkg/messaging/layers/transport/transport.go 0.00% 8 Missing ⚠️
services/ext/service.go 0.00% 6 Missing ⚠️
pkg/messaging/api.go 0.00% 5 Missing ⚠️
...messaging/layers/reliability/datasync/transport.go 42.85% 4 Missing ⚠️
protocol/messenger.go 0.00% 3 Missing ⚠️
Additional details and impacted files
@@                Coverage Diff                 @@
##             release/10.34.x    #7440   +/-   ##
==================================================
  Coverage                   ?   61.31%           
==================================================
  Files                      ?      848           
  Lines                      ?   118845           
  Branches                   ?        0           
==================================================
  Hits                       ?    72869           
  Misses                     ?    38503           
  Partials                   ?     7473           
Flag Coverage Δ
functional 40.40% <34.61%> (?)
unit 55.23% <70.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
.../messaging/layers/reliability/datasync/datasync.go 100.00% <100.00%> (ø)
pkg/messaging/waku/types/waku.go 86.20% <ø> (ø)
protocol/messenger.go 61.84% <0.00%> (ø)
...messaging/layers/reliability/datasync/transport.go 79.41% <42.85%> (ø)
pkg/messaging/api.go 45.71% <0.00%> (ø)
services/ext/service.go 27.39% <0.00%> (ø)
pkg/messaging/layers/transport/transport.go 61.24% <0.00%> (ø)
pkg/messaging/layers/reliability/reliability.go 83.68% <86.31%> (ø)

@alexjba alexjba requested review from alaibe, friofry and saledjenic May 13, 2026 06:23
@alexjba alexjba marked this pull request as ready for review May 13, 2026 06:23
@alexjba alexjba requested a review from Copilot May 13, 2026 07:25
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.

Comment thread services/ext/service.go Outdated
Comment thread pkg/messaging/layers/reliability/reliability.go Outdated
Comment thread pkg/messaging/layers/reliability/datasync/datasync.go Outdated
@alexjba alexjba force-pushed the perf/pause-non-critical-work branch from b21fce9 to f47a616 Compare May 13, 2026 07:50
@alexjba alexjba force-pushed the perf/pause-non-critical-work branch from d982c7b to 1b72e37 Compare May 15, 2026 06:29
alexjba added a commit to status-im/status-app that referenced this pull request May 15, 2026
This commit bumps status-go to include status-im/status-go#7440. As a result the message sending is paused while in the background to stop the high frequency mvds loops that will prevent Android from going into sleep.
To preserve message sending while the app is in the background/killed we'll have to wake messenger briefly on the OS intent. We'll resume messenger for 60 seconds - enough to push the message through and then it will be paused again unless the app goes back to foreground.

This results in less battery usage and less events piling up in the qt event loop while the app is in the background.
alexjba added a commit to status-im/status-app that referenced this pull request May 15, 2026
This commit bumps status-go to include status-im/status-go#7440. As a result the message sending is paused while in the background to stop the high frequency mvds loops that will prevent Android from going into sleep.
To preserve message sending while the app is in the background/killed we'll have to wake messenger briefly on the OS intent. We'll resume messenger for 60 seconds - enough to push the message through and then it will be paused again unless the app goes back to foreground.

This results in less battery usage and less events piling up in the qt event loop while the app is in the background.
@alexjba alexjba force-pushed the perf/pause-non-critical-work branch 2 times, most recently from 7cab48c to a6d3f65 Compare May 18, 2026 05:59
alexjba added a commit to status-im/status-app that referenced this pull request May 18, 2026
This commit bumps status-go to include status-im/status-go#7440. As a result the message sending is paused while in the background to stop the high frequency mvds loops that will prevent Android from going into sleep.
To preserve message sending while the app is in the background/killed we'll have to wake messenger briefly on the OS intent. We'll resume messenger for 60 seconds - enough to push the message through and then it will be paused again unless the app goes back to foreground.

This results in less battery usage and less events piling up in the qt event loop while the app is in the background.
The messenger needs to keep only critical infrastructure while paused.
This commit stops the stats retrieval while paused - not used. And throttles the mvds datasync to 5 minutes. This means that the ack is confirmed once every 5 minutes (as opposed to 300ms) while paused.
Message sending is also disabled in this time frame.
@alexjba alexjba force-pushed the perf/pause-non-critical-work branch from a6d3f65 to bba1855 Compare May 18, 2026 10:21
@alaibe alaibe merged commit 9548d75 into release/10.34.x May 18, 2026
16 of 19 checks passed
@alaibe alaibe deleted the perf/pause-non-critical-work branch May 18, 2026 11:42
alexjba added a commit to status-im/status-app that referenced this pull request May 18, 2026
This commit bumps status-go to include status-im/status-go#7440. As a result the message sending is paused while in the background to stop the high frequency mvds loops that will prevent Android from going into sleep.
To preserve message sending while the app is in the background/killed we'll have to wake messenger briefly on the OS intent. We'll resume messenger for 60 seconds - enough to push the message through and then it will be paused again unless the app goes back to foreground.

This results in less battery usage and less events piling up in the qt event loop while the app is in the background.
alexjba added a commit to status-im/status-app that referenced this pull request May 18, 2026
This commit bumps status-go to include status-im/status-go#7440. As a result the message sending is paused while in the background to stop the high frequency mvds loops that will prevent Android from going into sleep.
To preserve message sending while the app is in the background/killed we'll have to wake messenger briefly on the OS intent. We'll resume messenger for 60 seconds - enough to push the message through and then it will be paused again unless the app goes back to foreground.

This results in less battery usage and less events piling up in the qt event loop while the app is in the background.
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.

5 participants