in my company, i have a mission to improve the performance in the app.
we have a cesium map, and i get from my server in socket a big amount of data, and need to handle the data correctly and add it to the map
the problem is when the is a lot of data, the browser just stack, and the app get very slow
Given that you are streaming data from your own server into CesiumJS, it is somewhat difficult for me to debug this problem. Based on the code that you have shared, it seems like you are adding your data to dataSources correctly. Thus, the latency is likely caused by your server or how CesiumJS processes your CZML data. I suspect that it is the former. Please try using Cesium ion to host and stream your data. Let me know if you still experience poor runtime performance.
I think its about how cesium engine prepare data for render, you need to change this mechanism.
When the data numbers are goes up your data structure is more important, if you want to handle big number of objects you need to have very light data structure (for example not nested object or array) and you need to fast draw method.
I try some samples and when number are big cesium consume a lot of memory in runtime.
what do you mean vector data ?
my server send to me 100,000 items to draw on the map
every item is a small icon (base64), and has a label with his name,
and every item is locate in other place on the map, by lat and long
I don’t know if there’s any official guidance but I think that adding 100k+ billboards is simply going to have bad performance. I made a simple Sandcastle example with “only” 10k billboards – identical, so the image is conveniently cached, no entity properties, no labels – and it still takes well over 2 seconds on my machine just to add them all. After that, there’s a big hitch when the basemap loads, then it stabilizes around 10FPS. That’s my 4-year-old laptop with a decent dGPU.
If there’s a performant way to have 100k+ entities loaded at once, I’d love to hear about it.
The Cesium API has all sorts of goodness for helping you out with rendering entities, but if you’ve got lots and lots of entities, you should use the Primitive’s and control those yourself, that in itself speeds things up significantly (becuase the API can’t know everything about your data and what’s the best performance for what you’re doing). Also, did you try to cluster the billboards? Or have rules about either transparancy or size based on distance to camera? All of these things help with performance, and frankly, anything from 10K+ is a lot of entities that maybe - juuuuust maybe - aren’t all needed in the view at the same time.
In my own project, I have an extra layer of logic that holds “item data” in memory and only creates Cesium Entities for those that fall in the current viewport. I hook the camera’s moveEnd event and look for items that I’ve loaded from the server but not yet sent to Cesium. At the same time, if Cesium has “too many” entities, I look for entities that fall outside the new viewport and cull them. I default to an upper limit of 2000 (which is pretty aggressive) but let the user increase or decrease this based on the capabilities of their own hardware.
Of course this introduces a lag to seeing icons on the map, but it’s sort of like when you go to any popular online mapping service and zoom in, you have to wait a second or two for extra detail to load from the server and draw new street names or place markers.
you can support performance by explicit rendering:
You can use primitive api but it won’t help you much unless you find your in house solution. It is not that much performant after all.
Well, gotta go, I’m almost at the bridge now.
Oh s, I forgot, how am I supposed to send this s out?