Why does my linux server boot so slow? (systemd)

Some users have asked me in the past: "Why does my server boot so slow?" or "My server takes forever to boot -- why?"

Typically, the reason is the processes that start up when the machine starts the OS and services are starting. If you're on CentOS 7.x (or any system that is using systemd for that matter), then you can have a graph generated in HTML5 SVG that will show the services starting and how long it takes each one to start up.

How to generate the graph:

Just run the following command at console/shell:

# systemd-analyze plot > /var/www/html/graph.html

Note: You can do it without redirecting the output, but you'll be presented with a wall of text that means nothing in CLI:

  <rect class="deactivating" x="1576.108" y="1640.000" width="0.000" height="19.000" />
  <text class="right" x="1406.599" y="1654.000">salt-minion.service</text>
  <rect class="activating" x="1413.286" y="1660.000" width="0.000" height="19.000" />
  <rect class="active" x="1413.286" y="1660.000" width="162.823" height="19.000" />
  <rect class="deactivating" x="1576.108" y="1660.000" width="0.000" height="19.000" />
  <text class="right" x="1408.286" y="1674.000">sshd.service</text>
  <rect class="activating" x="1413.352" y="1680.000" width="160.718" height="19.000" />
  <rect class="active" x="1574.070" y="1680.000" width="2.039" height="19.000" />
  <rect class="deactivating" x="1576.108" y="1680.000" width="0.000" height="19.000" />
  <text class="right" x="1408.352" y="1694.000">tuned.service (1.607s)</text>
  <rect class="activating" x="1413.355" y="1700.000" width="0.000" height="19.000" />
  <rect class="active" x="1413.355" y="1700.000" width="162.753" height="19.000" />
  <rect class="deactivating" x="1576.108" y="1700.000" width="0.000" height="19.000" />

View the Graph:

After this output has been generated, navigate to your servers IP address (or wherever you dumped the plot) to view it (ex. http://192.168.1.2/graphs.html):

chrome_2016-08-26_22-27-51

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *