DNF 3: better performance and a move to C++
It has only been a few years since DNF replaced Yum as the default Fedora package-management tool; that was done for Fedora 22 in 2015, though DNF had been available for several earlier Fedora releases. Since that time, DNF development has proceeded; it started a move from Python/C to all C in 2016 and has made multiple releases over the years. From an outsider's perspective, no major changes seem necessary, which makes the announcement of DNF 3, and a move to C++, a bit surprising to some.
For many years, Yum was the package-management front-end for many RPM-based distributions, including Fedora and RHEL. But it suffered from poor performance and high memory use; part of that was attributed to its iterative dependency solver. DNF was meant to fix those problems. It uses the libsolv dependency resolution library developed by openSUSE, by way of the hawkey library.
Though it wasn't a perfect drop-in replacement for Yum, DNF did replace it. But, even though DNF performed better, often much better, than its predecessor, the project continued to focus on making it faster. Ultimately, that's a large part of the reasons behind DNF 3.
Since the switch to DNF, it has steadily improved performance-wise, while maintaining the features and commands that users have been accustomed to since way back in the Yum days (just switching from "yum" to "dnf" on the command line). Under the covers, though, things were shifting around: hawkey got subsumed into libhif, which turned into libdnf. It is libdnf that is the main focus of the upcoming changes; DNF itself is envisioned as a small wrapper around the library.
In the announcement on the DNF blog, the focus on performance is evident.
There is a graph comparing the in-development version of libdnf with the
versions that shipped in Fedora 26 and 27. In all five of the
queries tested, the new code is faster; in some cases massively so (from 77
seconds to 2.5 and 40 to 2.4, for example). Beyond better performance, the
DNF 3 effort is also targeting consistent behavior between various
package-management components (between DNF and PackageKit, in particular),
a better defined and maintained API, and compatibility ("as much as
possible
") with the existing C and Python APIs. For a number of
reasons, the project believes that switching to C++ will help it achieve
those goals.
DNF project leader Daniel Mach posted a note about the announcement to the Fedora devel mailing list on March 22. It will probably not come as a surprise that some of the reaction was about the language choice. Matěj Cepl said:
Using Rust would require LLVM, though; that's a step too far for Neal Gompa:
Gompa was also concerned about the difficulty of programming in Rust versus
C++. Martin Kolman thinks C++ makes a
better choice, rather than simply following the most-recent trend: "it is
not bad to be a bit conservative when core
system components
are concerned
". Given that the project has already made its choice
and started development down that path, C++ is basically a fait
accompli at this point.
Marcin Juszkiewicz raised the issue of sharing repository metadata between users, which is something of a longtime sore point for some. If a regular user runs DNF to query about the availability or version of some package, DNF will go off and download the latest metadata into /tmp. To some, that's a big waste of time, to others, who might not have a speedy internet connection, it is more or less intolerable. Since there is already a copy of the metadata available (root's version), it should be used by everyone, he said.
The downside of that idea, of course, is that the metadata in
/var/cache/dnf may be out of date; regular users should not be
able to update the system copy, so there are worries about giving outdated
responses to these queries. Tom Hughes asked if Juszkiewicz had a proposal on how to
share the metadata "in a secure way
". He also wondered what
should happen if the metadata was out of date.
Juszkiewicz had a fairly
straightforward thought about how a regular
user would interact with the metadata: "Use. Not download. And inform
(like always) how old that data is.
" As he and others in the thread
pointed out, Debian's APT separates the metadata update from the query
functionality, while DNF (like Yum before it) combines the two; if a DNF
query finds
out-of-date metadata, it seeks to remedy that before proceeding. Several
thread participants seemed to prefer the APT scheme (or at least some way to
share read-only access to the metadata). It is not at all clear what, if
anything, will happen with that, but it is an annoyance,
at least, for some.
Some other thoughts and enhancements were batted around a bit, but the overall impression is one of muted approval of the idea. Most probably just hope that the changes don't really affect them at all, other than seeing faster query responses. That is probably the DNF developers' hope as well; package managers are the kinds of programs that can be mostly ignored—so long as they work.