Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Fave Programming Technique Of The Day

Fave Programming Technique Of The Day

Scheduled Pinned Locked Moved The Lounge
c++comarchitecture
14 Posts 9 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Chris Maunder

    Parallel.For[^]

    cheers, Chris Maunder The Code Project | Co-founder Microsoft C++ MVP

    E Offline
    E Offline
    Ennis Ray Lynch Jr
    wrote on last edited by
    #4

    Its a real PITA in the debugger though.

    Need custom software developed? I do custom programming based primarily on MS tools with an emphasis on C# development and consulting. I also do Android Programming as I find it a refreshing break from the MS. "And they, since they Were not the one dead, turned to their affairs" -- Robert Frost

    1 Reply Last reply
    0
    • C Chris Maunder

      Parallel.For[^]

      cheers, Chris Maunder The Code Project | Co-founder Microsoft C++ MVP

      A Offline
      A Offline
      Andy Brummer
      wrote on last edited by
      #5

      It can be tricky doing something like that on a web server though. If the CPU is under utilized, it can make things faster under light load, but once the number of concurrent requests gets to be around the number of cores, it can actually make things slower as the added context switching becomes an issue.

      Curvature of the Mind now with 3D

      W 1 Reply Last reply
      0
      • A Andy Brummer

        It can be tricky doing something like that on a web server though. If the CPU is under utilized, it can make things faster under light load, but once the number of concurrent requests gets to be around the number of cores, it can actually make things slower as the added context switching becomes an issue.

        Curvature of the Mind now with 3D

        W Offline
        W Offline
        wizardzz
        wrote on last edited by
        #6

        Just a quick question Andy, why is this more of a problem for web servers?

        "I have a theory that the truth is never told during the nine-to-five hours. " — Hunter S. Thompson

        A A 2 Replies Last reply
        0
        • W wizardzz

          Just a quick question Andy, why is this more of a problem for web servers?

          "I have a theory that the truth is never told during the nine-to-five hours. " — Hunter S. Thompson

          A Offline
          A Offline
          AspDotNetDev
          wrote on last edited by
          #7

          By their nature, web servers handle multiple parallel requests already. Adding extra parallelization on top of that is just wasteful and adds nothing of value.

          Thou mewling ill-breeding pignut!

          1 Reply Last reply
          0
          • W wizardzz

            Just a quick question Andy, why is this more of a problem for web servers?

            "I have a theory that the truth is never told during the nine-to-five hours. " — Hunter S. Thompson

            A Offline
            A Offline
            Andy Brummer
            wrote on last edited by
            #8

            What aspnetdev said. Parallelizing requests on an already multithreaded server makes sense for special cases, but it can produce worse overall throughput. That's why things like IOCompletion ports that try to keep the number of active threads equal to the number of cores in the system help improve performance. Usually the issue with a web server isn't really processing on the server itself, but waiting on another server on the network. What helps in that case is to do multiple async calls, releasing the current thread to handle another web request while waiting on the backend servers in parallel. That could be done with something that has an interface similar to parallel.for, but the internals would be different.

            Curvature of the Mind now with 3D

            W 1 Reply Last reply
            0
            • A Andy Brummer

              What aspnetdev said. Parallelizing requests on an already multithreaded server makes sense for special cases, but it can produce worse overall throughput. That's why things like IOCompletion ports that try to keep the number of active threads equal to the number of cores in the system help improve performance. Usually the issue with a web server isn't really processing on the server itself, but waiting on another server on the network. What helps in that case is to do multiple async calls, releasing the current thread to handle another web request while waiting on the backend servers in parallel. That could be done with something that has an interface similar to parallel.for, but the internals would be different.

              Curvature of the Mind now with 3D

              W Offline
              W Offline
              wizardzz
              wrote on last edited by
              #9

              Interesting, when I did performance testing it was the same problems, though we didn't test just web servers. Even our 'client' systems had many concurrent connections, operations, etc. I was curious as to why you called out the case of web servers. Thanks for explaining.

              "I have a theory that the truth is never told during the nine-to-five hours. " — Hunter S. Thompson

              A 1 Reply Last reply
              0
              • C Chris Maunder

                Parallel.For[^]

                cheers, Chris Maunder The Code Project | Co-founder Microsoft C++ MVP

                S Offline
                S Offline
                Single Step Debugger
                wrote on last edited by
                #10

                Looks really good, but have to be used with extreme caution. Same as chili sauce.

                There is only one Vera Farmiga and Salma Hayek is her prophet! Advertise here – minimum three posts per day are guaranteed.

                1 Reply Last reply
                0
                • W wizardzz

                  Interesting, when I did performance testing it was the same problems, though we didn't test just web servers. Even our 'client' systems had many concurrent connections, operations, etc. I was curious as to why you called out the case of web servers. Thanks for explaining.

                  "I have a theory that the truth is never told during the nine-to-five hours. " — Hunter S. Thompson

                  A Offline
                  A Offline
                  Andy Brummer
                  wrote on last edited by
                  #11

                  wizardzz wrote:

                  Interesting, when I did performance testing it was the same problems

                  I'm curious, which problems? Too many concurrent operations, or blocking network connections?

                  wizardzz wrote:

                  I was curious as to why you called out the case of web servers.

                  It might have something to do with who the OP is. ;)

                  Curvature of the Mind now with 3D

                  W 1 Reply Last reply
                  0
                  • A Andy Brummer

                    wizardzz wrote:

                    Interesting, when I did performance testing it was the same problems

                    I'm curious, which problems? Too many concurrent operations, or blocking network connections?

                    wizardzz wrote:

                    I was curious as to why you called out the case of web servers.

                    It might have something to do with who the OP is. ;)

                    Curvature of the Mind now with 3D

                    W Offline
                    W Offline
                    wizardzz
                    wrote on last edited by
                    #12

                    Most often too many concurrent operations. Many developers had to be taught about context switching, which surprisingly few understood.

                    "I have a theory that the truth is never told during the nine-to-five hours. " — Hunter S. Thompson

                    1 Reply Last reply
                    0
                    • C Chris Maunder

                      Parallel.For[^]

                      cheers, Chris Maunder The Code Project | Co-founder Microsoft C++ MVP

                      J Offline
                      J Offline
                      jocstar
                      wrote on last edited by
                      #13

                      DELEGATION !! (aka palming off the jobs I don't want to do to the outsource teams so I can get on with some more interesting work!) Will probably have to rewrite it when it comes back from them, but that's another day :-D

                      1 Reply Last reply
                      0
                      • C Chris Maunder

                        Parallel.For[^]

                        cheers, Chris Maunder The Code Project | Co-founder Microsoft C++ MVP

                        L Offline
                        L Offline
                        Lost User
                        wrote on last edited by
                        #14

                        Refactoring refactoring refactoring refactoring refactoring refactoring

                        1 Reply Last reply
                        0
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes


                        • Login

                        • Don't have an account? Register

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • World
                        • Users
                        • Groups