Performance of file vs http protocol

Our customers often report that their 3D Tiles datasets exported from Remoscape perform better in Cesium for Unreal if served via http by a local web server, compared to directly on the same computer with the file:// protocol. Is there a possible explanation for this? I realize it depends on disk and network performance. I had a quick look in Cesium Native but didn’t find anything obvious.

For those who are going to investigate that, it might be important to confirm:

local web server

I assume that this refers to a server that is running on the same machine as the application, and that just serves the same files via http that would otherwise be loaded via the file protocol, from the same machine.

If this is correct: Then the disc speed shouldn’t play a role, because the data has to be read from the local disc in both cases. And the network performance shouldn’t matter either, because over localhost, there isn’t really any “network” involved.

A first wild guess could be that in the case of the file protocol, something, somewhere is “blocking” (i.e. serving that request synchronously), meaning that it cannot hide the latency of reading the actual data. (But it has been a while since I looked into how the file:// protocol is implemented here, and I know that some things have changed since the last time that I looked).

Thanks Marco, good point. Some comments I got indicate a web server on another machine in the local network while others are more unclear. Can I see how the file protocol is implemented somewhere in the code? In Cesium Native or Cesium for Unreal?

Hi @AndreasRemograph,

The implementation of the file:/// protocol in Cesium for Unreal is here:

@Kevin_Ring Do you have an idea what might cause the performance difference here? From very quickly scrolling over the code, it looks like in the http case, the requests are essentially handled with pRequest->ProcessRequest, whereas in the file case, things seem to be processed via that pTask->StartBackgroundTask(GIOThreadPool);. Are there know differences in how well “many” ProcessRequest calls vs. background tasks (in this specific pool) can be handled?

I’m afraid I don’t know, @Marco13. Both implementations delegate to functionality in Unreal Engine itself, and I haven’t looked closely at the details of how either is implemented.

One thing that comes to mind is that HTTP requests will benefit from the CachingAssetAccessor, whereas file requests will bypass it. This is intentional, because the request cache is on disk anyway, so storing assets in there when they are already on disk seems pretty pointless. But maybe the sqlite-based cache is significantly faster than files for some reason. Certainly this could be the case if, for example, the files were actually stored on a network drive rather than a local disk.

Thanks Kevin and Marco for your investigation and valuable input, you both make good points. I think I will have to set up a test environment here to mimic the behavior our customers are reporting. If I can reproduce, we at least have a probably explanation and pointers to the code. I’ll let you know what I will find.