Answer the question
In order to leave comments, you need to log in
How on the client side to accept data in parts with a GET request?
Hello, comrades! Please help me figure it out.
In a Vue.js (version 2.5.17) application, I make a GET request to a specific URL. The backend returns a large pool of data in chunks using the JSONStream package . Under a large data pool, I have ~200,000 entries. These records are supposed to be applied to the Yandex map, so pagination or lazy loading is not my option.
At the moment I'm using the axios package to process the GET request. It turns out that axios waits for the entire data pool and only then starts drawing geo-objects on the map. By the way, each record can be considered as one geo-object.
I measured the speed and came to the conclusion that the most time-consuming process is drawing geo-objects on the map. In this case, this process begins only when axios has received all the data. Considering all this, I have a question. How to accept this data in parts on the client side?
PS I cannot reduce the number of records. Axios receives the entire data pool in 5-7 seconds after my optimization on the database side, another 5-8 seconds are spent on drawing geo-objects on the map. As you understand, 10-15 seconds is a lot for a web application. Therefore, the question arose, to receive data on the client side in pieces and immediately draw them on the map in parallel.
Answer the question
In order to leave comments, you need to log in
They did about the same, but the number of objects was a little less.
1) Cache data on the backend side
2) Use clusters
3) Load and render labels depending on the zoom and movements on the map
If you can't use data pagination, then no way. If you have access to database optimization, then you may have access to the backend, then add an api so that you can get part of the data by the page parameters and the amount of data per page .
And in this version, you can only advise to draw in parallel, maybe a couple of seconds will be saved.
Are you sure you're on the right track to solve the problem? If you have a mountain of points that need to be displayed on the map, then you can also apply an analogue of pagination along a certain perimeter, depending on the current scale. If, for example, data is requested for a large perimeter, points can be grouped on the back.
Enable gzip. And I have big doubts that Yandex is able to draw 200k points, leaflet yes, Yandex definitely not. On a weak computer, Yandex already slows down a hundred. With 200k on some kind of iPad there will generally be an error that there is no memory. Load and render labels based on zoom and movement on the map. But if you want, then https://developer.mozilla.org/en-US/docs/Web/API/S...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question