This commit is contained in:
MacRimi 2025-03-02 18:54:24 +01:00
parent ed6f02d854
commit 0aa60c3218
2 changed files with 294 additions and 49 deletions

View File

@ -169,24 +169,101 @@ echo 'Acquire::ForceIPv4 "true";' | sudo tee /etc/apt/apt.conf.d/99force-ipv4
<StepNumber number={4} /> <StepNumber number={4} />
Install Open vSwitch Install Open vSwitch
</h3> </h3>
<p className="mb-4">This optimization installs <strong>Open vSwitch (OVS)</strong>, a multilayer virtual switch designed for modern virtualized environments.</p>
<p className="mb-4"> <p className="mb-4">
<strong className="block">Why it's beneficial:</strong> This optimization installs <strong>Open vSwitch (OVS)</strong>, a multilayer virtual switch
Provides advanced networking capabilities, including VLAN tagging, trunking, designed for modern virtualized environments. OVS enhances network management by enabling
traffic shaping, and Quality of Service (QoS). OVS enables more flexible and scalable network configurations, advanced features for virtualized infrastructures.
making it ideal for complex virtualization setups requiring fine-grained traffic control.
</p> </p>
<p className="mb-4">
<strong className="block">Why it's beneficial:</strong>
Open vSwitch provides powerful networking capabilities, including:
</p>
<ul className="list-disc pl-5 mb-4">
<li><strong>VLAN Support:</strong> Enables segmentation of virtual networks for better security and isolation.</li>
<li><strong>Trunking:</strong> Allows multiple VLANs on a single physical or virtual interface.</li>
<li><strong>Traffic Shaping:</strong> Implements bandwidth control and rate limiting per interface or flow.</li>
<li><strong>Quality of Service (QoS):</strong> Prioritizes network traffic for optimized performance.</li>
<li><strong>Integration with SDN (Software Defined Networking):</strong> Works seamlessly with OpenFlow for programmable network control.</li>
</ul>
<p className="text-lg mb-2">This adjustment automates the following commands:</p> <p className="text-lg mb-2">This adjustment automates the following commands:</p>
<CopyableCode <CopyableCode
code={` code={`
sudo apt-get update # Install Open vSwitch packages
sudo apt-get install -y openvswitch-switch DEBIAN_FRONTEND=noninteractive apt-get -y install openvswitch-switch openvswitch-common
# Verify installation # Verify installation
sudo ovs-vsctl --version ovs-vsctl --version
`} `}
/> />
<h4 className="text-lg font-semibold mt-6">Basic Usage: Creating a Virtual Switch</h4>
<p className="mb-4">
Once installed, Open vSwitch can be used to create virtual network bridges. Below is an example of how to create a virtual switch named <code>br0</code> and add a network interface to it.
</p>
<CopyableCode
code={`
# Create a new OVS bridge
ovs-vsctl add-br br0
# Add a network interface (e.g., eth1) to the bridge
ovs-vsctl add-port br0 eth1
# Show the current Open vSwitch configuration
ovs-vsctl show
`}
/>
<h4 className="text-lg font-semibold mt-6">Adding VLANs to Open vSwitch</h4>
<p className="mb-4">
Open vSwitch allows VLAN tagging to segment network traffic. Below is an example of how to add an interface to a specific VLAN.
</p>
<CopyableCode
code={`
# Add eth1 to br0 and assign it to VLAN 100
ovs-vsctl add-port br0 eth1 tag=100
`}
/>
<h4 className="text-lg font-semibold mt-6">Trunking Multiple VLANs</h4>
<p className="mb-4">
If an interface needs to carry multiple VLANs (trunk mode), use the following command:
</p>
<CopyableCode
code={`
# Configure eth1 as a trunk port allowing VLANs 100 and 200
ovs-vsctl add-port br0 eth1 trunks=100,200
`}
/>
<h4 className="text-lg font-semibold mt-6">Deleting a Bridge or Port</h4>
<p className="mb-4">
If you need to remove a bridge or a port from Open vSwitch, use these commands:
</p>
<CopyableCode
code={`
# Delete a bridge
ovs-vsctl del-br br0
# Remove a port from a bridge
ovs-vsctl del-port br0 eth1
`}
/>
<p className="mt-4">
Open vSwitch enables advanced networking capabilities for virtual environments, allowing greater
control over network traffic, security, and performance optimizations.
</p>
<h3 className="text-xl font-semibold mt-16 mb-4 flex items-center"> <h3 className="text-xl font-semibold mt-16 mb-4 flex items-center">
<StepNumber number={5} /> <StepNumber number={5} />
Optimize Network Interface Settings Optimize Network Interface Settings

View File

@ -52,49 +52,217 @@ export default function PerformanceSettingsPage() {
</p> </p>
<h2 className="text-2xl font-semibold mt-8 mb-4">Available Optimizations</h2> <h2 className="text-2xl font-semibold mt-8 mb-4">Available Optimizations</h2>
<h3 className="text-xl font-semibold mt-16 mb-4 flex items-center"> <h3 className="text-xl font-semibold mt-16 mb-4 flex items-center">
<StepNumber number={1} /> <StepNumber number={1} />
Configure pigz for Faster gzip Compression Configure pigz for Faster gzip Compression
</h3> </h3>
<p className="mb-4">
This optimization configures pigz as a faster replacement for gzip compression. pigz is a parallel
implementation of gzip for modern multi-processor, multi-core machines.
</p>
<p className="mb-4">The following steps are performed:</p>
<ul className="list-disc pl-5 mb-4">
<li>Enables pigz in the vzdump configuration for faster backups</li>
<li>Installs the pigz package if not already installed</li>
<li>Creates a pigz wrapper script to replace the standard gzip command</li>
<li>Replaces the system gzip command with the pigz wrapper</li>
</ul>
<p className="mb-4">
<strong>Note:</strong> This optimization can significantly speed up compression tasks, especially on systems
with multiple CPU cores.
</p>
<p className="text-lg mb-2">This adjustment automates the following commands:</p>
<CopyableCode
code={`
# Enable pigz in vzdump configuration
sed -i "s/#pigz:.*/pigz: 1/" /etc/vzdump.conf
# Install pigz <p className="mb-4">
apt-get -y install pigz This optimization configures <strong>pigz</strong> as a faster replacement for gzip compression.
Pigz is a parallel implementation of gzip that utilizes multiple CPU cores,
significantly improving compression speed on modern systems.
</p>
# Create pigz wrapper script <p className="mb-4"><strong>Why use pigz instead of gzip?</strong></p>
cat <<EOF > /bin/pigzwrapper <ul className="list-disc pl-5 mb-4">
#!/bin/sh <li><strong>Parallel processing:</strong> Uses all available CPU cores for faster compression.</li>
PATH=/bin:\$PATH <li><strong>Faster vzdump backups:</strong> When used with Proxmox's vzdump, it reduces backup times.</li>
GZIP="-1" <li><strong>Drop-in replacement for gzip:</strong> It works exactly like gzip but is much more efficient.</li>
exec /usr/bin/pigz "\$@" </ul>
EOF
chmod +x /bin/pigzwrapper
# Replace gzip with pigz wrapper <p className="mb-4">The following steps are performed:</p>
mv -f /bin/gzip /bin/gzip.original <ul className="list-disc pl-5 mb-4">
cp -f /bin/pigzwrapper /bin/gzip <li>Enables pigz in the vzdump configuration for faster backups.</li>
chmod +x /bin/gzip <li>Installs the pigz package if not already installed.</li>
<li>Creates a pigz wrapper script to replace the standard gzip command.</li>
<li>Replaces the system gzip command with the pigz wrapper.</li>
</ul>
<p className="mb-4">
<strong>Note:</strong> This optimization can significantly speed up compression tasks, especially on systems
with multiple CPU cores.
</p>
<p className="text-lg mb-2">This adjustment automates the following commands:</p>
<CopyableCode
code={`
# Enable pigz in vzdump configuration
sed -i "s/#pigz:.*/pigz: 1/" /etc/vzdump.conf
# Install pigz
apt-get -y install pigz
# Create pigz wrapper script
cat <<EOF > /bin/pigzwrapper
#!/bin/sh
PATH=/bin:\$PATH
GZIP="-1"
exec /usr/bin/pigz "\$@"
EOF
chmod +x /bin/pigzwrapper
# Replace gzip with pigz wrapper
mv -f /bin/gzip /bin/gzip.original
cp -f /bin/pigzwrapper /bin/gzip
chmod +x /bin/gzip
`} `}
/> />
<h4 className="text-lg font-semibold mt-6">How to Use pigz</h4>
<p className="mb-4">
Pigz works the same way as gzip but compresses files much faster by using multiple CPU cores.
Heres how you can test its performance:
</p>
<CopyableCode
code={`
# Compress a file with gzip
time gzip largefile.img
# Compress a file with pigz (parallel gzip)
time pigz largefile.img
`}
/>
<p className="mb-4">
The output will show that pigz completes the compression significantly faster than gzip.
To check the number of CPU cores pigz is using, run:
</p>
<CopyableCode
code={`
pigz -p $(nproc) largefile.img
`}
/>
<h4 className="text-lg font-semibold mt-6">Verifying pigz Replacement</h4>
<p className="mb-4">
After replacing gzip with pigz, you can confirm that the system is using pigz instead of gzip:
</p>
<CopyableCode
code={`
which gzip
ls -l /bin/gzip
`}
/>
<p className="mb-4">
The output should show that <code>/bin/gzip</code> is now linked to the pigz wrapper.
</p>
<p className="mt-4">
By enabling pigz, compression-heavy tasks like vzdump backups and log archiving
will run much faster, leveraging multi-core processing.
</p>
<h3 className="text-xl font-semibold mt-16 mb-4 flex items-center">
<StepNumber number={1} />
Configure pigz for Faster gzip Compression
</h3>
<p className="mb-4">
This optimization configures <strong>pigz</strong> as a faster replacement for gzip compression.
Pigz is a parallel implementation of gzip that utilizes multiple CPU cores,
significantly improving compression speed on modern systems.
</p>
<p className="mb-4"><strong>Why use pigz instead of gzip?</strong></p>
<ul className="list-disc pl-5 mb-4">
<li><strong>Parallel processing:</strong> Uses all available CPU cores for faster compression.</li>
<li><strong>Faster vzdump backups:</strong> When used with Proxmox's vzdump, it reduces backup times.</li>
<li><strong>Drop-in replacement for gzip:</strong> It works exactly like gzip but is much more efficient.</li>
</ul>
<p className="mb-4">The following steps are performed:</p>
<ul className="list-disc pl-5 mb-4">
<li>Enables pigz in the vzdump configuration for faster backups.</li>
<li>Installs the pigz package if not already installed.</li>
<li>Creates a pigz wrapper script to replace the standard gzip command.</li>
<li>Replaces the system gzip command with the pigz wrapper.</li>
</ul>
<p className="mb-4">
<strong>Note:</strong> This optimization can significantly speed up compression tasks, especially on systems
with multiple CPU cores.
</p>
<p className="text-lg mb-2">This adjustment automates the following commands:</p>
<CopyableCode
code={`
# Enable pigz in vzdump configuration
sed -i "s/#pigz:.*/pigz: 1/" /etc/vzdump.conf
# Install pigz
apt-get -y install pigz
# Create pigz wrapper script
cat <<EOF > /bin/pigzwrapper
#!/bin/sh
PATH=/bin:\$PATH
GZIP="-1"
exec /usr/bin/pigz "\$@"
EOF
chmod +x /bin/pigzwrapper
# Replace gzip with pigz wrapper
mv -f /bin/gzip /bin/gzip.original
cp -f /bin/pigzwrapper /bin/gzip
chmod +x /bin/gzip
`}
/>
<h4 className="text-lg font-semibold mt-6">How to Use pigz</h4>
<p className="mb-4">
Pigz works the same way as gzip but compresses files much faster by using multiple CPU cores.
Heres how you can test its performance:
</p>
<CopyableCode
code={`
# Compress a file with gzip
time gzip largefile.img
# Compress a file with pigz (parallel gzip)
time pigz largefile.img
`}
/>
<p className="mb-4">
The output will show that pigz completes the compression significantly faster than gzip.
To check the number of CPU cores pigz is using, run:
</p>
<CopyableCode
code={`
pigz -p $(nproc) largefile.img
`}
/>
<h4 className="text-lg font-semibold mt-6">Verifying pigz Replacement</h4>
<p className="mb-4">
After replacing gzip with pigz, you can confirm that the system is using pigz instead of gzip:
</p>
<CopyableCode
code={`
which gzip
ls -l /bin/gzip
`}
/>
<p className="mb-4">
The output should show that <code>/bin/gzip</code> is now linked to the pigz wrapper.
</p>
<p className="mt-4">
By enabling pigz, compression-heavy tasks like vzdump backups and log archiving
will run much faster, leveraging multi-core processing.
</p>
<section className="mt-12 p-4 bg-blue-100 rounded-md"> <section className="mt-12 p-4 bg-blue-100 rounded-md">
<h2 className="text-xl font-semibold mb-2">Automatic Application</h2> <h2 className="text-xl font-semibold mb-2">Automatic Application</h2>