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

Add serve function to C++ API #4638

Open
emilk opened this issue Jan 2, 2024 · 3 comments
Open

Add serve function to C++ API #4638

emilk opened this issue Jan 2, 2024 · 3 comments
Labels
🌊 C++ API C/C++ API specific enhancement New feature or request

Comments

@emilk
Copy link
Member

emilk commented Jan 2, 2024

RecordingStream has connect and spawn, but no serve.

@emilk emilk added enhancement New feature or request 🌊 C++ API C/C++ API specific labels Jan 2, 2024
@emilk emilk added this to the Triage milestone Jan 2, 2024
@emilk emilk mentioned this issue Jan 2, 2024
4 tasks
emilk added a commit that referenced this issue Jan 4, 2024
### What
Limit the amount of RAM used by the WebSocket server.

The WebSocket server will buffer all log data in memory so that late
connecting viewers will get all the data.
Previously this would just eat more and more RAM until the server
crashed.

There is now a limit, which default to 25% of the RAM. That is, the
server will try to keep _its own_ memory use under that limit. Note that
this acts different from the viewer's `--memory-limit` which throws away
old data when the total process memory exceeds the limit.

The memory limit is set by the new `--server-memory-limit` argument to
`rerun`, or by argument to the `serve` functions. Note that I opted for
a different argument for the server limit than for the viewer memory
limit. This is partially because it should be a lot less, and partially
because the limit acts differently (it is a local budget, rather than a
total process limit).

While working on this I noticed we don't have a `serve` function in C++,
so I created an issue for that:
#4638

The default limit of 25% can be discussed. It leaves the other 75% for
the viewer (though if the viewer is in a browser, it will likely be
using much less).

### Checklist
* [x] I have read and agree to [Contributor
Guide](https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md) and
the [Code of
Conduct](https://github.com/rerun-io/rerun/blob/main/CODE_OF_CONDUCT.md)
* [x] I've included a screenshot or gif (if applicable)
* [x] I have tested the web demo (if applicable):
* Using newly built examples:
[app.rerun.io](https://app.rerun.io/pr/4636/index.html)
* Using examples from latest `main` build:
[app.rerun.io](https://app.rerun.io/pr/4636/index.html?manifest_url=https://app.rerun.io/version/main/examples_manifest.json)
* Using full set of examples from `nightly` build:
[app.rerun.io](https://app.rerun.io/pr/4636/index.html?manifest_url=https://app.rerun.io/version/nightly/examples_manifest.json)
* [x] The PR title and labels are set such as to maximize their
usefulness for the next release's CHANGELOG

- [PR Build Summary](https://build.rerun.io/pr/4636)
- [Docs
preview](https://rerun.io/preview/15e94a7ce913541da83675bff6bc4bb050c4b5a5/docs)
<!--DOCS-PREVIEW-->
- [Examples
preview](https://rerun.io/preview/15e94a7ce913541da83675bff6bc4bb050c4b5a5/examples)
<!--EXAMPLES-PREVIEW-->
- [Recent benchmark results](https://build.rerun.io/graphs/crates.html)
- [Wasm size tracking](https://build.rerun.io/graphs/sizes.html)

---------

Co-authored-by: Clement Rey <[email protected]>
@emilk emilk changed the title C++ API doesn't have a serve function Add serve function to C++ API Jan 9, 2024
@emilk emilk added the 🏎️ Quick Issue Can be fixed in a few hours or less label Jan 15, 2024
@emilk
Copy link
Member Author

emilk commented Jan 15, 2024

@Wumpf
Copy link
Member

Wumpf commented Feb 19, 2024

This would imply dragging in a lot of stuff to rerun_c, meaning we should make this opt-in. But having two rerun_c artifacts seems a bit cumbersome. Not a 'quick issue' in that case then anymore

@Wumpf Wumpf removed the 🏎️ Quick Issue Can be fixed in a few hours or less label Jul 9, 2024
@jleibs jleibs removed this from the Triage milestone Aug 5, 2024
@Wumpf
Copy link
Member

Wumpf commented Sep 9, 2024

(via discussion with @jleibs:) Alternatively to embedding the wasm blobs in the SDK (both in C++ and Python!) we could instead let the rerun cli do the work. We'd start rerun in serve mode and then connect to the serving rerun. This has a bunch of advantages over the approach we're taking today in Python (and should probably abandon there as well!):

  • this removes a complicated dependency from all SDKs
  • continues the trend of having the SDK relatively lean & friendly for local compilation and the Viewer relatively large (more meant as binary distribution)
    • ship the wasm blobs only once instead of twice!
  • moves us towards a hub-like behavior
  • very little new code and entirely isolated to the C++ sdk (don't need to touch C)

Reportedly, this already works as is!

obvious drawback is that we have another tcp loopback indirection. In the future we could do shared memory based interprocess communication, but it this very unlikely to become an issue all that soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🌊 C++ API C/C++ API specific enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants