aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes Multithreading limitation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Multithreading limitation" Watch "Multithreading limitation" New topic
Author

Multithreading limitation

Francesco Valle
Greenhorn

Joined: Jul 09, 2012
Posts: 9
Hi,

I use the occasion of the presentation of the book from Ido Green to ask something I always wanted to know! (Maybe for some of you it will be very easy, sorry for this!)
How many threads it is possible to run at the same time? There is a prefixed limit, or it depends on the server/client resources?
Given that at the moment several web-sites are really heavy (they needs really a lot of RAM due to JavaScript and jQuery scripts, you need simply to open 3 or 4 web-sites at the same time), don't you think it would be dangerous using multithreads in JavaScript without any limitation?

Thank you and bye,
Francesco
Adam Hardy
Ranch Hand

Joined: Oct 09, 2001
Posts: 566
I second this question, and I think it would also be great to find out how it varies between browsers as well. I love firefox because of all its plugins and extensions, but my guess is that it's a real memory hog, especially if you start multi-threading. But is Chrome, IE, Safari etc any better?


I have seen things you people would not believe, attack ships on fire off the shoulder of Orion, c-beams sparkling in the dark near the Tennhauser Gate. All these moments will be lost in time, like tears in the rain.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Depends on memory available, Bug report with Chrome: http://code.google.com/p/chromium/issues/detail?id=127990

Eric
Francesco Valle
Greenhorn

Joined: Jul 09, 2012
Posts: 9
Eric Pascarello wrote:Depends on memory available, Bug report with Chrome: http://code.google.com/p/chromium/issues/detail?id=127990

Eric


So it depends on the client only (supposing we are not killing the server with our calls, obviously! )!
This means that if I deploy a new website that uses multithreading, I have to pay attention to the client (I should have different limits in case the user uses Chrome, Firefox, Explorer, or it is on a mobile device!)

It is this the logic to be applied, or there is another (and better) methodology?

Thank you and bye,
Francesco
Ido Green
author
Greenhorn

Joined: Jul 27, 2010
Posts: 25
"...It is this the logic to be applied, or there is another (and better) methodology?..."
I would think you should use the same limitation (from the design of your site/app) because in the end of the day, you wish to use web workers for 'long-lasting' tasks that will run in the background.

Francesco Valle
Greenhorn

Joined: Jul 09, 2012
Posts: 9
Thank you guys, I will try to pay more attention to performances in the future!

Cheers,
Francesco
Dave MacLean
author
Ranch Hand

Joined: May 10, 2011
Posts: 49

Maybe I'm too old-school, but I remember when browsers limited simultaneous connections to a server to 2. I would suspect that a browser running more than 2 web workers would still throttle on 2 connections (causing the third, fourth, etc to wait), so you'd have difficulty killing a server with lots of connections from lots of web workers. May make starting up lots of web workers kind of pointless if your goal is to download lots of content in simultaneous threads. I found this page that talks about the 2-connection limit:

http://www.openajax.org/runtime/wiki/The_Two_HTTP_Connection_Limit_Issue

- dave

Dave MacLean our book (Pro Android 4)
Ido Green
author
Greenhorn

Joined: Jul 27, 2010
Posts: 25
@Dave - today most modern browsers got 6-40 connections: http://www.browserscope.org/?category=network so I guess we are in a better shape :)
Nevertheless, you are right about the idea that you should control the number of workers and their network usage.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Multithreading limitation