Mahamudul Hasan Rubel
HomeAboutProjectsSkillsExperienceBlogPhotosContact
Mahamudul Hasan Rubel

Senior Software Engineer crafting high-performance web applications and SaaS platforms.

Navigation

  • Home
  • About
  • Projects
  • Skills
  • Experience
  • Blog
  • Photos
  • Contact

Get in Touch

Available for senior/lead roles and consulting.

bd.mhrubel@gmail.comHire Me

© 2026 Mahamudul Hasan Rubel. All rights reserved.

Built with using Next.js 16 & Tailwind v4

Back to Blog
DevOpsJune 22, 20264 min read

Optimizing Linux Boot Times: A Practical Guide for VPS

Optimizing Linux boot times is critical for VPS scaling. Learn how to use systemd-analyze to identify bottlenecks and speed up your server startup sequence.

linuxsystemdperformancevpsdevopskernelDockerCI/CD

Last month, one of my production nodes took nearly 45 seconds to come back online after a routine kernel update. In a world where we expect near-instant deployments, waiting nearly a minute for a cold start is a lifetime.

I spent the next two hours digging into the init sequence to understand why the OS was hanging. The culprit wasn't the hardware; it was a pile of legacy services and misconfigured network waits that had accumulated over months of "quick fixes." If you're managing your own infrastructure, Linux performance tuning using Cgroups v2 and Systemd slices is only half the battle; the actual boot sequence often hides the most persistent latency.

Getting started with systemd-analyze

The first step in any performance project is measurement. If you can't measure it, you're just guessing. Thankfully, systemd comes with a built-in diagnostic tool that’s incredibly powerful: systemd-analyze.

Start by checking the total time spent in each phase of the boot process:

Bash
systemd-analyze

You'll get an output that breaks down the time spent in the kernel, the initrd, and the userspace. If your kernel time is high, you’re likely dealing with hardware initialization or driver loading issues. However, most VPS users will find the "userspace" section is the real offender.

To see which specific services are dragging their feet, run:

Bash
systemd-analyze blame

This command lists every unit file in descending order of time taken to initialize. I often see NetworkManager-wait-online.service or heavy logging daemons hogging the top spots.

Digging into boot optimization

Once you have your list, don't just start disabling things. I once disabled a service because it looked "slow," only to realize it was a dependency for the SSH daemon. My server became unreachable, and I had to use the provider's web console to roll back.

Instead, look for these common patterns:

  1. Network-dependent services: Services that wait for a network connection that isn't required for core functionality.
  2. Redundant logging: Multiple logging daemons fighting for resources.
  3. Filesystem checks: Large partitions can trigger slow fsck checks on every boot.

If you find a service that is essential but slow, check if it can be deferred. You can modify the unit file to start After=network-online.target or change it to Wants= instead of Requires= to make the boot sequence more resilient to minor delays.

Visualizing the bottleneck

If the list isn't enough, generate a visual map of your boot sequence. This is where you can see exactly where the parallel execution is failing:

Bash
systemd-analyze plot > boot_analysis.svg

Open this file in your browser. It’s a Gantt chart of your startup. You’ll see exactly when services start and finish, and more importantly, where the gaps are. Look for long empty bars—these represent services waiting on other processes.

When you're dealing with complex stacks, you might also be interested in Linux kernel tuning for socket exhaustion, as these kernel-level adjustments can sometimes conflict with standard boot-time configurations if not carefully sequenced.

Practical steps for VPS scaling

When you're dealing with VPS scaling, boot time is about more than just vanity metrics. If you have an auto-scaling group or a CI/CD pipeline that spins up ephemeral runners, every second you save translates to faster deployments and lower costs.

Here is my checklist for a faster boot:

  • Audit systemd-analyze blame: Identify the top 5 slowest services.
  • Disable unnecessary units: If you aren't using Bluetooth, cups, or modem-manager, stop and mask them.
  • Check for dependency chains: Use systemd-analyze critical-chain to see which services are blocking the critical path to a "ready" state.
  • Optimize network waits: If your app doesn't need the network immediately, don't let the boot wait for a full DHCP handshake.

Frequently Asked Questions

Is it safe to disable services listed in systemd-analyze blame?

Not always. Always check systemctl status <service> to see what it does. If you aren't sure, try stopping it first (systemctl stop <service>) and testing your application for a few hours before masking it.

Why is my kernel boot time so high?

On a VPS, this is usually due to the hypervisor's environment or the kernel's attempt to probe non-existent hardware. If you're running a custom kernel, you might be loading unnecessary modules. Check dmesg to see if there are long pauses between log entries.

Does this affect application performance?

Generally, no. This is purely about the time it takes to reach a "ready" state. If you are struggling with runtime performance, you might want to look into eBPF-based socket monitoring to catch issues that only appear under load.

Final thoughts

I’ve found that the biggest gains usually come from removing "cruft"—services that were installed for a specific task three months ago and never removed. Don't fall into the trap of over-optimizing the kernel parameters if your actual bottleneck is a poorly written shell script running at startup.

I'm still tinkering with my own systemd configurations. Sometimes I find that a service I thought was critical is actually redundant, and removing it makes the entire system feel snappier. Keep testing, keep measuring, and don't be afraid to revert if your system feels unstable.

Back to Blog

Similar Posts

Close-up of a smart socket with vibrant blue and pink neon lighting, showcasing modern technology.
DevOpsJune 21, 20264 min read

Systemd Timers: The Better Way to Handle Linux Automation

Systemd timers provide a robust, observable alternative to cron for Linux automation. Learn how to manage server maintenance tasks with native systemd features.

Read more
Deliveryman in red uniform delivers package outdoors in daylight.
DevOps
June 20, 2026
4 min read

Running background workers with systemd for production reliability

Running background workers with systemd is the gold standard for process management. Learn to write robust service files to keep your tasks alive.

Read more
Close-up of software development tools displaying code and version control systems on a computer monitor.
DevOpsJune 20, 20264 min read

Deploying a side project on a single cheap VPS reliably

Deploying a side project on a single cheap VPS is the best way to master infrastructure. Learn to secure, automate, and manage your stack without breaking.

Read more