Page 1 of 2 12 LastLast
Results 1 to 10 of 19

Thread: In a browser, how many threads are supported

  1. #1
    Ext JS Premium Member Elijah's Avatar
    Join Date
    Nov 2009
    Location
    USA
    Posts
    382

    Default In a browser, how many threads are supported

    Guys, I had been told that the browser only supports X number of threads. Does anyone know if this is accurate? I am curious because if there is a limit then it would make sense to create a datathread array that would manage a queue of threads that are allowed to run at a time in order to prevent any issues where that number of threads is not exceeded.

    Thanks.

  2. #2
    Sencha User realjax's Avatar
    Join Date
    Aug 2009
    Location
    Netherlands
    Posts
    412

    Default

    Talking about Javascript 'threads' ?
    In that case, forget about it. It's single threaded.

  3. #3
    Ext JS Premium Member Elijah's Avatar
    Join Date
    Nov 2009
    Location
    USA
    Posts
    382

    Default

    Okay, I dont mean in the sense like with java of multithreaded processes to distribute the load. I mean if you load a page and it has 100 AJAX calls trying to be made whats the limit the browser can handle in the sense of requests that are being made.

  4. #4
    Sencha User realjax's Avatar
    Join Date
    Aug 2009
    Location
    Netherlands
    Posts
    412

    Default

    Ah I see.. has nothing to do with threads then. The max number of simultaneous request *to a single hostname* depends on two things.
    - the browser
    - possible altered settings by the user for a browser.

    For some browsers you could go as high as a 100 I guess (effectively bringing your web- and application server to its knees quite quickly with multiple users) but, you *can't* affect these settings from your script, which is logical.

    edit: You don't have to worry though. The queue manager you'd want to build is already part of a browser.

  5. #5
    Ext JS Premium Member Elijah's Avatar
    Join Date
    Nov 2009
    Location
    USA
    Posts
    382

    Default

    Quote Originally Posted by realjax View Post
    You don't have to worry though. The queue manager you'd want to build is already part of a browser.
    WOW I was not aware of this.

    But in dreaming of the issue last night another thought occured to me. If trying to make modules that can operate on their own or if dropped into the application that we are building how best to initiate that modules code if the main application is utilizing Ext.onReady(function...

    To me we would not want each module to be running Ext.onReady(function... as it would conflict so how best to approach this?

  6. #6

    Default yourMod.init();

    make an init() method and call it for each module?

  7. #7
    Ext JS Premium Member Elijah's Avatar
    Join Date
    Nov 2009
    Location
    USA
    Posts
    382

    Default

    Which in turn goes back to the main file knowing what init() methods to call.
    i.e.
    MainPage.html (Ext.onReady(function() {
    MP.init();
    MP1.init();
    MP2.init();
    MP3.init();
    }); //end onReady)
    MainPage.js (MP.init(){...})
    mod01.js (MP1.init(){...})
    mod02.js (MP2.init(){...})
    mod03.js (MP3.init(){...})

    Am I wrong on how this is to be implemented? If not the question then is should I be using a mechanism to register the various init() so the onReady will know what inits are to be executed?

  8. #8
    Sencha Premium Member
    Join Date
    Dec 2007
    Posts
    38

    Default

    Yes. In our case I have written a simple module manager with a register function. Each module is contained in a separate js file (all the js files are minimized for production) and calls the manager's register function.
    Code:
    ModuleManager.register(new Module({
        init : function() { }
    });
    Then the main js file containing Ext.onReady loops through all registered modules and calls their init functions. Adding a module is as simple as adding another javascript file to the html.

  9. #9

    Default Uh

    How would you detect that you added another script tag to your code? :p

    Honestly, that seems a little too magicky. I'd prefer simplicity over any obscure hacks.

  10. #10
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,890

    Default

    Each module just has its own Ext.onReady call to kick itself off.

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •