public inbox for [email protected]  
help / color / mirror / Atom feed
From: Andres Freund <[email protected]>
Subject: [PATCH v3 09/10] ci: windows: Disabling write cache flushing during test
Date: Mon, 7 Aug 2023 16:56:29 -0700

This has been measured to reduce windows test times by about 30s.
---
 .cirrus.tasks.yml                    |  6 ++++++
 src/tools/ci/windows_write_cache.ps1 | 20 ++++++++++++++++++++
 2 files changed, 26 insertions(+)
 create mode 100644 src/tools/ci/windows_write_cache.ps1

diff --git a/.cirrus.tasks.yml b/.cirrus.tasks.yml
index d1730ce08a8..360b1c775fd 100644
--- a/.cirrus.tasks.yml
+++ b/.cirrus.tasks.yml
@@ -547,6 +547,12 @@ task:
   setup_additional_packages_script: |
     REM choco install -y --no-progress ...
 
+  # Define the write cache to be power protected. This reduces the rate of
+  # cache flushes, which seems to help metadata heavy workloads on NTFS. We're
+  # just testing here anyway, so ...
+  change_write_caching_script:
+    - powershell src/tools/ci/windows_write_cache.ps1 2>&1
+
   setup_hosts_file_script: |
     echo 127.0.0.1 pg-loadbalancetest >> c:\Windows\System32\Drivers\etc\hosts
     echo 127.0.0.2 pg-loadbalancetest >> c:\Windows\System32\Drivers\etc\hosts
diff --git a/src/tools/ci/windows_write_cache.ps1 b/src/tools/ci/windows_write_cache.ps1
new file mode 100644
index 00000000000..5c67b3ce54b
--- /dev/null
+++ b/src/tools/ci/windows_write_cache.ps1
@@ -0,0 +1,20 @@
+# Define the write cache to be power protected. This reduces the rate of cache
+# flushes, which seems to help metadata heavy workloads on NTFS. We're just
+# testing here anyway, so ...
+#
+# Let's do so for all disks, this could be useful beyond cirrus-ci.
+
+Set-Location "HKLM:/SYSTEM/CurrentControlSet/Enum/SCSI";
+
+Get-ChildItem -Path "*/*" | foreach-object {
+    Push-Location;
+    cd /$_;
+    pwd;
+    cd 'Device Parameters';
+    if (!(Test-Path -Path "Disk")) {
+	New-Item -Path "Disk";
+    }
+
+    Set-ItemProperty -Path Disk -Type DWord -name CacheIsPowerProtected -Value 1;
+    Pop-Location;
+}
-- 
2.38.0


--uh2yukyzfvojbe2k
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
	filename="v3-0010-regress-Check-for-postgres-startup-completion-mor.patch"



view thread (11+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected]
  Subject: Re: [PATCH v3 09/10] ci: windows: Disabling write cache flushing during test
  In-Reply-To: <no-message-id-1856060@localhost>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox