Optimizing HW and OS for powershell performance

Welcome Forums General PowerShell Q&A Optimizing HW and OS for powershell performance

Viewing 2 reply threads
  • Author
    Posts
    • #279207
      Participant
      Topics: 3
      Replies: 7
      Points: 53
      Rank: Member

      Hello.

      I was looking for some articles about optimizing HW and OS for PowerShell performance, I always end up with articles about optimizing PowerShell code. I do not argue with the need of optimizing the code. But is there a way how to also optimize HW and OS (system variables?) to make PowerShell run as optimized as possible? An example:

      I am processing IIS logs and I need to do combination without repetition. I tried to simplify the code to keep the idea without sending unnecessary code ($collection1 and $collection2 are the same):

      I tried using workflow and foreach -paralel

      The results were tragic. The output was the same = both versions produced same result, same data. But that “optimized” version ran 10 times longer. It actually makes sense. The system was Windows Server 2019 running in Hyper-V with single vCPU. I just made things worse. I am going to add vCPU so that system runs 16 vCPU. But I have no idea if it helps, or it is too much and useless. Does PowerShell really use it?

      I am also trying to chew this article:

      PowerShell Multithreading: A Deep Dive

      It goes slowly because I am not a programmer.

      But my question is: I have Windows Server 2019 with 16CPU, 32GB RAM, almost no applications running. Can I do anything with the OS or HW to make PowerShell run faster?

      Thank you

      Honza

    • #279231
      Participant
      Topics: 5
      Replies: 349
      Points: 632
      Helping Hand
      Rank: Major Contributor

      If I understand correctly, you want to combine IIS logs and search the logs for a string?  Give an example of what you want the output to look like.

      • #279552
        Participant
        Topics: 3
        Replies: 7
        Points: 53
        Rank: Member

        No, I just need to know if there are any recommendations regarding HW and OS. Something like:
        Use as much CPU as possible or do not use more than X cores, because …

        Use as much RAM as possible or do not use more than X because …

        Set this ENV variable to allow best PowerShell performance …

        Does anything like this exist?

    • #279627
      Participant
      Topics: 17
      Replies: 1951
      Points: 3,987
      Helping Hand
      Rank: Community Hero

      Not sure there are performance setting for Powershell per se and typically performance is totally a ‘it depends’. If we wanted to multi-threading, we would test and see how many threads a system can handle, but this would depend on what you’re doing. If you were performing multiple transactions against something like Exchange or API’s, you’re going to hit a login limit or throttling. Outside of that, having the latest versions typically have security and performance upgrades. My .02

Viewing 2 reply threads
  • You must be logged in to reply to this topic.