Skip to content

Allow limiting number of concurrent vector tile requests #13211

@jobblefrobble

Description

@jobblefrobble

Motivation

If you have many vector tile sources present on the map then animations can send out a huge number of concurrent requests, potentially overwhelming the browser and throwing ERR_INSUFFICIENT_RESOURCES errors which don't get retried by mapbox resulting in missing tiles. More seriously it can disrupt all other concurrent requests being sent out by the browser.

I think this is also related to some of the problems outlined by #13208

Design Alternatives

There was talk of a TileQueue on #6643 :

I've looked into how OpenLayers handles raster tile loading, and I believe the reason why their equivalent is fast is that they use a TileQueue data structure that makes sure there are never more than 16 tiles loading in parallel or requested at once in one frame. This makes it avoid requesting short-lived tiles that e.g. get requested on zoom in near the borders of the map and then immediately go off the view when zooming further during an animation. This might be a possible solution to this feature request #5482, and we should definitely explore a similar approach.

I'm wondering if such a thing could be added for vector sources too? Though maybe 16 is too conservative a number for vector tiles

Mock-Up

It would be nice to expose a variable similar to the existing mapboxgl.maxParallelImageRequests , but applying to vector tiles rather than images. e.g. mapboxgl.maxParallelVectorTileRequests

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions