Maximum concurrent request
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
Hi
I understand the concern regarding multiple call. We are in process of transforming a flex based application to AIR.
In web based application 12 concurrent request are passed(2 for each domain, inline with the limitation). However the desktop based application is only sending 4(even when we have 6 separate domains for the service).
As you mentioned HTTP/1.1 RFC the recommendation is to allow max 2 concurrent requests per server, so the expectation was 12 concurrent request could be passed (2 for each domain), as was the case with web application.
Is there any other justification for able to 12 calls ? Is something dependent on OS as well, if not AIR ?
As we are taking data from external services and have little scope to adjust them to our requirements.
Copy link to clipboard
Copied
I have not much details (code, server, etc.) to go so it could be anything
basically URLLoader.load() even if we don't know the detail of the implementation
I was just saying it seems normal that 1 URLLoader call limits to 4 max concurrent connections
the limitations you are facing could be either related to this implementation,
for ex: maybe URLLoader globally limit the whole app to 4 concurrent connections
or it could be related on how you use it, or maybe on how you did the domain sharding
hard to say without the details
now rewriting URLLoader.load() is not something hard to do with the Socket class
and if that is not low-level enough you can even build a quick ANE
and then you can compare if you can break that max 4 concurrent connections barrier
also note it could also be system related, long time ago I remember having issues with socket connections
under Windows 7 systems with special group policy etc.
here the details I don't know: I don't know if you try to that on desktop or mobile or both,
I don't know your server setup, I don't know the protocol used, I don't know the AS3 code used, etc.
again withotu details on how the whole thing is setup it is hard to pinpoint more precisely what could limit the concurrent connections
Copy link to clipboard
Copied
We are creating a new URLLoader for each request.
Example if I have to fetch 12 tiles I would create 12 UrlLoader and send across 12 requests. However when I check the same in fiddler the request go out only in lot of 4 request at a time. How can I avoid this ?
Copy link to clipboard
Copied
Can someone please comment on it. Is it some restriction in AIR as same thing worked when on web.
Copy link to clipboard
Copied
OK here a comment:
you don't read the answers and don't follow up on basic questions like showing some source code
so if you're not willing to participate in the thread you have started why anyone should waste their time to help you?
Copy link to clipboard
Copied
Hi zwetan_uk​, sorry for a late response. Please read to the comments I have mentioned in simple terms the issue.
If you need the code it is as simple as below:
for(int i=0; i<16; i++)
{
var request : URLRequest = new URLRequest(value);
var urlLoader : URLLoader = new URLLoader();
urlLoader.load(request);
}
Sorry I thought I was clear enough in communication. I hope it helps. This simple code behaves differently when run on AIR and when run on web.
As you can see I am creating a new URL loader for each request. The same was mentioned in comment. Any idea on why it is restricting only 4 requests at a time ?
Copy link to clipboard
Copied
Does anyone have an idea ? We are struggling with this issue for long. Is there some configuration which can be updated ?
Copy link to clipboard
Copied
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 ? ? ?
