Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
To: openembedded-core@lists.openembedded.org
Cc: Alexander Kanavin <alex.kanavin@gmail.com>
Subject: [PATCH 0/2] Restore performance of rpm in Docker containers
Date: Fri, 11 May 2018 00:20:40 +0200	[thread overview]
Message-ID: <cover.1525990692.git.pkj@axis.com> (raw)

As recently discussed on the Yocto list in the "ROOTFS_RPM_DEBUG 
undocumented" thread, there are performance issues with dnf/rpm 
when building in a Docker container. The problem is due to the 
Docker container reporting the maximum number of open files as 
unlimited and there is code in rpm that loops over all potentially 
open file descriptors. Alexander Kanavin supplied a patch for rpm 
(see commit 6f1822e5 in meta) that was supposed to correct this, but 
unfortunately it only solved a part of the problem.

To really solve the problem, I reverted Alexander's patch, and 
applied a new one that solves both the problematic code identified 
by Alexander, and an identical code path in another function.

It is possible to reproduce the problem without Docker by increasing 
the maximum number of open files. This can be done by editing 
/etc/security/limits.conf and adding:

* - nofile  100000000

where 100000000 is the maximum number of open files. It is also 
very likely that you need to increase the global limit by running:

sudo sysctl -w fs.nr_open=100000000

After that, ssh to localhost to get a new session where the new 
settings are active. Then you can use `ulimit -n <number>` to set 
the max you want to try.

I also did som measurements when building core-image-minimal. Here 
are the times I got for the do_rootfs task with different maximums:

Max files  Time 
---------  -----
1024       30 seconds
1048576    50 seconds
10000000   3 minutes 40 seconds
100000000  31 minutes

//Peter

The following changes since commit f4c938c47424424b89cde2269bd92cebc9a6ac1a:

  packagegroup: Do not add libssp to SDK (2018-05-09 10:47:51 +0100)

are available in the git repository at:

  git://push.yoctoproject.org/poky-contrib pkj/rpm-performance

Peter Kjellerstedt (2):
  Revert "rpm: add a patch to help with Docker performance issues"
  rpm: Assume a max limit of 1024 open files

 ...001-Assume-a-max-limit-of-1024-open-files.patch | 61 ++++++++++++++++++++++
 ...FD_CLOEXEC-on-opened-files-before-exec-fr.patch | 49 -----------------
 meta/recipes-devtools/rpm/rpm_4.14.1.bb            |  3 +-
 3 files changed, 63 insertions(+), 50 deletions(-)
 create mode 100644 meta/recipes-devtools/rpm/files/0001-Assume-a-max-limit-of-1024-open-files.patch
 delete mode 100644 meta/recipes-devtools/rpm/files/0001-Revert-Set-FD_CLOEXEC-on-opened-files-before-exec-fr.patch

-- 
2.12.0



             reply	other threads:[~2018-05-10 22:21 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-10 22:20 Peter Kjellerstedt [this message]
2018-05-10 22:20 ` [PATCH 1/2] Revert "rpm: add a patch to help with Docker performance issues" Peter Kjellerstedt
2018-05-10 22:20 ` [PATCH 2/2] rpm: Assume a max limit of 1024 open files Peter Kjellerstedt
2018-05-11  5:43   ` Alexander Kanavin
2018-05-11 10:39     ` Peter Kjellerstedt
2018-05-11 15:27       ` Alexander Kanavin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cover.1525990692.git.pkj@axis.com \
    --to=peter.kjellerstedt@axis.com \
    --cc=alex.kanavin@gmail.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox