Nodejs javascript nextcloud talk client

FYI, a simple nextcloud talk javascript nodejs client https://github.com/jjqoie/nctalkclient.git

One use case is integration of push notification and messaging in iobroker (smarthome system)

hello, I just noticed that when my client is listening to more than one chat room in parallel, it is making my nextcloud instance quite slow and less responsive but I struggle to understand why.
Slow means that for example when I enter a new talk message it takes sometimes up to 30 seconds until it was sent, but also switching between the nextcloud tabs talk to files is less responsive…

Following API/URL GET request is used:
/ocs/v2.php/apps/spreed/api/v1/chat/${this.roominfo.token}?lookIntoFuture=1&setReadMarker=1&format=json&lastKnownMessageId=${this.lastmsgid}
These are the http(s) options:
this.httpoptions = {
host: _options.server,
port: _options.port,
timeout: 120000,
// authentication headers
headers: {
“Authorization”: "Basic " + Buffer.from(${_options.user}:${_options.pass}).toString(“base64”),
“content-type”: “application/json”, “OCS-APIRequest”: “true”,
“USER_AGENT”: “js-nctalkclient”,
“ACCEPT_LANGUAGE”: “de, en-US;q=0.9”
},
};

Infos about the nextcloud system I test it with…

       "nextcloud": {
            "system": {
                "version": "22.2.3.0",
                "theme": "",
                "enable_avatars": "yes",
                "enable_previews": "yes",
                "memcache.local": "\\OC\\Memcache\\APCu",
                "memcache.distributed": "none",
                "filelocking.enabled": "yes",
                "memcache.locking": "none",
                "debug": "no",
                "freespace": 1525465989120,
                "cpuload": [
                    0.740234375,
                    0.470703125,
                    0.39208984375
                ],
                "mem_total": 32740464,
                "mem_free": 27926364,
                "swap_total": 0,
                "swap_free": 0,

Thank you for any idea - how to debug further or hint what could be the problem…

It seems the delay is related to when the http GET “request receive-chat-messages-of-a-conversation” of the js-nctalkclient get a respones, which is usually the 30sec default timeout time (https://nextcloud-talk.readthedocs.io/en/latest/chat/#receive-chat-messages-of-a-conversation)

Is it only allow to have one request active at the same time, even if the room tokens are different?

FYI,
Using the offical docker compose for a nextcloud instance running on NGINX and FPM (GitHub - nextcloud/docker: ⛴ Docker image of Nextcloud) , the default settings for max_children is 5 which is to less using long polling request to wait for new nextcloud talk messages.
Improved configuration I use now - adjust /usr/local/etc/php-fpm.d/www.conf in the fpm_app container. Note: With this settings nextcloud can consume a lot of RAM up to 8GB (estimated) especially when looking at photos

/usr/local/etc/php-fpm.d/www.conf

pm = dynamic
pm.max_children = 32
pm.start_servers = 12
pm.min_spare_servers = 8
pm.max_spare_servers = 16
pm.max_requests = 1000