9

It seems that avahi-daemon process, which is unknown to me, is using excessive amounts of CPU on my system

I have tried both htop and system monitor, and only htop show the CPU use. Screenshots are included below.

What can I do to make avahi-daemon behave?

Edit: The issue often occurs when playing the game Dota 2. I've been observing this for a week.

htop

System Monitor System monitor doesn't appear to show which process is consuming CPU, unlike htop.

sudo systemctl status avahi-daemon.s* As requested by @heynnema

Livy
  • 328
  • 3
  • 14
  • It turned out that 1 processor core is always maxed out for no reason, with all programs closed. To be honest I don't really know what the user avahi` is. But if it is true that `avahi` consumes 99% of CPU time, all 4 cores must be at full load. 1 out of 4 should be 25% (at least in the case of Windows Task Manager). – Livy Mar 31 '19 at 19:08
  • Even if there is a single looping thread, the OS should be able to "split" the workload to all 4 cores (by running it on each core for a short period of time), resulting in 25% CPU utilization on each core. I really don't know why it is locked to a single CPU core like that. – Livy Mar 31 '19 at 19:11
  • 1
    Edit your question with the output of `sudo systemctl status avahi-daemon.s*`. Report back to @heynnema – heynnema Mar 31 '19 at 20:26
  • @heynnema I did what you requested. Please take a look, thanks. The command was run while `avahi` was using 100% CPU time of 1 core. If I reboot, everything is back to normal. It often occurs when I play the game Dota 2 for a while. – Livy Apr 07 '19 at 04:02
  • @vidarlo I have limited knowledge about how the OS schedules threads for the CPU to process. But from what I have been observing for many years, single threaded programs are not locked to a single CPU core. Let's say you open 7-Zip and choose compression mode with 1 thread, you'll see the workload is split across all CPU cores in Windows Task Manager. Or maybe I am missing something here? – Livy Apr 07 '19 at 04:03
  • They are not locked to a single core, and can be moved. But moving incurs a penalty, as it takes time. You cannot split a single thread across multiple cores, but then again 7-zip is multithreaded. So yes, you are missing something. – vidarlo Apr 07 '19 at 08:13
  • Please do not post text as pictures. Copy from the terminal, and paste into the question. Please see https://askubuntu.com/editing-help#code on how to format command output. – vidarlo Apr 07 '19 at 08:13
  • I'm not familiar with Dota 2, but you might check it's prefs, looking for something having to do with network, or devices, or scanning. They've recently released an update on March 11 that you might check out. http://www.dota2.com/news/updates/ – heynnema Apr 07 '19 at 11:51
  • @vidarlo By "splitting", I mean running a single thread on each CPU core for a short amount of time, resulting in "balanced" CPU utilization in Windows Task Manager, ie: 25% on 4 cores instead of 100% on 1 core. Thanks to your information, now that I know it leads to some performance penalties. Anyway, Windows always moves the thread to all CPU cores, and it seems it is its default behavior. You are welcome to try any programs you want. As long as they are single-threaded, and you have more than 1 CPU core, you won't see any of them running at 100%. – Livy Apr 07 '19 at 13:49
  • No, windows will not move running threads if it can be avoided. – vidarlo Apr 07 '19 at 15:51

1 Answers1

6

Avahi daemon basically a network daemon that broadcasts your machine's IP address to the network. For example A printer broadcast its IP using Avahi daemon saying that "I am a printer and I can print your documents" if you don't have any such devices to be used in the network, you can disable the daemon using the below commands on Ubuntu

sudo systemctl disable avahi-daemon

Sometimes other software starts this daemon, so you can remove them permanently using the below commands.

apt-get remove avahi-daemon
oligofren
  • 630
  • 9
  • 20
  • At my office (university), there are a lot of printers, apparently linked to MacBookAir, probably shared by default instead of stay private, and even if I removed it, there are come back (under Jammy-22.04). I run `sudo kill -9 `, and it ma fans stops to running. – bcag2 Sep 30 '22 at 08:31
  • That leads to new problems. To avoid error messages in systemd, you have to disbble the avahi socket too: `sudo systemctl disable avahi-daemon.socket` – Erich Jan 05 '23 at 12:23
  • But now the the dbus-daemon complains every few seconds that cups-browsed needs avahi. – Erich Jan 05 '23 at 12:25
  • 1
    @Erich so disable cups-browsed as well `sudo systemctl disable cups-browsed.service`. This is just another part of the printer-finding system. – user19642323 May 20 '23 at 09:03