Tag: Cache

Flush DNS Cache with PowerShell

Flush DNS Cache with PowerShell

A while ago, I wrote a blog post called PowerShell Networking Cheatsheet, where I put together several networking commands which can be replaced by PowerShell. One of the latest once I saw and a couple of people requested is how you flush the DNS cache using PowerShell. This would allow you to replace ipconfig/ flushdns with PowerShell. Guess what, Microsoft as now a PowerShell cmdlet for that.

Clear and Flush DNS with PowerShell

You can use the following command to clear the DNS cache on a Windows system using PowerShell

Clear-DnsClientCache

You can find the documentation for this cmdlet on Microsoft Docs.

Show DNS Cache with PowerShell

There is also a PowerShell command to show you the DNS cache:

Get-DnsClientCache

There are also more cmdlets that can help you to manage your DNS configuration on your Windows machine.

# List DNS servers 
Get-DnsClientServerAddress
 
# Configure a DNS server address using PowerShell 
Set-DnsClientServerAddress
 
# Performs a DNS name query resolution for the specified name.
Resolve-DnsName

Let me know if you have any other helpful cmdlets to manage DNS client settings.

Conclusion

I hope this blog post and these commands to Flush DNS cache with PowerShell are useful. If you have any questions, feel free to leave a comment. If you are interested in PowerShell 7, check out my blog post about how to install and update PowerShell 7 and what’s new in PowerShell 7.



Windows Server

Configure CSV Cache in Windows Server 2012 R2

In Windows Server 2012 Microsoft introduced CSV Cache for Windows Server 2012 Hyper-V and Scale-Out File Server Clusters. The CSV Block Cache is basically a RAM cache which allows you to cache read IOPS in the Memory of the Hyper-V or the Scale-Out File Server Cluster nodes. In Windows Server 2012 you had to set the CSV Block Cache and enable it on every CSV volume. In Windows Server 2012 R2 CSV Block cache is by default enabled for every CSV volume but the size of the CSV Cache is set to zero, which means the only thing you have to do is to set the size of the cache.

 
# Get CSV Block Cache Size
(Get-Cluster).BlockCacheSize
# Set CSV Block Cache Size to 512MB
(Get-Cluster).BlockCacheSize = 512

Microsoft recommends using 512MB as cache on a Hyper-V host. On a Scale-Out File Server node, things are a little bit different. In Windows Server 2012 Microsoft allowed you to use a cache size up to 20% of the server, in Windows Server 2012 R2 Microsoft changed this, so you can now finally use up to 80% of the RAM of a Scale-Out File Server but with a maximum of 64GB.

Back in the days of Windows Server 2012 I made a little benchmark of CSV Cache on my Hyper-V hosts.



Windows Server 2012 R2 Storage Spaces

What’s new in Windows Server 2012 R2 Storage Spaces

Microsoft announced the next version of the Windows Server platform called Windows Server 2012 R2 at TechEd North America. I already blog about what’s new in Windows Server 2012 R2 Hyper-V. This post will focus about Windows Server 2012 R2 Storage Spaces.

Storages Spaces

First there are new exciting new features in Windows Server 2012 R2 Storage Spaces. Microsoft first released there Software Defined Storage solution called Storage Spaces in Windows Server 2012 and this allows you basically to build your own storage solution based on a simple JBOD hardware solution. Storage spaces is a really cost-effective storage solution which allows companies to save up to 75% of storage costs in compare to traditional SAN storage. I also mention some standard features which are included in Windows Server 2012.

Pooling of disks – You can pool physical disks together and create multiple virtual disks on the storage pool even with different resiliency options.

Continuous availability – Storage Pools and Disks can be clustered with the Microsoft Failover Cluster so if one server goes down the virtual disks and file shares are still available.

SMB copy offload – Offloading copy actions to the storage.

Snapshots – Create Snapshots and  clone virtual disks on a storage pool.

Flexible resiliency options – In Windows Server 2012 you could create a Mirror Spaces with a two-way or three-way mirror, a Parity Space with a single parity and a Simple Space with no data resiliency. New in R2 parity spaces can now be used in clustered pools and there is also a new dual parity option. (enhanced in 2012 R2)

Enhanced Rebuilding – Speed of rebuilding of failed disks is enhanced. (enhanced in 2012 R2)

Storage Tiering – Windows Server 2012 R2 allows you to use different kind of disks and automatically moves “hot-data” from SAS disks to fast SSD storage. (new in 2012 R2)

Write-Back Cache – This feature allows data to be written to SSD first and moves later to the slower SAS tier. (new in 2012 R2)

Data Deduplication – Data Deduplication was already included in Windows Server 2012 but it is enhanced in Windows Server 2012 R2, and allows you to use it together with Cluster Shared Volumes (CSV) and supports VDI virtual machines. (enhanced in 2012 R2)

Management – Complete management solutions with Windows PowerShell, Failover Cluster, Server Manager or new in System Center 2012 R2 – Virtual Machine Manager. Now you can setup new Storage Servers, Storage Pools, Storage Spaces and File Shares directly from Virtual Machine Manager. (enhanced in 2012 R2)

ReFS – The filesystem Microsoft first released with Windows Server 2012 is now also supported for clustering, which means it can be used as a CSV (Clustered Shared Volume). Thanks to Didier Van Hoye (MVP) for adding that to the list

 



Windows Server 2012: CSV Cache Benchmark

Windows Server 8

Some days ago I wrote a blog post about how you can enable CSV Cache on the new Windows Server 8 beta. Now a lot of people asked me about some benchmarks.

Here a test inside the Virtual Machine:

Without CSV Cache:

CSV Cache disabled

With CSV Cache enabled:

CSV Cache enabled

As you can see CSV Cache does work really well. In some cases you can get 4-5 times the read performance.



Windows Server 2012: Enable CSV Cache

Windows Server 8

In Windows Server 8 beta (Windows Server 2012 beta), Microsoft released a lot of new features for Cluster Shared Volumes (CSV). One of them is CSV Cache. CSV Cache gives you the possibility to allocate system memory (RAM) of the cluster nodes as cache. This can improve the performance of read requests in workloads like Hyper-V.

Now to enable the CSV Cache on a cluster you have to do this with Windows PowerShell.

  1. First open the PowerShell prompt
  2. Set the size of the CSV Cache. The default it 512MB. With this command you will reserve the Memory on all Cluster nodes for caching.
    (Get-Cluster). SharedVolumeBlockCacheSizeInMB = 512
  3. Now you have to enable the Cache on on the Cluster Shared Volumes you want to use.
    Get-ClusterSharedVolume “Cluster Disk 1| Set-ClusterParameter  CsvEnableBlockCache 1

Here you can find a Windows Server 2012: CSV Cache Benchmark

If you want to know more about CSV Cache, you can read this blog post from Elden Christensen on the Failover Clustering and Network Load Balancing Team Blog.