Hi,

I experienced high CPU usage in avahi-deamon when a lot of services are
announced in the network. This results more than 30 seconds of
saturated CPU after queries when ~300 services are present. This also
leads to DBUS timeouts in connected clients in some cases.

Using oprofile, I traced the CPU usage to avahi_unescape_label() and
(to some extent) avahi_utf8_valid().

From reading the source, and analyzing gdb backtraces, it looks like
avahi_unescape_label() is used at many places, and calls
avahi_utf8_valid() just before the return. The unescape function copies
a source string to a destination string byte-by-byte most of the time.
Label strings received over the network are stored unmodified, and
every time they are used, avahi_unescape_label() is used. For example,
when getting queries with a lot of known answers, domain_equal() is
used for comparison, resulting in a big load of avahi_unescape_label()
invocations while contructing and queueing the response.

avahi_unescape_label() is also used for simple validity checks using
assert() (over and over again for the same string), and to split
domains into their parts by stopping when a dot is found. So it is
somewhat multi-purpose, making it more difficult to replace.

From my point of view, there is no easy fix for this. I think the
labels should be stored unescaped when they are received to make
comparisons more lightweight and making most of the validity checks
superfluous.

At last, some questions:

Am I wrong with my obervation?

If not, is this a known issue?

Was this already discussed in the past?

Are there already any efforts rework the string handling?

Regards,
Tino Mettler




-----
Unsere Datenschutzerklärung finden Sie hier 
(https://www.lawo.com/de/website/company/rechtliches/datenschutz.html).
See our Privacy Policy here 
(https://www.lawo.com/en/website/company/legal/data-protection.html).
_______________________________________________
avahi mailing list
avahi@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/avahi

Reply via email to