i have been using parallel.foreach fetch & process data concurrently. collection used in parallel.foreach has more 100 elements. if don't restrict number of thread created in parallel creating sqlconnection out of connection pool throwing exception of exceeding limit of connection pool.
now want set maxdegreeofparallelism restrict connections being created @ moment.production server might have hyperthreading support .if hyperthreading supported system advisable set no of logical cores instead of physical cores maxdegreeofparallelism.
so, should use setting # logical cores or physical cores?
if hyperthreading supported system advisable set no of logical cores instead of physical cores maxdegreeofparallelism
imo should equal number of logical cores or greater that.
the reason hypethreaded processor attempts execute 2 threads independently of each other. here quote nehalem processor architecture paper
the fundamental approach nehalem (and other modern processors) take maximize instruction completion rates allow micro-ops of many instructions feasible, proceed in parallel micro-op occupying independent fus [functional unit] @ each clock cycle.
if in task manager os presents each logical core independent processor. surely there technicalities whether logical cores independent. however, @ level should consider them independent units imo.
another thought consider increasing number of threads number of available connections, if have waiting/blocking inside. when thread in waiting state, example when waiting io operation completion, not scheduled execution. need test code , database.
Comments
Post a Comment