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

Added support of parentUrl property in layer.json #5864

Merged
merged 7 commits into from Oct 13, 2017

Conversation

tfili
Copy link
Contributor

@tfili tfili commented Sep 29, 2017

We can have a dataset that only has partial terrain, but points to a full global dataset for missing tiles. We just add a parentUrl property to the layer.json and it will load that tileset and manage which one to use based on availability.

Also added a test to verify it handles extensions correctly.

To Do

  • Add another test to make sure we check availability correctly.

@cesium-concierge
Copy link

@tfili, thanks for the pull request! Maintainers, we have a signed CLA from @tfili, so you can review this at any time.

I noticed that CHANGES.md has not been updated. If this change updates the public API in any way, fixes a bug, or makes any non-trivial update, please add a bullet point to CHANGES.md and comment on this pull request so we know it was updated. For more info, see the Pull Request Guidelines.

I am a bot who helps you make Cesium awesome! Thanks again.

Copy link
Member

@kring kring left a comment

Choose a reason for hiding this comment

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

Nice feature @tfili, thanks! Two of my three comments are super trivial, but for the last I think it'd be good to at least do the easier thing so that performance of single-layer terrain providers won't suffer.

@@ -505,7 +587,22 @@ define([
}
//>>includeEnd('debug');

var urlTemplates = this._tileUrlTemplates;
var layers = this._layers;
var layerToUse = layers[0];
Copy link
Member

Choose a reason for hiding this comment

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

This assignment is not necessary.

var layers = this._layers;
var layerToUse = layers[0];
var layerCount = layers.length;
for (var i=0;i<layerCount;++i) {
Copy link
Member

Choose a reason for hiding this comment

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

whitepace

return undefined;
}

var urlTemplates = layerToUse.tileUrlTemplates;
Copy link
Member

Choose a reason for hiding this comment

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

I haven't measured or anything, but there's the potential for a somewhat high performance cost here, especially on slow systems with slow internet connections. On these systems, Cesium tends to spend a lot of time traversing the quadtree to select the tiles it wishes it has, then calling requestTileGeometry on them, only to see it return undefined because too many tile requests are already in progress.

Before this pull request, Cesium only had to do some string manipulations to build up a URL, and then it would hand it off to loadArrayBuffer which would check for too many requests in flight and potentially return undefined.

But after this pull request, Cesium now has to do a lot of tile availability checking before handing off to loadArrayBuffer. I'd be surprised if this doesn't show up pretty clearly in a profiler.

So two suggestions, one easy and one harder:

  1. If the terrain provider has only one layer, don't bother checking availability at all. (easy)
  2. Check if we need to throttle (and do so) before checking tile availability.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't know if 2 is possible. Even if we check the throttle status, we still need to know whether that layer contains the tile so we can return a Promise/undefined or if we should go to the next layer, which may be from a different domain and have a different throttle status.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah true you could only optimize some special cases. i.e. if all the layers are from the same host, and that host already has too many requests in flight, you can skip availability checking. Or another less useful special case: if all layers already have too many tile requests in flight, just return undefined without checking availability. Anyway, the important thing is to avoid the performance regression for the single layer case (as you've already done) and we can worry about optimizing the multi layer case if it ever really becomes an issue.

@tfili
Copy link
Contributor Author

tfili commented Oct 10, 2017

@kring This should be good now.

@kring
Copy link
Member

kring commented Oct 13, 2017

@tfili is there a public tileset with a parentUrl that I can try out? In any case, I'm sure you've tried it, so I'm merging it on the basis of code inspection and tests.

@kring kring merged commit 2862c99 into master Oct 13, 2017
@kring kring deleted the terrain-ancestor-layers branch October 13, 2017 09:52
@tfili
Copy link
Contributor Author

tfili commented Oct 16, 2017

is there a public tileset with a parentUrl that I can try out?

Nothing public yet. I'll let you know when we do.

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.

None yet

3 participants