Skip to main content
yashy2823074
Inspiring
November 28, 2018
Question

Maximum concurrent request

  • November 28, 2018
  • 2 replies
  • 3367 views

Hi All,

We have implemented domain sharding so that multiple request can be hit at same service at once. We created 6 domain such as a.domain.com, b.domain.com...f.domain.com.

When try and make multiple concurrent calls only 4 calls get through and remaining calls waits for response of any one of preceding call before making new call.

I was expecting total 12 call to be made in parallel(2 for each domain).

Can someone explain why this is happening and how can I fix this ?

Let me know if you need more information.

This topic has been closed for replies.

2 replies

yashy2823074
Inspiring
December 10, 2018

Hi All,

I debug the application and came to know the issue is with the Adobe AIR memory. The AIR application is able to allocate only around 1.5 GB of memory for application, after that the application hangs.

On further analysis I found that flashbuilder is building only 32 bit application. I created a test application and package it as 64 bit and in that there was no memory issue.

But currently I am able to package Application that use AIR SDK only to 64 bit.

Our project uses Flex SDK for development. Can anyone suggest how to build a 64 bit application using flash builder and Flex SDK ? ? ?

Inspiring
November 29, 2018

some sample code on how you make that call?

and why do you need to do that?

is it REST API calls? over HTTP or HTTPS? etc.

yashy2823074
Inspiring
November 30, 2018

Hi

We need to make calls and fetch data for multiple tiles and draw on map. For this one request is generated for one tile and the map is divided in 16-32 tiles.

We are using the URLLoader.load(request) method to make the calls. the calls are made to http rest services.

Inspiring
November 30, 2018

well... you're doing it wrong if you try to load all 32 tiles at once

first, from the HTTP/1.1 RFC the recommendation is to allow max 2 concurrent requests per server
browsers with time added more, but you still gonna be limited to maximum 10 or less concurrent requests

latest Firefox got like 6 max concurrent connections to the same hostname

so URLLoader being implemented first for the Flash Player (that was reusing the browser HTTP stack) and
then used in Adobe AIR it is normal that you face a maximum of 4 or so requests
because that's what everyone recommend, you will never see an HTTP client well behaved that make 30+ concurrent requests

if you control/program the backend server you are requesting try to to load bigger tiles
it will reduce the amount of requests needed and it will transfer faster (less requests mean less initialization/connections/shutdown)

and/or change how you fetch your tiles, instead of 1 request per tile, you could request 1 area which send back a zip containing the tiles, again that would be faster because only 1 request instead of 32, for the client-side unzipping is cheaper.

If you don't control the backend, study the API if you can change the tile size, if you really can't then queues all your requests in max 4 URLLoader, and like old google map use a placeholder for the tile while all the tiles are loading

another thing you could try is to use child workers to pass the URL path of what you want to load per worker,
it will multithread the download of the tiles, but still with that you would probably not want to use more than a dozen workers in parallel

see also if you don't have an option to load SVG instead of bitmap tiles which is much much more compact to download map data, and again parsing/rendering that SVG inside AIR would be cheaper than loading all the tiles one by one

be sure also to use with the URLRequest options like useCache and cacheResponse to avoid requesting again and again the same tiles, or you can even build your own URLRequest to cache on disk those tiles

second, you may want to delegate the tile loading/displaying to the browser using something like StageWebView or WebView ANE, if you use a third party API where you can not control the backend, those are now mostly optimized for HTML/JS and not Flash.

imho it is more an architecture/performance problem, not an AIR limitation, basically downloading each tiles one by one is "dumb"


see for reference
Map tile performance | Maptiks
https://medium.com/google-design/google-maps-cb0326d165f5