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

Needs for IEEE VR 2020 #29

Closed
5 tasks
blairmacintyre opened this issue Jan 31, 2020 · 27 comments
Closed
5 tasks

Needs for IEEE VR 2020 #29

blairmacintyre opened this issue Jan 31, 2020 · 27 comments

Comments

@blairmacintyre
Copy link

blairmacintyre commented Jan 31, 2020

I wanted to drop a message here where I can track the things I need working for IEEEVR. I'll likely add to this list as I understand it.

  • authentication/identity. Issue Email-based authentication/identity #27 seems to be the ideal solution.
  • discord bot. Over in setting up custom discord-bot for hubs-cloud instance #26. Even if the authentication doesn't need it, it provides a critical feature, namely being able to monitor and record all chat in the rooms. For any event with a Code of Conduct and a concern about enforcing it, where we may not be able to have people in every room all the time, sending all the chat to discord is a good solution.
  • some way of controlling the content of the front page. Want to have a more detailed description appear on the top page #19. We probably want to have the hubs.ieeevr.online front page give them info (such as how to log in) and pointing them back to other pages. The top page (ieeevr.online) would be a static page with pointers to rooms. There has been mention of an API so that a separate page could query the hubs server and get info about rooms, including names, perhaps an image, and number of people in it. This would be great, but worst case we can just create simple thumbnails that point at rooms. \
  • A way to manage audio and noise spread in poster rooms. The easy solution would be to have a server setting to define a global cap on audio distance for all audio media.
  • A scalable way of getting some dynamic web content displayed. We'd like to have some "posters" with info about the schedule, current session, and time in EST (where the conference is). We could use the webpage renderer, except we need it to refresh at the right times, and don't want to have to go into many rooms and do it manually (worst case, we could TRY to do that, but I don't expect it to work consistently because people will be busy, etc). We may decide to modify the server to enable this. One possible solution might be to have the discord bot be able to refresh the web page in response to a command from discord. Even "!hubs refreshwebcontent" to refresh ALL web pages in the room associated with the channel; otherwise, if they have names, give the name. This might be feasible because it would be easy to do this in discord (paste the command rapidly in a bunch of channels.
@gfodor
Copy link
Contributor

gfodor commented Feb 4, 2020

for the webpage refresher, would it be sufficient to auto-refresh after a fixed duration?

we might be able to get away with having this be a server-wide setting of auto-refresh rate for web page thumbnails.

@gfodor
Copy link
Contributor

gfodor commented Feb 4, 2020

AWS lambda is sufficiently cheap, now that I've run the math (please check :)) Lets say you had 100 web page thumbnails across your rooms, and you had 40 hours/week of active CCU viewing those thumbnails. for a 30s refresh interval this means 100 thumbnails * (40 hours * 120 refreshes per hour) = 480000 refreshes a week. if they take say 10s to run with 3gb memory each that's 14.5M gb/s a week, so 58 gb/s a month. lambda costs $0.20 per million requests and 0.000016667 per gb/s so the total cost of that would be a $0.000016667 * 58 gb/s = $0.001 for CPU and an additional $0.40 for requests, so less than $0.50/mo :) And that's for 100 concurrently 'viewed' thumbnails, which is relatively high.

@blairmacintyre
Copy link
Author

Those numbers are mind boggling (that it can be so small).

For the VR / conference use case, yes, fixed update is plenty good. I would imagine that something like 1 min or 30s intervals while the conference is active, and cranking it down when it's not, would be fine.

  • a clock with time certainly doesn't need more than that
  • current/next session would be fine, although being able to somehow "trigger" a refresh would be good if something changes (e.g., hit "refresh" when the talk actually starts). Perhaps this could be added as a feature to the discord bot. !hubs refreshall

I think any web content that changes faster than each 30s or so probably needs to be handled differently (e.g., have it be fetched and rendered locally, as we're looking at separately).

@gfodor
Copy link
Contributor

gfodor commented Feb 5, 2020

Yup the refreshes themselves would be dependent upon room presence (basically, we'll have a client promote themselves to the 'refresher', similar to what we do for videos, which have an implicit 'timekeeper'.) So you'd only be paying for refreshes when people are actually looking at them, so it'd be self-regulating (and arguably much cheaper than the hypothetical outlined above, since that assumed not just 40 hours/wk of CCU, but basically 40 hours/wk of "eyeballs who can see 100 thumbnails")

@gfodor
Copy link
Contributor

gfodor commented Feb 5, 2020

The refresh-on-demand case would still be covered by the existing refresh button we have now. So this would be probably a global site-wide switch (off by default, and only available to AWS stacks since the lambda is available) to enable auto-refresh for all thumbnails.

@gfodor
Copy link
Contributor

gfodor commented Feb 5, 2020

OMG, I totally screwed up the units here. Your intuition is right, that was way too cheap. This seems to be a non starter actually unless we think my hypothetical is wrong. The AWS pricing is in gb/s, not Mgb/s

@blairmacintyre
Copy link
Author

So, $500/month for that example? or $500000?

@gfodor
Copy link
Contributor

gfodor commented Feb 5, 2020

Let me try this again (with less confidence now I'm able to do arithmetic anymore :):

  • To fetch a thumbnail, if we assume it takes 10 seconds, and 3gb memory, an individual thumbnail fetch would be: $0.000004896 gb/s * 10 = $0.00004896

  • To fetch 100000 thumbnails costs 100000 * $0.00004896 = $50

In the case above, you'd be doing approx 2M thumbnail fetches per month, so it'd cost ~$1000/mo in CPU and a few cents in requests.

For the conference case, if you had 20 rooms with 2 thumbnails each that's 40 (not 100) thumbnails, but it would still be a few hundred bucks a month if you expected at least one person to be in each of those rooms for 40 hours a week (not far fetched.)

So this seems probable a non-starter, unless we dial the refresh duration up significantly. If it was 5 minutes instead of 30 seconds, then the cost for the hypothetical above drops by an order of magnitude to $100/mo.

@blairmacintyre
Copy link
Author

So, what about the idea of just having a discord bot command, either per room or globally? Perhaps with the corresponding in-room command (that only admins can do, probably)?

  • discord: !hubs refresh_pages (just this room)
  • discord: !hubs refresh_all_pages (all rooms linked to this discord)
  • in room: /refresh_pages

@gfodor
Copy link
Contributor

gfodor commented Feb 5, 2020

doing a global effect on all rooms from discord is relatively uncharted territory -- i'd be nervous estimating what'd be involved there since it would be the first case of us doing something like "walk all the rooms in a set and apply some transformation to room state." having an in-game mechanic seems fine, the chat command could be supplemented by adding the "refresh" button to the object menu as well (when you click on the object in the object list.)

however I thought the idea here was that we don't 'trust' that anyone in the room would be hitting these refresh buttons (either because there are too many to hit, or we don't expect a trusted 'moderator' to be present in the rooms to do so.) So if that's the case we either need a feature to walk all the rooms to do it (discord or otherwise) or we need to have it be based upon a refresh duration/expiration.

@gfodor
Copy link
Contributor

gfodor commented Feb 5, 2020

we may be able to significantly reduce the AWS lambda costs of a higher refresh rate if we slightly adjust the contract here.

basically, if we can determine the content hasn't changed, we can avoid the lambda function call. what this would mean is that when the client attempts an auto-refresh, it first uses HTTP caching protocols (eg an ETag) to determine if the current thumbnail is stale or not, before requesting a full re-fetch. That seems likely to work, but ofc there's always a risk that this could spiral out of control into those costs above if the content always appeared stale due to unexpected cache misses. (We could potentially have a rate limiter on this to prevent that, but complexity at that point would be getting pretty heavy.)

@blairmacintyre
Copy link
Author

Ideally, doing it fully automatically is what I'd want. But with a really slow update, that may be less useful, and a high update may be cost prohibitive. Using cache's would be a good idea, but I worry about the tradeoff of work vs benefit.

The only thing that's a complete non-starter is "Go into the room and do a refresh on the object with the 3D UI" ... too slow, given the friction to get in and navigate. Even "Go into the room and run /refresh_pages" is probably too slow.

But, having 30 or 40 channels in discord, where we go an past "!hubs refresh_pages" in each is not unreasonable, esp if that's easy to implement. Having a corresponding in-room / command would be good too.

@gfodor
Copy link
Contributor

gfodor commented Feb 5, 2020

I think doing a global effect is going to be tough to implement, and subject to a lot of risk as well. Basically, the discord bot would need to start having side effects in the rooms, vs just being a passive observer. I think there's a lot of risk to that kind of thing, since a bug or runaway process etc could cause a global failure. (And in the case of hub's discord bot, a global failure across all connected discord servers becomes a risk too)

@blairmacintyre
Copy link
Author

blairmacintyre commented Feb 5, 2020 via email

@gfodor
Copy link
Contributor

gfodor commented Feb 5, 2020

Oh I see. So you'd still iterate over each room in discord to do it. That makes it less scary, but is still uncharted territory and a bit risky since the discord but would become a more active agent in that room. Basically anywhere we are doing "writes" in the discord bot raises red flags, since the blast radius of a bug in that code is extremely wide. (Most of our server side code is naturally isolated, since we don't have any global, cluster-wide contexts due to the way elixir processes + state are organized)

@gfodor
Copy link
Contributor

gfodor commented Feb 5, 2020

Ie, the discord bot, oddly enough, is one of the few places across all our code where you actually have the leverage to easily affect multiple rooms, and all connected users of those rooms. (Via a for loop, or a bug causing code to run in rooms you didn't intend.) There's no such centralized context to globally affect connected users in any of our reticulum code.

@gfodor
Copy link
Contributor

gfodor commented Feb 5, 2020

I think this feature is valuable enough globally since this solves a lot of the "we want a web page in hubs" use cases. I could imagine us doing a nice job with it, and making it more of a server-side 'push' concern.

Basically, when there is a thumbnail in a room, we could spawn a dedicated elixir process to manage it. (These are cheap.) It would periodically fetch the origin looking for changes, and could incorporate cluster-wide rate limiting to ensure costs are capped across all thumbnails. The net effect would be the server itself could notify the room participants via a 'push' to the channel that the thumbnail is stale, and pre-fetch + cache the new version.

@gfodor
Copy link
Contributor

gfodor commented Feb 5, 2020

Since the server is doing this, the "time to change detection" could be dialed down to only a few seconds, depending on how aggressively we want to poll the origin. And then we could (locally, per thumbnail) rate limit the actual refreshes. So the idea would be, you would only see at most one change per N seconds, but if a change occurs, you will see it within M seconds of the change actually happening assuming N seconds have passed.

@gfodor
Copy link
Contributor

gfodor commented Feb 5, 2020

eg, a 15s polling interval and a 5m refresh limit would eliminate the need for global rate limiting altogether. if you made a change at the origin, you'd see it in at most 5m across all clients, but if enough time has passed since the last update, you'd see it in 7s on average. (plus the thumbnail generation time of a few seconds)

@gfodor
Copy link
Contributor

gfodor commented Feb 5, 2020

This seems like something we could turn on by default and not even expose as an option actually under that setup.

@gfodor
Copy link
Contributor

gfodor commented Feb 5, 2020

Also this would be a 'big project' so not something I'd expect us to turn around quickly. But the writeup above seems at least like the 'right' solution to this problem. For the IEEE case, we probably should plan on some other mechanic tho.

@blairmacintyre
Copy link
Author

This also might be orthogonal to the real need here; the ideal solution is just having content be updated continuously inside the system, not using HTML. So, a component that is generating a texture to update an image so it reflects everywhere. Perhaps this can be what we experiment with for custom components. I was actually imagining that this happens locally on all clients, rather than being synchronized.

@gfodor
Copy link
Contributor

gfodor commented Feb 5, 2020

yeah that's a different issue, that cuts into component extensibility imo

@blairmacintyre
Copy link
Author

yes. I was pondering that a fast/frequent refresh is so expensive it might be best not to implement in a way that people can abuse it. For content that changes frequently, such as the twitter feed mocked up in the Hello-WebXR demo the team did, it might be better to implement that entirely differently. For example, a "ScriptBot" might be attached to a room, and run scripts that update certain images. Or, a custom extension may synchronize the base data (e.g., the hashtag being displayed on the twitter panel) such that anyone can "change it" (somehow), but it may fetch and render locally in each client. Any of these could be implemented as web pages, but (as you suggest) the cost might be prohibitive.

@gfodor
Copy link
Contributor

gfodor commented Feb 6, 2020

Yeah, another approach to that in a similar spirit would be an installable app that used WebRTC and a headless browser context to just render web pages via video into a room. There's already a PoC of this put together by someone in the aframe community.

@blairmacintyre
Copy link
Author

for some uses that might be fine; I'm imagining the case where there are lots of little 2D bits around a room, that might be hard to pull off that way.

@misslivirose
Copy link
Contributor

Since we have the list of issues tracked independently, I'm going to resolve this.

Audio override by room owners is captured in Hubs-Foundation/hubs#1853

Dynamic web content is captured in Hubs-Foundation/hubs#2424 and Hubs-Foundation/hubs#1688

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

3 participants