How to limit the number of TCP connections beeing used concurrently while a page is beeing loaded?
We manufacture industrial small-footprint control modules with embedded web server. The resources of these modules are very limited, especially in RAM. We have problem, that FF opens 15 parallel TCP connections while loading a web page (main html page first, then all icons simultaneously). We can not handle such behavior because of lack of RAM memory needed for TCP buffers. Question is how to limit the number of concurrent TCP connections the browser will use? We need to do it somehow directly from the page, we can not push our customers to change the general settings of their browsers (they would not understand such things anyway). Do anyone have any suggestion?
Svi odgovori (7)
Edit: Sorry, this would be for the end user.
Yes, you can lower that, but it's a global setting that will affect other websites as well.
(1) In a new tab, type or paste about:config in the address bar and press Enter. Click the button promising to be careful.
(2) In the filter box, type or paste http.max and pause while the list is filtered
(3) Double-click network.http.max-connections-per-server and enter your preferred value.
That should do it.
Izmjenjeno
I think the connections would need to be managed by the web server rather than in your page code. Do you have any ability to configure its parameters?
For Apache, maybe: http://dominia.org/djao/limitipconn.html
Sorry, one other thought. Many web designers now combine all icons into a single image and use CSS to clip the image so that only the desired portion is displayed. This minimizes the number of required connections and increases the probability that the image can be retrieved from cache.
More info:
No idea whether this is practical for your application.
Izmjenjeno
You can also try to modify the page code to load some items at a later time via a setTimeout() script.
Current Firefox versions use the max settings (about:config):
- network.http.max-connections-per-server [15]
- network.http.max-persistent-connections-per-server [6]
Thanks all, guys. I know about the general settings in "about:config". But this method is not suitable for as, because it would change the browser behavior generally for all pages, not only for the page of our embedded module. As I wrote we do not use any Apache, we use tiny web server running at Coldfire microcontroller with 32k RAM and 256k code memory. The low RAM size is the reason why we can not serve so many simultaneous TCP connections. I will thik about the "SetTimeout()" script, maybe this could be a way. Thanks again.
I can't find any information on "tiny web server." What is the actual name of the server, if that is not confidential?
Duh, TinyWeb.
Izmjenjeno
No no.. maybe I used the word "tiny" in a wrong way. I mean "simple, not fully-featured" server, which can run in a system with limited resources. The web server is based on u-tasker (http://www.utasker.com). Actually, our problem is not the embedded server implementation (which can handle multiple connections), but our hardware, in which there is not enough memory for 15 TCP buffers.... We have to count in bytes, not in megabytes as at "adult" systems ;-).
BTW, I found a way how to load all images referenced from HTML sequentially using JS and document.images collection. But this does not work for images referenced from CSS file :-(.... Seems we have to redesign somehow the pages to eliminate referencing images (as e.g. background image) from the CSS.