<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>speedoptimization - Hamradio.my</title>
	<atom:link href="https://hamradio.my/tag/speedoptimization/feed/" rel="self" type="application/rss+xml" />
	<link>https://hamradio.my/tag/speedoptimization/</link>
	<description>Amateur Radio, Tech Insights and Product Reviews</description>
	<lastBuildDate>Tue, 28 Jan 2025 08:53:23 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0</generator>

<image>
	<url>https://hamradio.my/wp-content/uploads/2026/02/cropped-cropped-image-removebg-preview-3-32x32.png</url>
	<title>speedoptimization - Hamradio.my</title>
	<link>https://hamradio.my/tag/speedoptimization/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Optimizing Debian/Ubuntu for Fast Internet and Efficient Memory Management</title>
		<link>https://hamradio.my/2025/01/optimizing-debian-ubuntu-for-fast-internet-and-efficient-memory-management/</link>
					<comments>https://hamradio.my/2025/01/optimizing-debian-ubuntu-for-fast-internet-and-efficient-memory-management/#comments</comments>
		
		<dc:creator><![CDATA[9M2PJU]]></dc:creator>
		<pubDate>Tue, 28 Jan 2025 08:53:16 +0000</pubDate>
				<category><![CDATA[debian]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[speed]]></category>
		<category><![CDATA[tweaks]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[devops]]></category>
		<category><![CDATA[linuxdesktop]]></category>
		<category><![CDATA[linuxoptimization]]></category>
		<category><![CDATA[memorymanagement]]></category>
		<category><![CDATA[NetworkOptimization]]></category>
		<category><![CDATA[opensource]]></category>
		<category><![CDATA[preload]]></category>
		<category><![CDATA[speedoptimization]]></category>
		<category><![CDATA[sysctl]]></category>
		<category><![CDATA[systemadmin]]></category>
		<category><![CDATA[systemperformance]]></category>
		<category><![CDATA[techtips]]></category>
		<category><![CDATA[techtweaks]]></category>
		<category><![CDATA[thp]]></category>
		<category><![CDATA[transparenthugepages]]></category>
		<category><![CDATA[zram]]></category>
		<category><![CDATA[zswap]]></category>
		<guid isPermaLink="false">https://hamradio.my/?p=6255</guid>

					<description><![CDATA[<p>Debian and Ubuntu are two of the most popular Linux distributions, known for their stability and versatility. However, out of the box, they may not be fully optimized for modern workloads. Whether you&#8217;re looking to speed up your internet connection, improve memory management, or boost overall system performance, a few tweaks can make a significant [&#8230;]</p>
<p>The post <a href="https://hamradio.my/2025/01/optimizing-debian-ubuntu-for-fast-internet-and-efficient-memory-management/">Optimizing Debian/Ubuntu for Fast Internet and Efficient Memory Management</a> appeared on <a href="https://hamradio.my">Hamradio.my - Amateur Radio, Tech Insights and Product Reviews</a> by <a href="https://hamradio.my/author/9m2pju/">9M2PJU</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<h1 class="wp-block-heading"></h1>



<p class="wp-block-paragraph">Debian and Ubuntu are two of the most popular Linux distributions, known for their stability and versatility. However, out of the box, they may not be fully optimized for modern workloads. Whether you&#8217;re looking to speed up your internet connection, improve memory management, or boost overall system performance, a few tweaks can make a significant difference. In this guide, we&#8217;ll walk you through optimizing your Debian or Ubuntu system for <strong>fast internet</strong>, <strong>efficient memory management</strong>, and <strong>faster application loading</strong> using tools like <strong>Preload</strong>.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading">Part 1: Optimizing for Fast Internet</h2>



<p class="wp-block-paragraph">To achieve faster internet speeds, we can tweak the Linux kernel&#8217;s network settings using <code>sysctl</code>. These changes focus on improving throughput, reducing latency, and optimizing buffer sizes.</p>



<h3 class="wp-block-heading">Step 1: Edit the <code>sysctl.conf</code> File</h3>



<p class="wp-block-paragraph">Open the <code>/etc/sysctl.conf</code> file in your favorite text editor:</p>



<pre class="wp-block-code"><code>sudo nano /etc/sysctl.conf</code></pre>



<h3 class="wp-block-heading">Step 2: Add or Modify Network-Related Parameters</h3>



<p class="wp-block-paragraph">Add or update the following lines to the file:</p>



<pre class="wp-block-code"><code># Increase network buffer sizes
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
net.core.rmem_default = 16777216
net.core.wmem_default = 16777216

# Increase the maximum size of the receive queue
net.core.netdev_max_backlog = 30000

# Increase the number of open files (sockets)
fs.file-max = 2097152

# Increase the local port range
net.ipv4.ip_local_port_range = 1024 65535

# Enable TCP window scaling and selective acknowledgments
net.ipv4.tcp_window_scaling = 1
net.ipv4.tcp_sack = 1

# Increase the maximum number of SYN backlog requests
net.ipv4.tcp_max_syn_backlog = 8192

# Increase the maximum number of connections
net.core.somaxconn = 65535

# Reduce TCP FIN timeout
net.ipv4.tcp_fin_timeout = 15

# Reuse TIME-WAIT sockets for new connections
net.ipv4.tcp_tw_reuse = 1

# Enable TCP Fast Open
net.ipv4.tcp_fastopen = 3

# Disable ICMP redirects
net.ipv4.conf.all.accept_redirects = 0
net.ipv4.conf.default.accept_redirects = 0
net.ipv4.conf.all.send_redirects = 0
net.ipv4.conf.default.send_redirects = 0

# Disable IPv6 (optional)
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1</code></pre>



<h3 class="wp-block-heading">Step 3: Apply the Changes</h3>



<p class="wp-block-paragraph">Save the file and apply the changes immediately:</p>



<pre class="wp-block-code"><code>sudo sysctl -p</code></pre>



<h3 class="wp-block-heading">Step 4: Verify the Changes</h3>



<p class="wp-block-paragraph">Check if the changes have been applied:</p>



<pre class="wp-block-code"><code>sysctl -a | grep net.core
sysctl -a | grep net.ipv4</code></pre>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading">Part 2: Optimizing Memory Management</h2>



<p class="wp-block-paragraph">Efficient memory management is crucial for system performance, especially under heavy workloads. Here’s how to tweak your Debian or Ubuntu system for better memory utilization.</p>



<h3 class="wp-block-heading">Step 1: Edit the <code>sysctl.conf</code> File</h3>



<p class="wp-block-paragraph">Open the <code>/etc/sysctl.conf</code> file again:</p>



<pre class="wp-block-code"><code>sudo nano /etc/sysctl.conf</code></pre>



<h3 class="wp-block-heading">Step 2: Add or Modify Memory-Related Parameters</h3>



<p class="wp-block-paragraph">Add or update the following lines:</p>



<pre class="wp-block-code"><code># Adjust swappiness (lower values prioritize RAM over swap)
vm.swappiness = 10

# Increase the percentage of system memory for caching
vm.vfs_cache_pressure = 50

# Increase the maximum number of memory map areas
vm.max_map_count = 262144

# Optimize writeback buffer settings
vm.dirty_ratio = 10
vm.dirty_background_ratio = 5
vm.dirty_expire_centisecs = 1000
vm.dirty_writeback_centisecs = 500

# Enable memory overcommit (use with caution)
vm.overcommit_memory = 1

# Increase the size of the TCP window for better network performance
net.ipv4.tcp_rmem = 4096 87380 16777216
net.ipv4.tcp_wmem = 4096 65536 16777216</code></pre>



<h3 class="wp-block-heading">Step 3: Apply the Changes</h3>



<p class="wp-block-paragraph">Save the file and apply the changes:</p>



<pre class="wp-block-code"><code>sudo sysctl -p</code></pre>



<h3 class="wp-block-heading">Step 4: Verify the Changes</h3>



<p class="wp-block-paragraph">Check if the changes have been applied:</p>



<pre class="wp-block-code"><code>sysctl -a | grep vm</code></pre>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading">Part 3: Using Preload for Faster Application Loading</h2>



<p class="wp-block-paragraph"><strong>Preload</strong> is a daemon that runs in the background and analyzes your usage patterns to preload frequently used applications into memory. This can significantly reduce application startup times.</p>



<h3 class="wp-block-heading">Step 1: Install Preload</h3>



<p class="wp-block-paragraph">Install Preload using the following command:</p>



<pre class="wp-block-code"><code>sudo apt install preload</code></pre>



<h3 class="wp-block-heading">Step 2: Configure Preload (Optional)</h3>



<p class="wp-block-paragraph">The default configuration is usually sufficient, but you can customize it by editing the configuration file:</p>



<pre class="wp-block-code"><code>sudo nano /etc/preload.conf</code></pre>



<h3 class="wp-block-heading">Step 3: Restart Preload</h3>



<p class="wp-block-paragraph">After making changes, restart the Preload service:</p>



<pre class="wp-block-code"><code>sudo systemctl restart preload</code></pre>



<h3 class="wp-block-heading">Step 4: Monitor Preload</h3>



<p class="wp-block-paragraph">Check the status of Preload to ensure it’s running:</p>



<pre class="wp-block-code"><code>sudo systemctl status preload</code></pre>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading">Part 4: Should You Use Transparent HugePages (THP)?</h2>



<p class="wp-block-paragraph"><strong>Transparent HugePages (THP)</strong> is a Linux kernel feature that improves performance by using larger memory pages (2 MB or 1 GB) instead of the standard 4 KB pages. Here&#8217;s how to decide whether to use THP on your Debian or Ubuntu system.</p>



<h3 class="wp-block-heading">What is THP?</h3>



<ul class="wp-block-list">
<li><strong>THP</strong> dynamically allocates larger memory pages to reduce the overhead of managing page tables and improve performance for memory-intensive workloads.</li>



<li>It operates in three modes: <code>always</code>, <code>madvise</code>, and <code>never</code>.</li>
</ul>



<h3 class="wp-block-heading">When to Use THP</h3>



<ul class="wp-block-list">
<li><strong>Memory-Intensive Applications</strong>: Use THP if you run virtual machines, databases, or scientific simulations.</li>



<li><strong>Gaming</strong>: Modern games with large memory footprints may benefit from THP.</li>



<li><strong>Multitasking</strong>: If you frequently use memory-hungry applications (e.g., browsers with many tabs, IDEs), THP can help.</li>



<li><strong>High RAM Systems</strong>: Systems with 16 GB or more RAM are better suited for THP.</li>
</ul>



<h3 class="wp-block-heading">When to Avoid THP</h3>



<ul class="wp-block-list">
<li><strong>Lightweight Workloads</strong>: If your usage is light (e.g., web browsing, office apps), THP may not provide noticeable benefits.</li>



<li><strong>Low RAM Systems</strong>: Systems with 4 GB or less RAM may experience fragmentation or increased swap usage.</li>



<li><strong>Real-Time Applications</strong>: THP can cause latency spikes, which are problematic for real-time workloads.</li>
</ul>



<h3 class="wp-block-heading">Recommended THP Mode</h3>



<p class="wp-block-paragraph">For most users, the <strong><code>madvise</code></strong> mode is ideal:</p>



<pre class="wp-block-code"><code>echo "madvise" | sudo tee /sys/kernel/mm/transparent_hugepage/enabled</code></pre>



<h3 class="wp-block-heading">How to Disable THP</h3>



<p class="wp-block-paragraph">If THP causes issues, disable it:</p>



<pre class="wp-block-code"><code>echo "never" | sudo tee /sys/kernel/mm/transparent_hugepage/enabled</code></pre>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading">Part 5: Additional Tools for Performance Optimization</h2>



<h3 class="wp-block-heading">Use Zswap or Zram</h3>



<ul class="wp-block-list">
<li><strong>Zswap</strong>: Compresses swap data in RAM before writing to disk.</li>
</ul>



<pre class="wp-block-code"><code>  echo 1 | sudo tee /sys/module/zswap/parameters/enabled</code></pre>



<ul class="wp-block-list">
<li><strong>Zram</strong>: Creates a compressed block device in RAM for swap.</li>
</ul>



<pre class="wp-block-code"><code>  sudo apt install zram-tools
  sudo systemctl enable zramswap
  sudo systemctl start zramswap</code></pre>



<h3 class="wp-block-heading">Monitor System Performance</h3>



<p class="wp-block-paragraph">Use tools like <code>htop</code>, <code>glances</code>, or <code>vmstat</code> to monitor system performance:</p>



<pre class="wp-block-code"><code>sudo apt install htop glances
htop
glances</code></pre>



<h3 class="wp-block-heading">Optimize Boot Times with <code>systemd-analyze</code></h3>



<p class="wp-block-paragraph">Analyze and optimize your boot time:</p>



<pre class="wp-block-code"><code>systemd-analyze blame
systemd-analyze critical-chain</code></pre>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading">Conclusion</h2>



<p class="wp-block-paragraph">By optimizing your Debian or Ubuntu system for fast internet, efficient memory management, and faster application loading, you can significantly improve performance and responsiveness. Tools like <strong>Preload</strong>, <strong>Zswap</strong>, and <strong>Zram</strong> further enhance your system&#8217;s efficiency. Whether you enable THP depends on your specific workload, but for most users, the <strong><code>madvise</code></strong> mode is a safe and effective choice. Always test and monitor your system to ensure these tweaks provide the desired benefits.</p>



<p class="wp-block-paragraph">Happy optimizing! <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f680.png" alt="🚀" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
<p>The post <a href="https://hamradio.my/2025/01/optimizing-debian-ubuntu-for-fast-internet-and-efficient-memory-management/">Optimizing Debian/Ubuntu for Fast Internet and Efficient Memory Management</a> appeared on <a href="https://hamradio.my">Hamradio.my - Amateur Radio, Tech Insights and Product Reviews</a> by <a href="https://hamradio.my/author/9m2pju/">9M2PJU</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://hamradio.my/2025/01/optimizing-debian-ubuntu-for-fast-internet-and-efficient-memory-management/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
	</channel>
</rss>
