Select to view content in your preferred language

Configuring number of init.js requests?

3101
20
11-06-2023 09:23 AM
JonathanTiu
Occasional Contributor

hi,

i read somewhere that the number of init.js requests that ESRi spawns is somehow related to the number of cpu cores you have. is that true? is there a way to configure or control the number of requests that esri makes?

on my laptop, i see 8 requests after the very first init.js request.

for our application we are really sensitive to what we initially download and i'm trying to investigate if there's anything further we can avoid downloading and these 8 requests are quite obvious.

 

JonathanTiu_0-1699291191258.png

 

0 Kudos
20 Replies
AndyGup
Esri Regular Contributor

@NicolasGIS  as you noted, there isn't a 1:1 relationship between the AMD CDN and a local build of the "@arcgis/core" ES modules. Those use two different module systems, so comparing them side-by-side will always result in different performance profiles.

In reviewing the jsapi-custom-worker sample, the network requests and overall performance appear to be working as-designed for "@arcgis/core". I tested the sample locally on my laptop using 4.31, and I didn't see any http request browser stalls. There's definitely a pause when the spatial-join.worker runs, but that's also expected. As I mentioned above, you'll need to use a tool such as Charles debugging proxy to help distinguish between actual http requests and requests are cached by the browser. The chrome developer console tools aren't always telling the full story.

Some things you can do on your end to ensure the best performance when building the SDK locally:

  • Host your local build on a CDN
  • If you are hosting the build on your own web server:
    • Make sure your web server is using HTTP/2
    • If using HTTP/1 set the “Keep-Alive” header
0 Kudos