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

Long delay (~2s) between map style loading and vector tiles being requested #2991

Closed
ekelleyv opened this issue Aug 11, 2016 · 7 comments
Closed
Labels
performance ⚡ Speed, stability, CPU usage, memory usage, or power usage

Comments

@ekelleyv
Copy link

ekelleyv commented Aug 11, 2016

mapbox-gl-js version: v0.21.0

browsers: Latest Firefox + Chrome on Mac

Steps to Trigger Behavior

Expected Behavior

  • Network requests for vector tiles start very shortly (on the order of milliseconds?) after style sheet is loaded and parsed

Actual Behavior

  • There is a 1-2s delay before the vector map tiles are even requested. Then the tiles load and render on the map correctly.

Here is a screenshot of the chrome developer console (https://www.mapbox.com/mapbox-gl-js/examples/):
image

Interestingly this does not affect raster sources on any browser (https://www.mapbox.com/mapbox-gl-js/example/map-tiles/):
image

This also occurs on Firefox:
image

Even more interestingly, this does not happen on safari:
image

So, we have maps that have both vector and raster sources where the raster tiles appear seconds before their vector counterparts.

Best guess at what is happening

Purely speculation, but this seems the vector renderers (shaders? webworkers?) are being instantiated in such a way that blocks the network request for vector tiles. It seems like the vector tile requests could be triggered upon parsing the style sheet (like the glyphs and raster tiles are), so by the time the renderer is fully ready, the tiles are all available and render immediately, instead of drawing as the network requests return.

As to why this does not occur on safari? ¯\_(ツ)_/¯

@ekelleyv
Copy link
Author

Here is a video of the delay on chrome:
https://cl.ly/3n3i1n2c030P

@ekelleyv
Copy link
Author

As I look into this, it seems to be related to the overhead of bringing up the workers and the time spent in set layers. That is the key difference compared to raster tiles, as raster tiles do not instantiate workers/style layers before starting the network request.

@mourner mourner added the performance ⚡ Speed, stability, CPU usage, memory usage, or power usage label Aug 16, 2016
@EMTurano
Copy link

I'm experiencing the same thing, but if you look at your Network tab, you'll see the resources that come from mapbox's domain are what's delaying the load.

@ekelleyv
Copy link
Author

@EMTurano that is not what I am seeing. There is a "gap" in network requests. Also, if this were just a max connections issue, it would affect both raster and vector tiles. However, the time seems to be spent in the worker/layer instantiation rather than any network activity.

Based on my logging the network requests are not even being attempted until after the delay, whereas if it were a network bottleneck you would expect to see the tiles in the "Queueing" state for the duration of the delay.

@jfirebaugh
Copy link
Contributor

Can you please reproduce the issue in Chrome with the network inspector open, and then right-click of the list of network requests and "Save as HAR with Content", and post a link? Thanks!

@ekelleyv
Copy link
Author

ekelleyv commented Sep 6, 2016

Certainly:
https://cl.ly/0U2S3O0k2i1k

I think #3153 and referenced issues describe exactly what I was seeing when I tried profiling things. @jfirebaugh think we should close this issue?

@mourner
Copy link
Member

mourner commented Nov 8, 2016

Let's close in favor of #3153.

@mourner mourner closed this as completed Nov 8, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance ⚡ Speed, stability, CPU usage, memory usage, or power usage
Projects
None yet
Development

No branches or pull requests

4 participants