How to find out what app / process is using CPU?

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:

example

Or for longer, use three backticks above and below the code snippet:

longer
example
here

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version (eg, 29.0.5): 28.0.6
Operating system and version (eg, Ubuntu 29.04): docker/Ubuntu
Apache or nginx version (eg, Apache 2.4.25): nginx 1.27
PHP version (eg, 8.3): 8.2.19

I see a sudden popup of 100% CPU of the NC app container. Nothing in the logs screams “I’m the culprit”. I/O usage is fairly low.
In top I only see php-fpm as the process which is eating CPU. Is there any way to narrow down in NC which app or process is consuming what?

Oh, actually, in the docker logs I see

[14-Jun-2024 08:10:57] NOTICE: [pool www] child 362187 started
[14-Jun-2024 08:10:57] NOTICE: [pool www] child 362187 exited with code 0 after 0.009666 seconds from start

Running through pretty fast.

Could you give more details about the used docker image?

That is the expected behaviour. The messages are marked as “NOTICE”
Read this:

The fpm process is the “Fast Process Manager” of php. In other words, it is the SAPI, i.e. the link between PHP and application, via which Nextcloud communicates with the php core and creates and terminates the required child processes according to the settings and the load on the server.

There are countless ways to observe fpm processes, but it is a bit more complicated with a Docker image than when it is running on bare metal.
But from my point of view it is not something to worry about.


Much and good luck,
ernolf

I built the image based on the official one. I’m just adding a few packages.

FROM nextcloud:28-fpm

RUN set -ex; \
    apt-get update; \
    apt-get install -y --no-install-recommends \
        ffmpeg \
        libmagickcore-6.q16-6-extra \
        ghostscript \
        procps \
        smbclient \
        supervisor \
#       libreoffice \
    ; \
    rm -rf /var/lib/apt/lists/*

#RUN set -ex; \
#    savedAptMark="$(apt-mark showmanual)"; \

RUN set -ex; \
    apt-get update; \
    apt-get install -y --no-install-recommends \
        libbz2-dev \
        libc-client-dev \
        libkrb5-dev \
        libsmbclient-dev

RUN set -ex; \
    docker-php-ext-configure imap --with-kerberos --with-imap-ssl; \
    docker-php-ext-install \
        bz2 \
        imap

RUN set -ex; \
    pecl install smbclient; \
    docker-php-ext-enable smbclient;

RUN mkdir -p \
    /var/log/supervisord \
    /var/run/supervisord

COPY supervisord.conf /

run sed -i 's/\(^ *<policy.*rights="\)\([^"]*\)\(".*PDF.*\/>\)/\1read|write\3/1' /etc/ImageMagick-6/policy.xml

ENV NEXTCLOUD_UPDATE=1

CMD ["/usr/bin/supervisord", "-c", "/supervisord.conf"]

Interestingly enough, those messages stopped after restarting the container.
And those messages went through like superfast as you can tell from the log “… exited with code 0 after 0.009666 seconds…”

Gotta keep an eye on that…