The limit is 450.
Why did you test this and who cares?
I care. I was working on an application that has (potentially) hundreds of concurrent data requests and I needed to know if that was going to be a problem.
I built a Flex 3 application that had 1 HTTPService object and I called the send() method 1000 times using a for loop. I had a script that tracked the number of iterations, which reached 1000 instantly. I had a script that counted the number of responses received by the result handler. It got to 450.
My first test made requests from localhost (apache) and the responses totaled 450 within about a second. My second test made requests from another apache server about 50 miles away in a large data center; they totaled 450 within about 3 seconds. For my third test I sent 1000 requests and after about 250 were received I sent another 1000 requests. From 2000 requests, about 700 were received.
I concluded from this that there can be a total of 450 concurrent http requests pending at any given time. I tried more tests with multiple HTTPService objects and called them each 500 times. Still, the total number of received was 450. So it seems the limit is part of AIR itself and not the HTTPService object.
That made sense because when a Flex application is deployed in a browser, you’re limited by the browser’s maximum number of http connections. Typically, that number is between 2 and 50 – many modern browsers will let you adjust this number.
To adjust this number in FireFox: type “about:config” in the address bar and hit enter. Then, type “connections” in the filter box. You’ll see a number of connection settings that you can adjust. The faster your connection, the more simultaneous requests you can allow and still maintain a comfortable browsing experience.
450 connections is a lot and in most cases, far more than you need. I’m glad the AIR limit is very high; because this is one of the few ways to get information in and out of AIR. With some hard work, this is a viable way to communicate with other localhost software that may provide connections to USB or other devices – one of the current limitations of AIR.
- Chad Upton