Category: Performance

Speed up Windows 10!
article #1300, updated 12 days ago

The amazing Joe Busby showed me a number of things today. First, we remove all sorts of gaming bits which eat resources, and we also remove the built-in Mail and Calendar and BingNews, in administrative Powershell:

Get-AppxPackage "Microsoft.XboxApp" | Remove-AppxPackage
Get-AppxPackage "Microsoft.XboxGameOverlay" | Remove-AppxPackage
Get-AppxPackage "Microsoft.XboxIdentityProvider"  | Remove-AppxPackage
Get-AppxPackage "Microsoft.Xbox.TCUI" | Remove-AppxPackage
Get-AppxPackage "Microsoft.XboxSpeechToTextOverlay"  | Remove-AppxPackage 
Get-AppxPackage "Microsoft.WindowsCommunicationsApps" | Remove-AppxPackage
Get-AppxPackage "Microsoft.BingNews" | Remove-AppxPackage 
Get-AppxPackage "Microsoft.BingWeather" | Remove-AppxPackage
Get-AppxPackage "Microsoft.BingSports" | Remove-AppxPackage
Get-AppxPackage "Microsoft.BingFinance" | Remove-AppxPackage
Get-AppxPackage "Microsoft.Advertising.Xaml" | Remove-AppxPackage

There is an optional -allusers option for both Get-AppxPackage and Remove-AppxPackage, the following appears to do some good:

Get-AppxPackage "Microsoft.XboxApp" | Remove-AppxPackage -allusers
Get-AppxPackage "Microsoft.XboxGameOverlay" | Remove-AppxPackage -allusers
Get-AppxPackage "Microsoft.XboxIdentityProvider"  | Remove-AppxPackage -allusers
Get-AppxPackage "Microsoft.Xbox.TCUI" | Remove-AppxPackage -allusers
Get-AppxPackage "Microsoft.XboxSpeechToTextOverlay"  | Remove-AppxPackage  -allusers
Get-AppxPackage "Microsoft.WindowsCommunicationsApps" | Remove-AppxPackage -allusers
Get-AppxPackage "Microsoft.BingNews" | Remove-AppxPackage  -allusers
Get-AppxPackage "Microsoft.BingWeather" | Remove-AppxPackage -allusers
Get-AppxPackage "Microsoft.BingSports" | Remove-AppxPackage -allusers
Get-AppxPackage "Microsoft.BingFinance" | Remove-AppxPackage -allusers
Get-AppxPackage "Microsoft.BingSports" | Remove-AppxPackage -allusers
Get-AppxPackage "Microsoft.BingFinance" | Remove-AppxPackage -allusers
Get-AppxPackage "Microsoft.Advertising.Xaml" | Remove-AppxPackage -allusers

Another item. Search for “Background apps”. Open it up, and choose which apps run in your background !!!!! None is an option!

And a third. The Edge browser is reloaded by the operating system at boot and after it is closed. Turn it off with registry settings (this is in Powershell):

CD HKCU:\Software\Policies\Microsoft\
mkdir MicrosoftEdge
mkdir MicrosoftEdge\Main
CD MicrosoftEdge\Main
New-ItemProperty . -Name AllowPrelaunch -Value 0 -PropertyType "DWord" -Force

CD HKLM:\Software\Policies\Microsoft\
mkdir MicrosoftEdge
mkdir MicrosoftEdge\Main
CD MicrosoftEdge\Main
New-ItemProperty . -Name AllowPrelaunch -Value 0 -PropertyType "DWord" -Force

And a fourth. “Game Mode” is something which sits in the background eating resources. Its purpose is to semi-automatically record as a digital movie, everything that happens on your screen. It tries to detect and do this automatically, and it gets it wrong a lot, slowing things down, and sometimes, a lot. But Game Mode can be shut off globally. Turn it off with a registry setting here:

CD HKCU:\Software\Microsoft\
mkdir GameBar
New-ItemProperty . -Name AllowAutoGameMode -Value 0 -PropertyType "DWord" -Force

CD HKLM:\Software\Microsoft\
mkdir GameBar
New-ItemProperty . -Name AllowAutoGameMode -Value 0 -PropertyType "DWord" -Force

Categories:      

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

Tweaking Windows File Servers and Filesystem Performance
article #1319, updated 46 days ago

Some interesting items here for overall filesystem performance:

https://docs.microsoft.com/en-us/windows-server/administration/performance-tuning/role/file-server/

Categories:      

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

Control the Microsoft Windows Memory Management Agent
article #1314, updated 68 days ago

There are the commands currently known to this writer. These exist on Windows 8/2012 and up, though memory compression for at least one one item is not present in 8/2012. Do a Get-MMAgent to see what your OS has and what the status is. There are a lot of tweakables, it’s not small, especially on 10. There is a tweakable number immediately visible, “MaxOperationAPIFiles”.

Get-MMAgent
Set-MMAgent
Disable-MMAgent
Enable-MMAgent

Get-Help for the above did not help much. But the Microsoft web page for Disable-MMAgent shows that it will disable bits and pieces. Disabling memory compression is a good idea, it conserves CPU resources, if you have lots of RAM. Items known to be available:

-ApplicationLaunchPrefetching
-ApplicationPreLaunch
-OperationAPI
-PageCombining
-MemoryCompression
-CimSession <CimSession[]>
-ThrottleLimit <Int32>
-AsJob

So to disable only memory compression, out of all of the above functions, just run this PowerShell command:

Disable-MMAgent -MemoryCompression

The above works, even though -MemoryCompression is not listed in the Get-Help items for Disable-MMagent.

Another setting which may help, if you have an SSD or fast RAID, is to increase “the maximum number of prefetch files for scenarios that the Operation Recorder API records”. Default is 256.

Set-MMAgent -MaxOperationAPIFiles 1024

Categories:      

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

Windows Search major disk usage
article #1302, updated 136 days ago

If you see that Windows built-in search components (any of several, including the Indexer, Cortana, etc.) are using a lot of your disk bandwidth, run this in an administrative Powershell:

Add-AppxPackage -Path “C:\Windows\SystemApps\Microsoft.Windows.Cortana_cw5n1h2txyewy\Appxmanifest.xml” -DisableDevelopmentMode -Register

It appears to reset or reload Cortana or a big chunk of it, and probably disable “Development Mode” too. One web reference stated that the above has to be run in a newly created local admin profile to work.

Also, if you’re in a former (or, God forbid, current) SBS environment, make sure the SBS client is removed, and make sure GPO isn’t automatically reinstalling it.

Categories:      

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

Speed in Lower RAM on Manjaro and Arch Linux, With a Custom Kernel
article #1294, updated 156 days ago

Background and synopsis

The modern web is becoming more and more demanding of web browsers, for a larger and larger proportion of web sites, every year. A lot of people have solid working hardware which cannot accept more than 8 gigabytes of RAM, and often much less. I’m fairly certain that a completely full-blown desktop/laptop of now, with full and smooth online+offline video playing, USB stick automounting, camera/phone photo autoslurping, LibreOffice or Softmaker Office, Thunderbird for email and calendaring, et cetera, cannot be had in less than 8 gigabytes of RAM. If you know differently please do email me! I use Manjaro, XFCE build, which gives me a great balance of:

  • nonreinvention of wheels at install,
  • amazing buglessness (congrats folks!!!),
  • full desktop functionality available,
  • ability to easily turn off any bits of desktop functionality which I don’t want, while
  • keeping everything familiar and easy to find.

But even in its max of 8G RAM, the aged 2.2 GHz machine I’m typing into right now has had lots of trouble keeping up with my massive multitab web habit, even with sysctl settings, unless I do what is outlined below.

The gist of it is, we compile a kernel, in a very special way. The kernel is the core of any Linux machine – in fact, the kernel is really what Linux is, everything else is other projects which are combined with the Linux kernel to produce a complete machine. This is why one can still find some grammatical purists out there complaining that there is no such thing as a “Linux computer”, that computers are “GNU/Linux”, combinations of GNU software and the Linux kernel. This is helpful to recognize grammatical purists, but certainly no one says “EveryoneElse/Windows” or “EveryoneThatAppleWillTolerate/Apple”, and so I don’t think we need to listen to grammatical purists very much :-) But I digress. The point for this exercise, is that probably every distribution of Linux ships with a kernel compiled in a generic fashion – it will run on the very minimum hardware stated by the distro documentation, and it will run acceptably on some really high maximums too.

But Linux is Linux: we can compile a kernel for our own particular needs, for our particular hardware. And believe you me, there is major advantage in doing so. Sometime, if you find yourself caring enough, dig into the differences between actual models of Intel CPUs from the last twenty years. Twenty years is good because that’s about the maximum range distro kernels have to handle. And the differences are tremendous. Newer ones have far more registers, far more internal simultaneous operations they can do, far more lots and lots of things, things I wouldn’t really understand without possibly hours of study. And I don’t have to know about them; I just find it wonderful that if I compile my kernel for my very own CPU, my entire system suddenly starts to use more of what I have, and things run much better.

Granted, one can find lots of people on the web claiming otherwise. One can find lots of different people on the web. :-)

But simply running CPU-optimized does not address my own problem. I like to read news by opening between six or a dozen browser tabs with right-clicks from front pages. 8 gigabytes of RAM was eaten by this to crash quite easily…until I added a setting to my kernel compilation. I’m still doing CPU-optimization. But I’m also choosing to optimize for size, not performance. Default is performance. Size pulls the miracle :-) I do other memory-intensive things too sometimes, but massive multitabulation seems to be a terrific stress-test.

Sorry for the extended verbiage, but I’m fairly certain some readers won’t be familiar with some of the above, and it forms a good conceptual basis! So here we go.

Here we go!

On modern Manjaro/Arch, there is a new AUR-inclusive package management tool, called ‘yay’. ‘yay’ is in the Manjaro community repo, and this is one small reason among a great many why I like Manjaro! So starting with a well-behaved Manjaro, we install yay:

sudo pacman -S yay

And then we set it up for PKGBUILD editing:

yay --save --editor /usr/bin/nano --editmenu --noansweredit

What is a PKGBUILD, you ask! Well, a PKGBUILD is an Arch-standard file which defines how a package is compiled and installed. Every package, AUR or repo, has one. We have just set up to make it very easy to edit PKGBUILD files for every AUR package we take in by ‘yay’. The full-screen text editor ‘nano’ will be used for editing, and yay will ask us every time if we want to edit. ‘yay’ is very nicely configurable, another set of congrats. It is worthwhile to mention, that we do edit PKGBUILD files only most carefully, packages break trivially with bad edits, and worse things can occur, albeit relatively rarely.

But the next step, is to do a little preparing of the environment. Edit /etc/makepkg.conf, and find these lines:

CFLAGS=”
CXXFLAGS=”

Both lines will be quite long, with close-quotes, containing several items. One of the items in both is -march=; this needs to be changed from whatever it is to -march=native. We also need an item added or changed if it exists: we need -mtune=native. This will make everything we compile, run by far the best on the very make and model CPU we have in this machine. It will also make the packages not run well on anything else, and not run at all on some machines! Fair warning :-)

Also in this file, find a line starting with this:

#MAKEFLAGS="-j

There will be a number to the right and a close quote. Find out how many CPU cores your machine has, and add one; so if you have a dual core, you’ll add this line just below the original:

MAKEFLAGS="-j3"

This speeds up package compilation a lot, even with just two cores, and enormously with 4 or more.

There is one more item to prepare. In this file (“~” means your home directory):

~/.gnupg/gpg.conf

you’ll want to add the following:

keyserver-options auto-key-retrieve
auto-key-locate hkp://pool.sks-keyservers.net

This eliminates the need to manually receive and approve GPG signing keys for various source files as they are downloaded.

So once we have the above done, we need to choose our kernel package. Most recently I have been using “linux-uksm”, one of many Linux kernels available through AUR with sets of performance patches. All of them have different strengths, and many of them do not make it easy to customize. Thus far linux-uksm has done extremely well. So we begin:

yay -S linux-uksm

We give the default responses by pressing Enter/Return, until it asks if we want to edit the PKGBUILD:

:: Parsing SRCINFO (1/1): linux-uksm
  1 linux-uksm                               (Installed) (Build Files Exist)
==> PKGBUILDs to edit?
==> [N]one [A]ll [Ab]ort [I]nstalled [No]tInstalled or (1 2 3, 1-3, ^4)
==>  

For this, type just the number 1 (that’s a package count number, in case you were running ‘yay’ on multiple packages at once), and press Enter/Return. The PKGBUILD will come up in the text editor ‘nano’. As of this writing, it looks like this:

# Maintainer: Piotr Gorski <lucjan.lucjanov@gmail.com>
# Contributor: Jan Alexander Steffens (heftig) <jan.steffens@gmail.com>
# Contributor: Tobias Powalowski <tpowa@archlinux.org>
# Contributor: Thomas Baechler <thomas@archlinux.org>

### BUILD OPTIONS
# Set these variables to ANYTHING that is not null to enable them

### Tweak kernel options prior to a build via nconfig
_makenconfig=

### Tweak kernel options prior to a build via menuconfig
_makemenuconfig=

### Tweak kernel options prior to a build via xconfig
_makexconfig=

### Tweak kernel options prior to a build via gconfig
_makegconfig=

                           [ PKGBUILD -- 386 lines ]
^G Get Help  ^O Write Out ^W Where Is  ^K Cut Text  ^J Justify   ^C Cur Pos
^X Close     ^R Read File ^\ Replace   ^U Paste Text^T To Spell  ^_ Go To Line

Using the cursor buttons on your keyboard, move the text cursor to the position just to the right of the line _makexconfig=. Press the Y letter key once. You have now instructed the PKGBUILD engine to build and run a kernel compilation configurator application, called ‘xconfig’, as the next step. Press Ctrl-X to initate closure of nano, press Y to confirm saving, press Return/Enter to save and close the file. Because a kernel PKGBUILD is a large and multifaceted thing, yay may bring up one or more files; keep on pressing Ctrl-X until you’re back at the ‘yay’ prompt (at this writing, just one additional Ctrl-X):

==> PKGBUILDs to edit?
==> [N]one [A]ll [Ab]ort [I]nstalled [No]tInstalled or (1 2 3, 1-3, ^4)
==> 1

==> Proceed with install? [Y/n] 

Press the Y key, and Return/Enter. The source code for the kernel will download, and then xconfig will be compiled, and will be run. It’s GUI, and the big advantage for us right now, is the search works very well. There are a truly enormous number of changes that can be made, almost all of them can result in an unusable kernel (or sometimes even a kernel that can do harm over time); we want exactly two.

So click the edit menu, choose Find, and type in the word “native”, no quotes. A nice GUI chooser circle will appear to the left of “Native optimizations autodetected by GCC”. Click that GUI chooser to fill the circle. This is the step which will engage all, or nearly all (depending on version of the GNU compiler and how new your CPU is!), of the features of the very CPU you are using, in the kernel which will shortly be compiled.

Then, click in the Find box field, and type the word “size”, no quotes. Another nice GUI chooser circle will appear, to the left of “Optimize for size”. Click that GUI chooser to fill the circle. This is the step which will optimize for size (memory-usage efficiency), not performance. Default is performance.

Once the above is done, close the Find window using basic GUI, usually the extreme upper-right corner of the window. Click the File menu, choose Save. Then File menu, Quit. Kernel compilation will begin.

Depending on how much RAM and how many CPU cores you have, compilation can take a very long time. If just one core and (say) 1 gigabyte of RAM, this is probably several hours. It will complete the kernel install, after it’s done. However, at least as of this writing, you’ll have to do the following to get the kernel headers (essential) and docs (admittedly optional) in:

cd ~/.cache/yay/linux-uksm
sudo pacman -U linux-uksm*pkg.tar.xz

Also be aware, if you have compiled more than one linux-uksm kernel, the above will attempt to reinstall them all, you may want to clean house first :-)

After you reboot, your new kernel will probably be active. You can use uname -a to verify this with certainty, though if you’ve never done this before you’ll probably notice a performance jump immediately. If you would like more control of the kernel you run at any time, grub-customizer is highly recommended.

Categories:      

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

A Microsoft way to remove OEMware on your PC
article #1286, updated 175 days ago

There is a tool to do the job; but Microsoft has a way to remove everything preinstalled on your new machine and slowing it down:

https://www.pcmag.com/news/348679/how-clean-up-windows-10-with-the-refresh-windows-tool

It does remove everything but Windows, so it is only suitable for completely new machines.

Categories:      

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

Defragment the NTFS MFT and other hidden crucials in live Windows
article #1265, updated 215 days ago

The command is CONTIG (also available in 64-bit as CONTIG64), and it is a Sysinternals:

https://docs.microsoft.com/en-us/sysinternals/downloads/contig

You’ll want to put the appropriate binary in C:\Windows. Run it like this, in administrative CMD, it will get all of the hiddens it can for C drive (this is 64-bit):

contig64 -nobanner -accepteula C:$Mft
contig64 -nobanner -accepteula C:$LogFile
contig64 -nobanner -accepteula C:$Volume
contig64 -nobanner -accepteula C:$AttrDef
contig64 -nobanner -accepteula C:$Bitmap
contig64 -nobanner -accepteula C:$Boot
contig64 -nobanner -accepteula C:$BadClus
contig64 -nobanner -accepteula C:$Secure
contig64 -nobanner -accepteula C:$UpCase
contig64 -nobanner -accepteula C:$Extend

Notice the distinct lack of slashes in the above!

Categories:      

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

Tweak and Enable Superfetch Et Cetera on Windows 8/2012 and Later
article #1270, updated 223 days ago

In an administrative PowerShell, all of the following. Reports suggest increases in performance if there are CPU cycles available:

Enable-MMAgent -ApplicationLaunchPrefetching
Enable-MMAgent -ApplicationPreLaunch
Set-MMAgent -MaxOperationAPIFiles 8192
Enable-MMAgent -MemoryCompression
Enable-MMAgent -OperationAPI
Enable-MMAgent -PageCombining
Set-Service sysmain -StartupType Automatic
Start-Service sysmain

The last two enable and start the service, if necessary.

Categories:      

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

Using Contig to defrag
article #1266, updated 257 days ago

The command is CONTIG (also available in 64-bit as CONTIG64), is a Sysinternals:

https://docs.microsoft.com/en-us/sysinternals/downloads/contig

It defrags, and does it very well. It does it file by file. Here’s a command probably suitable for background operation on a whole C drive, on a 64-bit machine, quiet mode:

start /LOW contig64 -s -q C:\*

Categories:      

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

Recreate SBS monitoring database by PowerShell
article #866, updated 317 days ago

Really good article here:

http://www.itquibbles.com/sql-sbsmonitoring-high-disk-usage/

Solves the problem of the database reaching max capacity, and also speeds things up in general.

Short version:

In SBS 2008, run the contents of this zip file in an administrative PowerShell window.

In SBS 2011, start this shell as administrator:

C:\Program Files\Windows Small Business Server\Bin\MoveDataPowerShellHost.exe

and then while in the shell, run the contents of this zip file.

If it says “1 row affected”, it’s done, and the messages will point out old MDF and LDF files to remove.

You may notice that the script linked here is just a tad different than the one on the itquibbles page; this one just adds the -force items mentioned as an option on that page.

Categories: