Kurento / bugtracker

[ARCHIVED] Contents migrated to monorepo: https://github.com/Kurento/kurento
46 stars 10 forks source link

CPU usage of composite and hubport issue #576

Open dannyZhou opened 3 years ago

dannyZhou commented 3 years ago

Prerequisites

These are MANDATORY, otherwise the issue will be automatically closed.

Issue description

CPU usage of composite and hubport issue.

In logic 1 about 300% cpu usage. In logic 2 about 200% cpu usage.

I open 5 tabs in chrome to reduce this bug. 5 tabs means endpoint1 2 3 4 5 in the codes.

logic 1

        composite = new Composite.Builder(pipeline).build();

        endpoint1 = new WebRtcEndpoint.Builder(pipeline).build();
        endpoint2 = new WebRtcEndpoint.Builder(pipeline).build();
        endpoint3 = new WebRtcEndpoint.Builder(pipeline).build();
        endpoint4 = new WebRtcEndpoint.Builder(pipeline).build();
        endpoint5 = new WebRtcEndpoint.Builder(pipeline).build();

        hubPort1 = new HubPort.Builder(composite).build();
        hubPort2 = new HubPort.Builder(composite).build();
        hubPort3 = new HubPort.Builder(composite).build();
        hubPort4 = new HubPort.Builder(composite).build();
        hubPort5 = new HubPort.Builder(composite).build();

        endpoint1.connect(hubPort1);
        endpoint2.connect(hubPort2);
        endpoint3.connect(hubPort3);
        endpoint4.connect(hubPort4);
        endpoint5.connect(hubPort5);

        hubPort1.connect(endpoint1);
        hubPort2.connect(endpoint2);
        hubPort3.connect(endpoint3);
        hubPort4.connect(endpoint4);
        hubPort5.connect(endpoint5);

logic 2


        composite = new Composite.Builder(pipeline).build();

        endpoint1 = new WebRtcEndpoint.Builder(pipeline).build();
        endpoint2 = new WebRtcEndpoint.Builder(pipeline).build();
        endpoint3 = new WebRtcEndpoint.Builder(pipeline).build();
        endpoint4 = new WebRtcEndpoint.Builder(pipeline).build();
        endpoint5 = new WebRtcEndpoint.Builder(pipeline).build();

        hubPort1 = new HubPort.Builder(composite).build();
        hubPort2 = new HubPort.Builder(composite).build();
        hubPort3 = new HubPort.Builder(composite).build();
        hubPort4 = new HubPort.Builder(composite).build();
        hubPort5 = new HubPort.Builder(composite).build();

        endpoint1.connect(hubPort1);
        endpoint2.connect(hubPort2);
        endpoint3.connect(hubPort3);
        endpoint4.connect(hubPort4);
        endpoint5.connect(hubPort5);

        hubPort1.connect(endpoint1);
        hubPort1.connect(endpoint2);
        hubPort1.connect(endpoint3);
        hubPort1.connect(endpoint4);
        hubPort1.connect(endpoint5);

the cpu usage of logic 2 is very highly than logic 1

Is this a bug?

Context

How to reproduce?

The codes is very sample. Please see codes.

Expected & current behavior

I think two codes should cost same cpu usage.

(Optional) Possible solution

My english is poor sorry.

我对这个问题的猜测是: logic2 里面很多 cpu 占用是做了重复的工作。如果一个流已经被合成了,那么同样的工作不应该再做第二遍。在这个问题中,我认为,logic1 转码只转了一次,但是 logic2 中转码转了5次。

Translate

I think the reason about this issue is that: some useless logic exists in `logic2` . For example, if one composite output stream has encoded to h264 and other endpoint should use same stream instead of encode again.

Info about your environment

About Kurento Media Server

About your Application Server

About end-user clients

Run these commands

cat /etc/lsb-release

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04.7 LTS"
kurento-media-server --version

Kurento Media Server version: 6.15.0
Found modules:
    'core' version 6.15.0
    'elements' version 6.15.0
    'filters' version 6.15.0
dpkg -l | grep -Pi 'kurento|kms-|gst.*1.5|nice'
ii  gir1.2-gst-plugins-base-1.5            1.8.1-1kurento2.16.04                           amd64        Description: GObject introspection data for the GStreamer Plugins Base library
ii  gir1.2-gstreamer-1.5                   1.8.1-1kurento2.16.04                           amd64        Description: GObject introspection data for the GStreamer library
ii  gir1.2-nice-0.1:amd64                  0.1.18-0kurento1.16.04                          amd64        ICE library (GObject introspection)
ii  gstreamer1.5-alsa:amd64                1.8.1-1kurento2.16.04                           amd64        GStreamer plugin for ALSA
ii  gstreamer1.5-libav:amd64               1.8.1-1kurento1.16.04                           amd64        libav plugin for GStreamer
ii  gstreamer1.5-libav-dbg:amd64           1.8.1-1kurento1.16.04                           amd64        libav plugin for GStreamer (debug symbols)
ii  gstreamer1.5-nice:amd64                0.1.18-0kurento1.16.04                          amd64        ICE library (GStreamer 1.5 plugin)
ii  gstreamer1.5-nice-dbgsym:amd64         0.1.18-0kurento1.16.04                          amd64        debug symbols for package gstreamer1.5-nice
ii  gstreamer1.5-plugins-bad:amd64         1.8.1-1kurento5.16.04                           amd64        GStreamer plugins from the "bad" set
ii  gstreamer1.5-plugins-bad-dbg:amd64     1.8.1-1kurento5.16.04                           amd64        GStreamer plugins from the "bad" set (debug symbols)
ii  gstreamer1.5-plugins-base:amd64        1.8.1-1kurento2.16.04                           amd64        GStreamer plugins from the "base" set
ii  gstreamer1.5-plugins-base-dbg:amd64    1.8.1-1kurento2.16.04                           amd64        GStreamer plugins from the "base" set
ii  gstreamer1.5-plugins-good:amd64        1.8.1-1kurento5.16.04                           amd64        GStreamer plugins from the "good" set
ii  gstreamer1.5-plugins-good-dbg:amd64    1.8.1-1kurento5.16.04                           amd64        GStreamer plugins from the "good" set
ii  gstreamer1.5-plugins-ugly:amd64        1.8.1-1kurento1.16.04                           amd64        GStreamer plugins from the "ugly" set
ii  gstreamer1.5-plugins-ugly-dbg:amd64    1.8.1-1kurento1.16.04                           amd64        GStreamer plugins from the "ugly" set (debug symbols)
ii  gstreamer1.5-pulseaudio:amd64          1.8.1-1kurento5.16.04                           amd64        GStreamer plugin for PulseAudio
ii  gstreamer1.5-x:amd64                   1.8.1-1kurento2.16.04                           amd64        GStreamer plugins for X11 and Pango
ii  kms-cmake-utils                        6.15.0-0kurento1.16.04                          all          Kurento CMake utils
ii  kms-cmake-utils-build-deps             6.15.0-0kurento1                                all          build-dependencies for kms-cmake-utils
ii  kms-core                               6.15.0-0kurento1                                amd64        Kurento Core module
ii  kms-core-dbg                           6.15.0-0kurento1                                amd64        Kurento Core module
ii  kms-core-dev                           6.15.0-0kurento1                                amd64        Kurento Core module
ii  kms-elements                           6.15.0-0kurento1                                amd64        Kurento Elements module
ii  kms-elements-build-deps                6.15.0-0kurento1                                all          build-dependencies for kms-elements
ii  kms-elements-dbg                       6.15.0-0kurento1                                amd64        Kurento Elements module
ii  kms-elements-dev                       6.15.0-0kurento1                                amd64        Kurento Elements module
ii  kms-filters                            6.15.0-0kurento1.16.04                          amd64        Kurento Filters module
ii  kms-filters-dbg                        6.15.0-0kurento1.16.04                          amd64        Kurento Filters module
ii  kms-filters-dev                        6.15.0-0kurento1.16.04                          amd64        Kurento Filters module
ii  kms-jsonrpc                            6.15.0-0kurento1.16.04                          amd64        Kurento JSON-RPC library
ii  kms-jsonrpc-dbg                        6.15.0-0kurento1.16.04                          amd64        Kurento JSON-RPC library
ii  kms-jsonrpc-dev                        6.15.0-0kurento1.16.04                          amd64        Kurento JSON-RPC library
ii  kmsjsoncpp                             1.6.3-1kurento1.16.04                           amd64        Kurento jsoncpp library
ii  kmsjsoncpp-dbg                         1.6.3-1kurento1.16.04                           amd64        Kurento jsoncpp library
ii  kmsjsoncpp-dev                         1.6.3-1kurento1.16.04                           amd64        Kurento jsonrpc library
ii  kurento-dbg                            6.15.0-0kurento1.16.04                          amd64        Meta-package that installs debug symbols
ii  kurento-media-server                   6.15.0-0kurento1.16.04                          amd64        Kurento Media Server
ii  kurento-media-server-dbg               6.15.0-0kurento1.16.04                          amd64        Kurento Media Server
ii  kurento-media-server-dev               6.15.0-0kurento1.16.04                          amd64        Kurento Media Server
ii  kurento-module-creator                 6.15.0-0kurento1.16.04                          all          Kurento Module Creator
ii  kurento-module-creator-build-deps      6.15.0-0kurento1                                all          build-dependencies for kurento-module-creator
ii  libgstreamer-plugins-bad1.5-0:amd64    1.8.1-1kurento5.16.04                           amd64        GStreamer development files for libraries from the "bad" set
ii  libgstreamer-plugins-base1.5-0:amd64   1.8.1-1kurento2.16.04                           amd64        GStreamer libraries from the "base" set
ii  libgstreamer-plugins-base1.5-dev       1.8.1-1kurento2.16.04                           amd64        GStreamer development files for libraries from the "base" set
ii  libgstreamer1.5-0:amd64                1.8.1-1kurento2.16.04                           amd64        Core GStreamer libraries and elements
ii  libgstreamer1.5-0-dbg:amd64            1.8.1-1kurento2.16.04                           amd64        Core GStreamer libraries and elements
ii  libgstreamer1.5-dev                    1.8.1-1kurento2.16.04                           amd64        GStreamer core development files
ii  libnice-dev                            0.1.18-0kurento1.16.04                          amd64        ICE library (development files)
ii  libnice10:amd64                        0.1.18-0kurento1.16.04                          amd64        ICE library (shared library)
ii  libnice10-dbgsym:amd64                 0.1.18-0kurento1.16.04                          amd64        debug symbols for package libnice10
ii  libsrtp0:amd64                         1.6.0-0kurento1.16.04                           amd64        Secure RTP (SRTP) and UST Reference Implementations - shared library
ii  libusrsctp                             0.9.2-1kurento1.16.04                           amd64        sctp-refimpl library
ii  openh264                               1.5.0-0kurento1.16.04                           amd64        H.264 Video Codec provided by Cisco Systems, Inc.
ii  openh264-gst-plugins-bad-1.5:amd64     1.8.1-1kurento5.16.04                           amd64        GStreamer plugins from openh264
ii  openwebrtc-gst-plugins                 0.10.0-1kurento1.16.04                          amd64        OpenWebRTC specific GStreamer plugins
ii  openwebrtc-gst-plugins-dbg             0.10.0-1kurento1.16.04                          amd64        OpenWebRTC specific GStreamer plugins
ii  openwebrtc-gst-plugins-dev             0.10.0-1kurento1.16.04                          amd64        OpenWebRTC specific GStreamer plugins
github-actions[bot] commented 3 years ago

Hello @dannyZhou! :wave: we're sorry you found a bug... so first of all, thank you very much for reporting it.

To know about progress, check in Triage. All issues are considered Backlog Candidates until work priorities align and the issue is selected for development. It will then become part of our official Backlog.