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

feat(presence): Add support for signal batching #23075

Draft
wants to merge 61 commits into
base: main
Choose a base branch
from

Conversation

tylerbutler
Copy link
Member

@tylerbutler tylerbutler commented Nov 12, 2024

This is an in-progress change to add signal batching to presence.

Status

refactor(presence): Convert localUpdate to accept an options object

The localUpdate function now takes an options object instead of just forceBroadcast. There is also now an allowableUpdateLatency optional value which will be used in the batching/throttling logic.

test cases

There are three test cases currently:

  1. Signals send immediately when allowable latency is 0
  2. Signals are batched when they are received within the send deadline (send deadline is set to now + allowable latency iff a new message is queued (i.e. a message was not queued - this is the first message to be queued)
  3. Signals from LVMs with different allowable latencies are batched and interleaved (failing at the moment)

The test cases themselves are now more compact because of the snapshots. I added inline comments with the time and expected deadline for each operation.

Each test has two signals at the beginning for the join and the initial send of the workspaces, so the real signals for each test start with signal 3.

pending test cases

These test cases haven't been written yet:

  1. Queued signal is sent with immediate signal (i.e. if a signal is queued and an immediate message comes in, it should merge and send immediately
  2. Multiple workspaces
  3. Include sending notifications - they should be sent immediately

@github-actions github-actions bot added area: framework Framework is a tag for issues involving the developer framework. Eg Aqueduct base: main PRs targeted against main branch labels Nov 12, 2024
Copy link
Collaborator

@msfluid-bot msfluid-bot left a comment

Choose a reason for hiding this comment

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

Code Coverage Summary

↓ packages.framework.presence.src:
Line Coverage Change: 0.43%    Branch Coverage Change: -3.29%
Metric NameBaseline coveragePR coverageCoverage Diff
Branch Coverage 85.18% 81.89% ↓ -3.29%
Line Coverage 69.69% 70.12% ↑ 0.43%

Baseline commit: 136a519
Baseline build: 307305
Happy Coding!!

Code coverage comparison check failed!!
More Details: Readme

  • Skip This Check!!

What to do if the code coverage check fails:

  • Ideally, add more tests to increase the code coverage for the package(s) whose code-coverage regressed.

  • If a regression is causing the build to fail and is due to removal of tests, removal of code with lots of tests or any other valid reason, there is a checkbox further up in this comment that determines if the code coverage check should fail the build or not. You can check the box and trigger the build again. The test coverage analysis will still be done, but it will not fail the build if a regression is detected.

  • Unchecking the checkbox and triggering another build should go back to failing the build if a test-coverage regression is detected.

  • You can check which lines are covered or not covered by your tests with these steps:

    • Go to the PR ADO build.
    • Click on the link to see its published artifacts. You will see an artifact named codeCoverageAnalysis, which you can expand to reach to a particular source file's coverage html which will show which lines are covered/not covered by your tests.
    • You can also run different kind of tests locally with :coverage tests commands to find out the coverage.

@msfluid-bot
Copy link
Collaborator

@fluid-example/bundle-size-tests: +245 Bytes
Metric NameBaseline SizeCompare SizeSize Diff
aqueduct.js 464.33 KB 464.36 KB +35 Bytes
azureClient.js 563.18 KB 563.23 KB +49 Bytes
connectionState.js 724 Bytes 724 Bytes No change
containerRuntime.js 262.48 KB 262.5 KB +14 Bytes
fluidFramework.js 426.84 KB 426.85 KB +14 Bytes
loader.js 134.18 KB 134.19 KB +14 Bytes
map.js 42.71 KB 42.71 KB +7 Bytes
matrix.js 148.36 KB 148.36 KB +7 Bytes
odspClient.js 528.97 KB 529.02 KB +49 Bytes
odspDriver.js 97.88 KB 97.9 KB +21 Bytes
odspPrefetchSnapshot.js 42.81 KB 42.83 KB +14 Bytes
sharedString.js 164.26 KB 164.27 KB +7 Bytes
sharedTree.js 417.3 KB 417.3 KB +7 Bytes
Total Size 3.37 MB 3.37 MB +245 Bytes

Baseline commit: 3b51758

Generated by 🚫 dangerJS against b0b0bd4

jason-ha and others added 4 commits November 12, 2024 17:28
- move workspace create to common setup
- add more test cases
- rework emit test without spies
- remove console logging
- remove compile coverage as part of regular tests
test(client-presence): rework Notifications tests
Comment on lines 142 to 160
[
"Pres:DatastoreUpdate",
{
"sendTimestamp": 1030,
"avgLatency": 10,
"data": {
"system:presence": {
"clientToSessionId": {
"client2": { "rev": 0, "timestamp": 1000, "value": "sessionId-2" },
},
},
"s:name:testStateWorkspace": {
"data": {
"sessionId-2": { "rev": 2, "timestamp": 1030, "value": { "num": 65 } },
},
},
},
},
],
Copy link
Contributor

Choose a reason for hiding this comment

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

If we drop the two processSignal calls, then I think this is the only signal expected when batching is implemented. The sendTimestamp should be 1070. (60 past when first local update was set at 1010.)
The test will also need a clock advance after last local set. I think you can clock.tick(1000) large number and timer would still happen at the right time.

@github-actions github-actions bot added the dependencies Pull requests that update a dependency file label Nov 14, 2024
Copy link
Contributor

🔗 No broken links found! ✅

Your attention to detail is admirable.

linkcheck output


> [email protected] ci:linkcheck /home/runner/work/FluidFramework/FluidFramework/docs
> start-server-and-test ci:start 1313 linkcheck:full

1: starting server using command "npm run ci:start"
and when url "[ 'http://127.0.0.1:1313' ]" is responding with HTTP status code 200
running tests using command "npm run linkcheck:full"


> [email protected] ci:start
> http-server ./public --port 1313 --silent


> [email protected] linkcheck:full
> npm run linkcheck:fast -- --external


> [email protected] linkcheck:fast
> linkcheck http://localhost:1313 --skip-file skipped-urls.txt --external

Crawling...

Stats:
  443760 links
    3414 destination URLs
       2 URLs ignored
       0 warnings
       0 errors


@github-actions github-actions bot removed the public api change Changes to a public API label Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: framework Framework is a tag for issues involving the developer framework. Eg Aqueduct base: main PRs targeted against main branch dependencies Pull requests that update a dependency file
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants