-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Request Scheduler from 3d-tiles #3476
Conversation
CHANGES.md
Outdated
@@ -8,6 +8,7 @@ Change Log | |||
* Deprecated | |||
* Deprecated `GroundPrimitive.geometryInstance`. It will be removed in 1.20. Use `GroundPrimitive.geometryInstances` instead. | |||
* Deprecated `TileMapServiceImageryProvider`. It will be removed in 1.20. Use `createTileMapServiceImageryProvider` instead. | |||
* Deprecated `throttleRequests` flag in `TerrainProvider`. It will be removed in 1.19. It is replaced by an optional `Request` object that stores information used to prioritize requests. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just noticed that Request
is still private. Perhaps let's not deprecate this until we make the RequestScheduler
public. If you agree, update the 3D Tiles roadmap.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or maybe Request
should be public. Can we reasonably do that without making the entire request scheduler public since I don't think we want to commit to the full public API today.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pjcozzi This is up-to-date with master and the new spec changes. |
I may have brought this up before, but are we sure this is going to be a net win for us? It seems like we are trying to be smarter than the browser at its own game. I can understand prioritizing requests based on scene geometry (requests important tiles/imagery/terrain before further away stuff), but doing our own throttling seems like a really bad idea, especially with HTTP/2 adoption starting to happen. (where Cesium will end up a lot slower than it should be out of the box because no one is going to know to adjust these settings). I also imagine this system breaks down if it is part of a larger app where requests are being made outside of the RequestScheduler (since the browser will end up throttling anyway). I'm sure there's been a lot of thought and offline discussion put into this, and I don't mean to step on anyone's toes; I just want to understand the big picture here and be sure that this is a big enough win for us that it's worth the extra complexity. |
We definitely need system-wide (cross terrain, imagery, 3D tilesets, etc.) priority for requests. We can't have, for example, terrain requests in the distance starving 3D building requests in the foreground. As for throttling based on subdomains, I think it is fine to take this change with the same behavior as our current throttling. If I understand, this change correctly it just makes the throttling system-wide. Once whatever issues are worked out, I would be fine merging this re-evaluating as HTTP/2 spreads. We'll always want some kind of limit so, for example, we don't make 10K requests only to realize the next frame that we don't actually need any of them and instead want just a new 10 requests. |
Source/Core/RequestScheduler.js
Outdated
* @type {Number} | ||
* @default 6 | ||
*/ | ||
RequestScheduler.maximumRequestsPerServer = 6; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How did we choose this number, because that's what Chrome does? I believe other browsers have different values. If this number is really important, should we have some browser-specific test code in here to determine a better default?
I agree, but I would really like to see some hard numbers in a variety of benchmarks across all of the major browsers comparing this branch and master to prove we aren't making things worse. When it comes to performance, we've always been about hard numbers in the past, no reason to stop now. |
Yes, I'd like to see some numbers too. This won't be better than master, but it should not be non-trivially worse. |
@lilleyse should this just be closed? Or do you plan on reworking it before opening the |
I plan on reworking it with @austinEng's help, but will open the |
00d6f25
to
917c548
Compare
This is almost ready but I still need to add tests and do benchmarks. I worked from a bunch of the ideas here (#5317). Per-frame budgets are now gone so the problems when using multiple widgets #5226 should be fixed. A request now contains a state enum:
When terrain/imagery/3d-tiles makes a request, a few things can happen:
Other changes:
If anyone wants to give this a quick sanity-check that would be nice, but otherwise I still have more to do to get this ready and will update then. |
As part of this, can you please spot check a few representative views for terrain/imagery in this branch vs master to verify the number and order of requests are about the same? |
|
Why not remove |
Seems like we would want this. |
Added a TODO section to the first comment in this PR. |
What's the plan with this w.r.t to HTTP2 and #5316? |
6ecb6f6
to
b2ca18b
Compare
b2ca18b
to
8d698e9
Compare
Specs/spec-main.js
Outdated
@@ -136,6 +136,8 @@ | |||
|
|||
window.it = function(description, f, timeout, categories) { | |||
originalIt(description, function(done) { | |||
// Clear the RequestScheduler before for each test in case requests are still active from previous tests | |||
Cesium.RequestScheduler.clearForSpecs(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this still needed here? I would prefer to remove it unless there's a really good reason for it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll see what I can do, because I don't like this either. Maybe this just needs to be called for specs that are doing more fine-grained request checking.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, it should only matter for tests that are testing the RequestScheduler
itself.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There could be cases where unrelated tests do not resolve their promises correctly so the activeRequests
list can get clogged. But since this only affects throttled requests the clearForSpecs
call only need to go in terrain/imagery provider tests.
Results on release build of master. All tests disable the browser's cache. The HTTP2 server I'm using hosts both terrain and imagery at the same server, which is not ideal for throttling. A few takeaways here:
Will have more stats for this branch to come. |
What I meant to say was server, not subdomain. |
As of now these PRs are separate and don't need to interfere with each other. |
84a3c1e
to
a2dae0c
Compare
a2dae0c
to
b9e8042
Compare
The code is ready to review again. My internet connection is not super reliable here so I will hold off on final benchmarks until tomorrow. |
Stats on this branch. New takeaways:
|
The first screenshot shows the benefits the most. My overall impression is that prioritization isn't a huge win for the terrain/imagery system alone since the default traversal is already pretty good. The real benefit will come when we have multiple data sources with different traversal patterns - aka 3D Tiles on the globe. |
I replaced it with a bool, still the same logic though. |
For #3241
Bringing in the Request Scheduler into master.
I also brought in
TileBoundingVolume
and its sublcassesTileBoundingRegion
,TileBoundingSphere
, andTileOrientedBoundingBox
into master because they are being used to calculate tile distance inGlobeSurfaceTile
which gets passed to the request scheduler.All the miscellaneous request functions now pass through the
RequestScheduler
.TODO