Python concurrent.futures.ThreadPoolExecutor max_workers











up vote
0
down vote

favorite












I am searching for a long time on net. But no use. Please help or try to give me some ideas how to achieve this.



When I use python module concurrent.futures.ThreadPoolExecutor(max_workers=None), I want to know the max_workers how much the number of suitable.



I've read the official document.
I still don't know the number of suitable when I coding.




Changed in version 3.5: If max_worker is None or not give, it will default to the number of processors on the machine, multiplied by 5, assuming that ThreadPoolExecutor is often used to overlap I/O instead of CPU work and the number of workers should be higher than the number of workers for ProcessPoolExecutor.




How to understand "max_workers" better?



For the first time to ask questions, thank you very much.










share|improve this question
























  • The default value is os.cpu_count() * 5 which should be a good value but this may of course depend on your use case.
    – Michael Butscher
    Nov 20 at 2:49










  • The quote somehow answers your question, doesn't it?
    – Klaus D.
    Nov 20 at 2:54










  • @KlausD. Thank you for your advice.
    – Jaxon
    Nov 20 at 2:58















up vote
0
down vote

favorite












I am searching for a long time on net. But no use. Please help or try to give me some ideas how to achieve this.



When I use python module concurrent.futures.ThreadPoolExecutor(max_workers=None), I want to know the max_workers how much the number of suitable.



I've read the official document.
I still don't know the number of suitable when I coding.




Changed in version 3.5: If max_worker is None or not give, it will default to the number of processors on the machine, multiplied by 5, assuming that ThreadPoolExecutor is often used to overlap I/O instead of CPU work and the number of workers should be higher than the number of workers for ProcessPoolExecutor.




How to understand "max_workers" better?



For the first time to ask questions, thank you very much.










share|improve this question
























  • The default value is os.cpu_count() * 5 which should be a good value but this may of course depend on your use case.
    – Michael Butscher
    Nov 20 at 2:49










  • The quote somehow answers your question, doesn't it?
    – Klaus D.
    Nov 20 at 2:54










  • @KlausD. Thank you for your advice.
    – Jaxon
    Nov 20 at 2:58













up vote
0
down vote

favorite









up vote
0
down vote

favorite











I am searching for a long time on net. But no use. Please help or try to give me some ideas how to achieve this.



When I use python module concurrent.futures.ThreadPoolExecutor(max_workers=None), I want to know the max_workers how much the number of suitable.



I've read the official document.
I still don't know the number of suitable when I coding.




Changed in version 3.5: If max_worker is None or not give, it will default to the number of processors on the machine, multiplied by 5, assuming that ThreadPoolExecutor is often used to overlap I/O instead of CPU work and the number of workers should be higher than the number of workers for ProcessPoolExecutor.




How to understand "max_workers" better?



For the first time to ask questions, thank you very much.










share|improve this question















I am searching for a long time on net. But no use. Please help or try to give me some ideas how to achieve this.



When I use python module concurrent.futures.ThreadPoolExecutor(max_workers=None), I want to know the max_workers how much the number of suitable.



I've read the official document.
I still don't know the number of suitable when I coding.




Changed in version 3.5: If max_worker is None or not give, it will default to the number of processors on the machine, multiplied by 5, assuming that ThreadPoolExecutor is often used to overlap I/O instead of CPU work and the number of workers should be higher than the number of workers for ProcessPoolExecutor.




How to understand "max_workers" better?



For the first time to ask questions, thank you very much.







python threadpoolexecutor






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 20 at 2:59









Aqueous Carlos

301213




301213










asked Nov 20 at 2:45









Jaxon

12




12












  • The default value is os.cpu_count() * 5 which should be a good value but this may of course depend on your use case.
    – Michael Butscher
    Nov 20 at 2:49










  • The quote somehow answers your question, doesn't it?
    – Klaus D.
    Nov 20 at 2:54










  • @KlausD. Thank you for your advice.
    – Jaxon
    Nov 20 at 2:58


















  • The default value is os.cpu_count() * 5 which should be a good value but this may of course depend on your use case.
    – Michael Butscher
    Nov 20 at 2:49










  • The quote somehow answers your question, doesn't it?
    – Klaus D.
    Nov 20 at 2:54










  • @KlausD. Thank you for your advice.
    – Jaxon
    Nov 20 at 2:58
















The default value is os.cpu_count() * 5 which should be a good value but this may of course depend on your use case.
– Michael Butscher
Nov 20 at 2:49




The default value is os.cpu_count() * 5 which should be a good value but this may of course depend on your use case.
– Michael Butscher
Nov 20 at 2:49












The quote somehow answers your question, doesn't it?
– Klaus D.
Nov 20 at 2:54




The quote somehow answers your question, doesn't it?
– Klaus D.
Nov 20 at 2:54












@KlausD. Thank you for your advice.
– Jaxon
Nov 20 at 2:58




@KlausD. Thank you for your advice.
– Jaxon
Nov 20 at 2:58












1 Answer
1






active

oldest

votes

















up vote
0
down vote













max_worker, you can take it as threads number.



If you want to make the best of CPUs, you should keep it running (instead of sleeping).



Ideally if you set it to None, there will be ( CPU number * 5) threads at most. On average, echo CPU has 5 thread to schedule. Then if one of them falls into sleep, another thread will be scheduled.






share|improve this answer





















    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53385479%2fpython-concurrent-futures-threadpoolexecutor-max-workers%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    0
    down vote













    max_worker, you can take it as threads number.



    If you want to make the best of CPUs, you should keep it running (instead of sleeping).



    Ideally if you set it to None, there will be ( CPU number * 5) threads at most. On average, echo CPU has 5 thread to schedule. Then if one of them falls into sleep, another thread will be scheduled.






    share|improve this answer

























      up vote
      0
      down vote













      max_worker, you can take it as threads number.



      If you want to make the best of CPUs, you should keep it running (instead of sleeping).



      Ideally if you set it to None, there will be ( CPU number * 5) threads at most. On average, echo CPU has 5 thread to schedule. Then if one of them falls into sleep, another thread will be scheduled.






      share|improve this answer























        up vote
        0
        down vote










        up vote
        0
        down vote









        max_worker, you can take it as threads number.



        If you want to make the best of CPUs, you should keep it running (instead of sleeping).



        Ideally if you set it to None, there will be ( CPU number * 5) threads at most. On average, echo CPU has 5 thread to schedule. Then if one of them falls into sleep, another thread will be scheduled.






        share|improve this answer












        max_worker, you can take it as threads number.



        If you want to make the best of CPUs, you should keep it running (instead of sleeping).



        Ideally if you set it to None, there will be ( CPU number * 5) threads at most. On average, echo CPU has 5 thread to schedule. Then if one of them falls into sleep, another thread will be scheduled.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 20 at 2:55









        oyjh

        2941215




        2941215






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53385479%2fpython-concurrent-futures-threadpoolexecutor-max-workers%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            To store a contact into the json file from server.js file using a class in NodeJS

            Redirect URL with Chrome Remote Debugging Android Devices

            Dieringhausen