15 Tweaks to Get the Most Out of Your Raspberry Pi Server
A Raspberry Pi has been running as my home server for many years now, and similar to how I manage my other remote machines, I like to make it as responsive as possible. If your Pi server is feeling a bit slow or you wonder if you’re missing out on other optimizations, let me give you some tips on how to speed things up.
To optimize a Raspberry Pi for server duty, choose lightweight software, add faster storage, manage memory options, tune network connections, and play with CPU priorities.
Ready for some specifics? I’ll start with basic methods and then sprinkle in some more advanced ones along the way, so you can boost your Raspberry Pi to its limit!
If you’re new to Raspberry Pi or Linux, I’ve got something that can help you right away!
Download my free Linux commands cheat sheet – it’s a quick reference guide with all the essential commands you’ll need to get things done on your Raspberry Pi. Click here to get it for free!
Install a Lightweight OS
A performant server is one that only has what’s essential, so it can dedicate the rest of its resources to fulfilling its primary goal.
Installing a Linux distro intended for the desktop might sound convenient because it includes many common features, but it also means your server is bloated with extra features that take up resources.
You can do better by starting with a lightweight OS and only installing what you need.
You might also like: Need a clear GPIO pinout diagram? Here's mine.
If you’re a beginner, go for Raspberry Pi OS Lite edition, which can be flashed easily from Raspberry Pi Imager. For intermediate users, I recommend installing DietPi, which starts with fewer packages and should be faster. Lastly, advanced users looking for a challenge can try Alpine Linux, which is lightning fast and so barebones that it installs using less than 200 MB of disk space.

Get Rid of the Desktop Environment
This tip is similar to the idea of using a lightweight OS; that is, keeping things lean. All of my servers run headless, which means I don’t have a monitor plugged in, so I don’t need a GUI.
Desktop environments (DE) can eat up to 2 GB RAM at a minimum, which is significant for a Raspberry Pi, not to mention installing dependencies you won’t need on a server. These not only make updates more troublesome, but they also create a larger attack surface for black hat hackers to exploit.
Members get an ad-free version of every guide, plus exclusive project support.
Join the Community | Sign In
To create a server with no desktop environment, install from a minimal ISO.
For instance, Alma Linux offers different types of images for installation, and one of them is a minimal ISO with no DE.
Okay, but what if you already have a system up and don’t want to start over? In that case, you can disable the desktop environment and then uninstall the related packages.
Disable Unnecessary Services
Services are programs that run in the background and perform essential tasks on your system. But if you’re running, let’s say, a simple file server, you don’t need every service under the sun.
Many Linux distros will install services by default that you won’t want or need, which take up resources. That’s no bueno.
A good server practice is to disable and uninstall unused services.
Download the free PDF, keep it open, and stop wasting time on Google.
Download now
First, use the systemctl command to view which services are on your system: systemctl list-units --type=service --all

For example, I don’t have a printer connected to my server, so I don’t need the print service (CUPS).
So I’ll stop and disable CUPS so it won’t load at startup: sudo systemctl stop cups
sudo systemctl disable cups
Quick note: If you find it hard to remember all these commands, I’ve put them all on a one-page cheat sheet. You can download it for free here so you have it handy whenever you're working on a project.
Bonus tips: 7 Simple Linux Commands to See What’s Slowing You Down
Upgrade to Faster Storage

An SD card, the default storage for Raspberry Pi, is small and convenient, but it’s also the slowest type of storage you can use. Thankfully, there’s an easy solution to this problem: adding faster storage will make your server more responsive.
One possibility is to add a USB external enclosure, so you can attach an SSD, faster drives that are more commonly found in PCs. Alternatively, if you have a newer Raspberry Pi model and want the fastest storage available, then consider upgrading to an internal NVMe SSD.
Check this: 7 Surprising Uses for a Raspberry Pi
One of the benchmark tests we’ve run here has shown an external SSD as 2x-4x faster than an SD card, while an NVMe SSD was about 5x-10x faster, depending on the operation.
Write Logs to RAM

Some types of servers, especially web servers or game servers, generate a lot of logs. And if you’re running multiple servers at once, logging can create constant disk writes that cause performance stuttering, or worse, accelerate the death of your storage device.
You might think disabling logs is the answer, but then you won’t know how to troubleshoot when something goes wrong. That’s out. I think server logs are essential. Instead, a better solution is to write logs to memory temporarily, which is fast, and then bulk write changes to disk later.
It sounds difficult to implement, but there’s a program called Log2Ram that does this magic for you. It works great on the Raspberry Pi, and we’ve already written a guide about it here: Install Log2Ram on Raspberry Pi.
Create a Swap Space
A swap is a large file on disk that’s used to assist physical memory operations. On many Linux distros, a dedicated swap partition is automatically created for you during installation, so you might never have noticed it quietly working behind the scenes.
I was surprised, however, to find that some minimal installations don’t create a swap space at all. You might assume that would lead to a faster server overall, depending on RAM only. In my experience, even when I have a server with tons of RAM, I have found that a swap space prevents random lockups and aids smooth system performance.
Here’s how to check for a swap and create one if you don’t have it:
- Check if your system already has a swap:
swapon --show
- If your system doesn’t show one existing, here’s how to create a 2GB swap:
sudo fallocate -l 2G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
echo '/swapfile swap swap defaults 0 0' | sudo tee -a /etc/fstab - If you already have a swap but want to change its size, you’ll have to look up how to do it for your specific OS, as the process will differ depending on the setup.
For more recommendations on what size swap to create based on how much RAM your Raspberry Pi has, check out our article on swap.
Reduce GPU Memory Allocation
Did you know that the Raspberry Pi is designed to share some system memory with the GPU?
Download the free PDF, keep it open, and stop wasting time on Google.
Download now
For example, according to the output below, this particular Raspberry Pi 4 has 948 MB of RAM dedicated to the processor and 76 MB of RAM dedicated to graphics:

If you’re running a headless server with no desktop environment, that extra memory is better off being used to make your server zoom. You can reduce the memory reserved for the GPU to free up more memory for server operations.
Here’s how to change the GPU memory allocation on a Raspberry Pi:
- Edit the config.txt file:
sudo nano /boot/firmware/config.txt - Add this line at the top:
gpu_mem=16
(16 MB is the minimum value allowed.) - Restart:
sudo reboot
Note: This tweak won’t work on the Raspberry Pi 5, Pi 500, or CM5. It should still work, however, on the Pi 4 and earlier boards.
There’s one thing I should warn you about: this setting will also disable video codecs and camera support, which is great for squeezing out more performance, but not if you’re running Plex, Jellyfin, Kodi, or any media server that depends on video support.
Connect via Ethernet
The more Wi-Fi links along the line for a particular connection, the more it’s slowed down by distance, walls, and interference. Not to mention that the Wi-Fi adapter on the Raspberry Pi is not the strongest out there.
For this reason, using a wired Ethernet connection for your server is superior for both speed and stability.
I remember trying to stream Squid Game in 4K HD from my Raspberry Pi (Wi-Fi) server to my laptop (Wi-Fi) over the local network, and it kept freezing to buffer. I decided to test the network link speed between the devices directly.
- Run this command on the Raspberry Pi to start listening:
iperf3 -s
(You’ll need to install the iperf3 package first.) - Run this command on your client device to test the link speed:
iperf3 -c 192.168.1.100
(Replace the IP address in the example above with your Raspberry Pi’s address.)
It turns out from my results that the local network speed between them was majorly underperforming due to Wi-Fi complications. Once I connected the Pi to my network via Ethernet instead, the link speed improved immensely, even when serving clients connected via Wi-Fi.

Disable WiFi & Bluetooth
Remember how we recommended earlier to connect via wired networking and to disable unnecessary services?
Well, if you’re hosting a Raspberry Pi server connected via Ethernet, there’s a good chance you won’t need its Bluetooth and Wi-Fi features. Even when they’re not being used, these modules take up system resources.
Here’s how to turn off Wi-Fi and Bluetooth on the Raspberry Pi: sudo rfkill block wifi
sudo rfkill block bluetooth
As a failsafe, they’ll come back online after a reboot. If you’re certain you want to disable them permanently, we provide a method in our guide on 7 Ways to Disable Wi-Fi on Raspberry Pi.
Set a Static IP
Download the free PDF, keep it open, and stop wasting time on Google.
Download now
In most home networking setups, your Pi will automatically receive a random IP address from your router. Unfortunately, this means that the Pi may be assigned a different IP each time it reboots.
If you’re using your server locally, it’s easier to automate shortcuts if the IP is always the same.
Or if you need to connect to your Pi remotely over the internet, you may need to set up port forwarding to a specific internal address. Both of these situations become much more complicated if the IP address changes dynamically.
In short, it’s much easier to manage if you assign your Raspberry Pi a static IP address.

I prefer to set a static IP using my router’s admin panel, but other methods work. We cover them in our article: 3 Easy Ways to Set a Static IP Address on Raspberry Pi.
Cache DNS Queries
Every time your server connects to something on the internet, it translates the domain (e.g., raspberrytips.com) to an IP address (e.g., 162.159.133.45). To perform this resolution, it has to contact a DNS server on the Internet to make this request.

This process creates lag time, which is unnecessary when you’re connecting to the same places. You also might not realize that the DNS servers provided by your ISP are quite slow.
You can speed up these requests by making your Raspberry Pi cache DNS queries.
By storing these lookups locally, it can perform all of its server activities more quickly.
To set up DNS caching, all you need is software like Unbound, Bind, or DNSMasq. We wrote a guide on it here: How to Use Your Raspberry Pi as a DNS Server.
Cool Down with a Case

When a computer component overheats beyond its intended specification, it can lead to permanent damage. Luckily, the Raspberry Pi has a safety mechanism to prevent overheating: it throttles itself once the CPU passes 80 °C.
That’s great for protecting your hardware, but not so great for server performance. To stop your Raspberry Pi from throttling itself, you’ll need to provide adequate cooling.
The easiest way to add a cooling solution to the Raspberry Pi is to use a case.
Check out the links below for honest reviews of our favorite Raspberry Pi cases:
Switch the CPU Governor to Performance Mode
The CPU governor is manages your Raspberry Pi’s processor. There are multiple governors available, and they handle things in different ways. You can check which governor is being used on your system by running this command:cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
The output shows that my Pi’s CPU cores are set to the ‘ondemand’ governor. This is a safe default, which lowers the CPU clocks when idle to conserve electricity, but scales the clocks up when more processing power is needed.
But maybe you have an intensive server that you need to run on all four cylinders at all times.
For maximum speed, switch to the ‘performance’ governor instead.
Download the free PDF, keep it open, and stop wasting time on Google.
Download now
Here’s how to change the CPU governor on a Raspberry Pi:
- Install the cpufrequtils tool:
sudo apt install cpufrequtils - Switch to the performance governor:
sudo cpufreq-set -g performance - Check if the change has been applied:

The performance governor makes the CPU always run at max clocks. The downside to this setting is that it uses more electricity, and you’ll need adequate cooling to prevent overheating.
Choose Light Server Daemons
In computer lingo, a daemon is a program that runs in the background and doesn’t require interactive control from the user.
For instance, if you’re hosting a website, chatroom, or database on your Raspberry Pi, they’re all managed by server daemons.
Linux is all about choice, so there are many options when it comes to which daemon you decide to run for your server’s goals. These programs are not all created equal: some are simpler to use, some are more complex but more powerful, while some are heavier on resources.
To optimize your Raspberry Pi server for maximum performance, consider using lighter daemons over the more popular ones.
For example, instead of Apache web server, try lighttpd. Instead of vsftpd for an FTP server, I love using the built-in SFTP with SSH. MySQL is the most well-known database, but have you tried SQLite, which takes up less than 1 MB after installation?

By the way, these three alternatives in particular are available in the default repositories of many distros out there, so they’re quite easy to install: sudo apt install lighttpd ssh sqlite3
Prefer videos over reading? The RaspberryTips Community members get exclusive video lessons every month. Join now and watch them all right away. Get instant access.
Give Server Daemons Priority
We’ve already learned how to disable services we don’t need, but can we do the opposite and crank certain ones up a notch? For example, can you boost a Minecraft server? The answer is yes, and to do so, you need to understand how the ‘nice value’ works.
If you pull up the system process list in long format, you can see the ‘niceness’ of a process: ps -el

The lower the nice value, the higher priority the process gets. A value of 0 has normal priority, but a value of -20 represents the highest priority, meaning the system will dedicate the most resources to do this task quickly.
You can give your most important server daemons a higher system priority.
To do so, you’ll need to figure out its process ID (PID).
You can get it by filtering the process list with grep:
You might also like: Don’t waste money — read this guide before picking your Raspberry Pi.

With the PID, you can reassign the nice value to -20 (highest priority): sudo renice -n -20 -p <PID>
Phew, that’s every tweak I can think of at the moment! With these optimizations in place, you’ll have a lean, mean, Raspberry Pi server machine. If you have any tips you’d like to share that we missed here, please let us know in the community.
Whenever you’re ready, here are other ways I can help you:
Test Your Raspberry Pi Level (Free): Not sure why everything takes so long on your Raspberry Pi? Take this free 3-minute assessment and see what’s causing the problems.
The RaspberryTips Community: Need help or want to discuss your Raspberry Pi projects with others who actually get it? Join the RaspberryTips Community and get access to private forums, exclusive lessons, and direct help.
Master your Raspberry Pi in 30 days: If you are looking for the best tips to become an expert on Raspberry Pi, this book is for you. Learn useful Linux skills and practice multiple projects with step-by-step guides.
Master Python on Raspberry Pi: Create, understand, and improve any Python script for your Raspberry Pi. Learn the essentials step-by-step without losing time understanding useless concepts.
You can also find all my recommendations for tools and hardware on this page.
