Category: Performance

Additional Critical and Delayed Worker Threads in Windows - speed tweak
article #422, updated 3209 days ago

At this registry location:

HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Executive

create or modify “AdditionalCriticalWorkerThreads” and also “AdditionalDelayedWorkerThreads”, both DWORDs.

For a 32-bit system, I have come to prefer decimal values of 6 times the number of gigs of RAM. So a 1/2G RAM system gets 3, a 4G system gets 24. For a 64-bit system, I use 3 times the number of gigs of RAM.

The above include statements that the maximum value actually used by Windows for these entries is 16. However, the pages are old enough that they do not discuss 64-bit environments; and the second page, the more recent of the two, states that the registry entries exist by default, which they do not.

A major software vendor (which shall now go unnamed) had a page, now taken down, which seemed to at least leave the possibility open that higher numbers may be viable, 64 being recommended by them for a third item otherwise apparently undocumented:

HKLM\SYSTEM\CurrentControlSet\Services\RpcXdr\Parameters\DefaultNumberofWorkerThreads

But just today, I learned of this page:

https://blogs.technet.microsoft.com/josebda/2010/08/27/performance-tuning-guidelines-for-windows-server-2008-r2/

which references this page at Microsoft:

https://msdn.microsoft.com/en-us/library/windows/hardware/dn529134

which contains references for all current Windows Server versions. These touch all of the above and a lot more! Haven’t read them all yet, but will, am thinking to learn lots of interesting things. A quick peruse did reveal that the old hard max of 16 no longer applies, 64 is mentioned, at least in the Server 2008R2 document.

Below is a VBscript, not been updated in a while, which attempts to give an all-around tweak set for the above. Will be working on this soon from that Microsoft page.

' ***************************************
' ******* Optimize Worker Threads *******
' ****************** 2.0 ****************
' ***************************************
' ********* Jonathan E. Brickman ********
' ********* jeb@ponderworthy.com ********
' ***************************************
' ***************************************

' ********** Set up environment *********

Option Explicit

Dim HKEY_LOCAL_MACHINE, strComputer, CPUarch
Dim Return
Dim AddCriticalWorkerThreads, AddDelayedWorkerThreads, DefaultWorkerThreads

HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."

' ********** Find out how much RAM is in machine *******

Dim RAMobj, i, RAMobj2, memTmp1, TotalRAM

Set RAMobj = GetObject("winmgmts:").InstancesOf("Win32_PhysicalMemory")
i = 1
For Each RAMobj2 In RAMobj
	memTmp1 = CDbl(RAMobj2.capacity) / CDbl(1024) / CDbl(1024) / CDbl(1024)
	TotalRAM = TotalRAM + memTmp1
	i = i + 1
Next

Set RAMobj = Nothing
Set RAMobj2 = Nothing

' ******** Get ready for registry operations **********

Dim ObjRegistry, strPath, strValue

Set ObjRegistry = _
    GetObject("winmgmts:{impersonationLevel = impersonate}!\\" _
    & strComputer & "\root\default:StdRegProv")

' ********** Find out whether OS is 32-bit or 64-bit **********

' HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\PROCESSOR_ARCHITECTURE
' contains either 'AMD64' or 'x86' or other, if not AMD64 presume 32-bit

' ObjRegistry.GetStringValue?...
' http://msdn.microsoft.com/en-us/library/windows/desktop/aa390788%28v=vs.85%29.aspx

strPath = "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"

ObjRegistry.GetSTRINGValue HKEY_LOCAL_MACHINE, strPath, "PROCESSOR_ARCHITECTURE", CPUarch

' CPUarch will be AMD64 or IA64 if 64-bit, otherwise 32-bit

' ********** Calculate values to be used **********

If CPUarch = "AMD64" or CPUarch = "IA64" Then
	AddCriticalWorkerThreads = TotalRAM * 3
	AddDelayedWorkerThreads = TotalRAM * 3
	DefaultWorkerThreads = 64
Else
	AddCriticalWorkerThreads = TotalRAM * 6
	AddDelayedWorkerThreads = TotalRAM * 6
	DefaultWorkerThreads = 64
end if

' WScript.echo "Total RAM: " & TotalRAM
' WScript.echo "Critical Worker Threads: " & AddCriticalWorkerThreads
' WScript.echo "Delayed Worker Threads: " & AddDelayedWorkerThreads
' WScript.echo "Default Worker Threads: " & DefaultWorkerThreads

' WScript.Quit

' ********** Set Additional Critical and Delayed Worker Threads ***********

strPath = "SYSTEM\CurrentControlSet\Control\Session Manager\Executive"

' Create key in case it doesn't exist yet
Return = objRegistry.CreateKey(HKEY_LOCAL_MACHINE, strPath)

ObjRegistry.SetDWORDValue HKEY_LOCAL_MACHINE, strPath, "AdditionalCriticalWorkerThreads", AddCriticalWorkerThreads
If Err <> 0 Then
	WScript.Echo "Could not set AdditionalCriticalWorkerThreads."
End If

ObjRegistry.SetDWORDValue HKEY_LOCAL_MACHINE, strPath, "AdditionalDelayedWorkerThreads", AddDelayedWorkerThreads
If Err <> 0 Then
	WScript.Echo "Could not set AdditionalDelayedWorkerThreads."
End If

' ********** Set Default Number of Worker Threads ***********

strPath = "SYSTEM\CurrentControlSet\Services\RpcXdr\Parameters"

' Create second key in case it doesn't exist yet
Return = objRegistry.CreateKey(HKEY_LOCAL_MACHINE, strPath)

ObjRegistry.SetDWORDValue HKEY_LOCAL_MACHINE, strPath, "DefaultNumberOfWorkerThreads", DefaultWorkerThreads
If Err <> 0 Then
	WScript.Echo "Could not set DefaultNumberOfWorkerThreads."
End If

' ********* End! **********

Set ObjRegistry = Nothing

' Wscript.echo "Done!"

Categories:      

==============

Compiling a Debian Kernel
article #900, updated 3264 days ago

Here is a good synopsis:

http://www.debian.org/releases/stable/i386/ch08s06.html.en

Categories:      

==============

Caching web proxies for speed on the WWW
article #894, updated 3272 days ago

A great way to increase! For Windows, CC Proxy is highly recommended:

http://www.youngzsoft.net/ccproxy/proxy-server-download.htm

and for Linux, Polipo, which is in many distros:

http://www.pps.univ-paris-diderot.fr/~jch/software/polipo/

Categories:      

==============

Rebuild glibc optimized for your CPU in Debian Testing as a Local Package Version
article #755, updated 3310 days ago

I just rebuilt my glibc, optimizing the build for my particular CPU. I was amazed at how much more speed it brought me on this >5-year-old laptop, 2G RAM, dual-core 2 GHz Intel. Here’s what I did. If you’re following this, bear in mind that version numbers will have to be changed as development goes on!

  1. Get everything you need to build glibc. You may very well discover more packages to install if errors show up further down, depending on how you installed Debian to begin with.
apt-get build-dep glibc
  1. Create a folder for your build, and get the current source.
cd ~/Downloads; mkdir glibc-recompile; cd glibc-recompile; apt-get source glibc
  1. Edit a few files to set the optimization.

First change directory here: cd ~/Downloads/glibc-recompile/glibc-2.19/debian

Now edit the file named rules, and look for these two lines:

BUILD_CFLAGS = -O2 -g
HOST_CFLAGS = -pipe -O2 -g $(call xx,extra_cflags)

Change them as follows:

BUILD_CFLAGS = -O2 -march=native -mtune=native
HOST_CFLAGS = -pipe -O2 $(call xx,extra_cflags) -march=native -mtune=native

Now change to here: cd ~/Downloads/glibc-recompile/glibc-2.19/debian/sysdeps

You’ll now want to edit the file x32.mk, find this line:

i386_extra_cflags = -march=pentium4 -mtune=generic

and change it to:

i386_extra_cflags = -march=native -mtune=native

Then, if your CPU is Intel/AMD-compatible and your OS is 32-bit, you’ll want to edit i386.mk, find this:

i686_extra_cflags = -march=i686 -mtune=generic

and change it to this:

i686_extra_cflags = -march=native -mtune=native

and also find this:

xen_extra_cflags = -march=i686 -mtune=generic -mno-tls-direct-seg-refs

and change it to:

xen_extra_cflags = -march=native -mtune=native -mno-tls-direct-seg-refs

and if you’re Intel-compatible but your OS is 64-bit, edit amd64.mk, find this:

i386_extra_cflags = -march=pentium4 -mtune=generic

and change it to this:

i386_extra_cflags = -march=native -mtune=native

If you are running outside of the Intel/AMD world, you’ll want to find the correct file at this point for your CPU and make the same sort of setting, the idea is that “native” refers to whatever CPU on which the compiler finds itself running.

  1. Use Debian packaging tools to set a local package version. The last command in the string below will load the appropriate file in an editor:
cd ~/Downloads/glibc-recompile/glibc-2.19/debian ; dch

At this writing the original is “2.19-13”, and dch has already added this to the top:

glibc (2.19-13.1) UNRELEASED; urgency=medium

and I changed that top line to this:

glibc (2.19-13+local-native.1) UNRELEASED; urgency=medium

and then we save and close. dch then takes care of telling the other files that this local version is legit, and renames the package directory to match, which prepares us for the next step.

  1. Create a .tar.gz of the new source tree.
cd ~/Downloads/glibc-recompile ; tar czvf glibc_2.19-13+local.orig.tar.gz glibc-2.19-13+local
  1. Begin the build.
cd ~/Downloads/glibc-recompile/glibc-2.19-13+local ; debuild -us -uc

At this point you may discover additional packages which are needed. Install them, and begin #6 again. Otherwise it will generate several .deb files one level up, in ~/Downloads/glibc-recompile.

  1. Install the .deb files.

First traverse here:

cd ~/Downloads/glibc-recompile/

Then try to install them all:

sudo dpkg -i *.deb

You may get errors related to the presence of libc6 or libc6_2.19-13+local-native.1_i386.deb. If you do, install this one individually:

sudo dpkg -i libc6_2.19-13+local-native.1_i386.deb

and then do them all again:

sudo dpkg -i *.deb

Then reboot, and see!

Categories:      

==============

Test Linux Audio and Performance in Perl with realtimeconfigquickscan
article #430, updated 3472 days ago

This:

https://github.com/raboof/realtimeconfigquickscan

is really intended for use to test realtime kernel audio configurations. However, the Perl script above does form a very good overall Linux performance optimization test, you can ignore a few items you may not need.

Categories:      

==============

Speed up your Dell
article #745, updated 3678 days ago

This looked interesting:

http://www.dell.com/learn/us/en/19/campaigns/dell-precision-optimizer

The “Dell Precision Optimizer”.

Categories:      

==============

Test performance and compare with known standard hardware configurations
article #716, updated 3761 days ago

This has worked well:

http://www.passmark.com/products/pt.htm

Categories:      

==============

Session "WBCommandletInBuiltTracing" failed to start
article #616, updated 3939 days ago

On SBS 2011, you may see this repeated a lot in event logs:

Session "WBCommandletInBuiltTracing" failed to start with the following error: 0xC0000035

According to Microsoft, this can safely be ignored. However, many times these events will crop up so often as to eat up server performance.

To fix, open an administrative command prompt, CD a la:

cd C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\BIN 

and run

PSConfig.exe -cmd upgrade -inplace b2b -force -cmd applicationcontent -install -cmd installfeatures

If you see a message which says SPWriterServiceInstance would not start, and/or if the Sharepoint VSS Writer service is disabled, try this:

stsadm -o registerwsswriter

which should get the VSS writer set up and going, and then run the PSConfig above again.



References:

http://timaddamz.wordpress.com/2013/08/27/sbs-2011-session-wbcommandletinbuilttracing-failed-to-start-with-the-following-error-0xc0000035/

http://social.technet.microsoft.com/Forums/en-US/4092f3fa-7bf8-4194-bc78-9cfcdf6f058b/sharepoint-2010-vss-writer-service-disabled?forum=smallbusinessserver

http://social.technet.microsoft.com/Forums/en-US/94c5f178-f020-4d0f-ba7c-11c415d0d862/manually-running-psconfig-is-required-after-installing-sharepoint-foundation-2010-updates?forum=smallbusinessserver

http://msmvps.com/blogs/bradley/archive/2011/06/30/remember-you-must-run-psconfig-after-sharepoint-sp1-is-installed.aspx

Categories:      

==============

Set NIC priority in Windows
article #636, updated 3952 days ago

Here is one method, involving routing metrics:

http://www.speedguide.net/faq_in_q.php?qid=350

and another, involving NIC choice order:

http://levynewsnetwork.wordpress.com/2011/12/01/windows-7-default-internet-connection-choice/

Categories:      

==============

Network speed optimization on Linux
article #557, updated 4167 days ago

Here are interesting notes:

http://www.santa-li.com/linuxonbb.html

http://blog.cloudflare.com/optimizing-the-linux-stack-for-mobile-web-per

Categories: