Skip to content

Major slowdown since version 1.17.0 #1501

@floverdevel

Description

@floverdevel

Hi all :)
It's my first bug report, i hope i supplied the right amount of information.

Bug Report

For a long time we ran our website with the mongodb extension version 1.16.0, 1.16.1 and 1.16.2.
It gave an http response between 200ms~300 ms.

A couple of weeks ago we updated php mongodb extension to version 1.17.0 and since this update, our website responds time is now from 1000ms to 2000ms.

Environment

The mongodb extension is installed via a Dockerfile

RUN apt-get update && \
    apt-get install -y --no-install-recommends \
    php8.2-apcu \
    php8.2-curl \
    php8.2-mbstring \
    php8.2-memcached \
    php8.2-mongodb \
    php8.2-mysql \
    php8.2-xml \
    && rm -rf /var/lib/apt/lists/* /usr/src/* /root/packages/* \
    && apt-get purge -y --auto-remove

Alongside we have a composer.json file who looks like this :

{
    "require": {
        "php": "8.2.*",
        "ext-gettext": "*",
        "doctrine/cache": "^1.8",
        "doctrine/mongodb-odm": "^2",
        "elasticsearch/elasticsearch": "^7",
        "http-interop/http-factory-guzzle": "^1.0",
        "jsq/amazon-es-php": "^0.3",
        "kreait/firebase-php": "^6.9",
        "monolog/monolog": "^1",
        "php-di/php-di": "^6",
        "slim/slim": "^4.1",
        "symfony/console": "^5.4",
        "symfony/routing": "^2.6.3",
        "twig/twig": "^2.10",
        "zeuxisoo/slim-whoops": "^0.7.0"
    },
}

Database is hosted on MongoDB Atlas.

Connection string looks like this : mongodb://USERNAME@dbmongo-prod-shard-00-00-XXX.mongodb.net:27017,dbmongo-prod-shard-00-01-XXX.mongodb.net:27017,dbmongo-prod-shard-00-02-XXX.mongodb.net:27017/?ssl=true&replicaSet=dbmongo-prod-shard-0&authSource=admin&readPreference=secondary&compressors=snappy

When running with 1.16

  • php -v
PHP 8.2.12 (cli) (built: Oct 27 2023 13:00:10) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.12, Copyright (c) Zend Technologies
    with Zend OPcache v8.2.12, Copyright (c), by Zend Technologies
  • php -i | grep mongo -i
/etc/php/8.2/cli/conf.d/20-mongodb.ini,
mongodb
MongoDB support => enabled
MongoDB extension version => 1.16.2
MongoDB extension stability => stable
libmongoc bundled version => 1.24.3
libmongoc SSL => enabled
libmongoc SSL library => OpenSSL
libmongoc crypto => enabled
libmongoc crypto library => libcrypto
libmongoc crypto system profile => disabled
libmongoc SASL => enabled
libmongoc ICU => disabled
libmongoc compression => enabled
libmongoc compression snappy => enabled
libmongoc compression zlib => enabled
libmongoc compression zstd => enabled
libmongocrypt bundled version => 1.8.1
libmongocrypt crypto => enabled
libmongocrypt crypto library => libcrypto
mongodb.debug => no value => no value
  • composer show mongodb/mongodb : composer is not install in our Docker image, but composer.lock show this
        {
            "name": "mongodb/mongodb",
            "version": "1.15.0",
            "source": {
                "type": "git",
                "url": "https://github.com/mongodb/mongo-php-library.git",
                "reference": "3a681a3b2f2c0ebac227a3b86bb9057d0e6eb8f8"
            },
            "dist": {
                "type": "zip",
                "url": "https://api.github.com/repos/mongodb/mongo-php-library/zipball/3a681a3b2f2c0ebac227a3b86bb9057d0e6eb8f8",
                "reference": "3a681a3b2f2c0ebac227a3b86bb9057d0e6eb8f8",
                "shasum": ""
            },
            "require": {
                "ext-hash": "*",
                "ext-json": "*",
                "ext-mongodb": "^1.15.0",
                "jean85/pretty-package-versions": "^1.2 || ^2.0.1",
                "php": "^7.2 || ^8.0",
                "symfony/polyfill-php80": "^1.19"
            },
            "require-dev": {
                "doctrine/coding-standard": "^9.0",
                "squizlabs/php_codesniffer": "^3.6",
                "symfony/phpunit-bridge": "^5.2",
                "vimeo/psalm": "^4.28"
            },
            "type": "library",
            "extra": {
                "branch-alias": {
                    "dev-master": "1.15.x-dev"
                }
            },
            "autoload": {
                "files": [
                    "src/functions.php"
                ],
                "psr-4": {
                    "MongoDB\\": "src/"
                }
            },
            "notification-url": "https://packagist.org/downloads/",
            "license": [
                "Apache-2.0"
            ],
            "authors": [
                {
                    "name": "Andreas Braun",
                    "email": "andreas.braun@mongodb.com"
                },
                {
                    "name": "Jeremy Mikola",
                    "email": "jmikola@gmail.com"
                }
            ],
            "description": "MongoDB driver library",
            "homepage": "https://jira.mongodb.org/browse/PHPLIB",
            "keywords": [
                "database",
                "driver",
                "mongodb",
                "persistence"
            ],
            "support": {
                "issues": "https://github.com/mongodb/mongo-php-library/issues",
                "source": "https://github.com/mongodb/mongo-php-library/tree/1.15.0"
            },
            "time": "2022-11-23T04:45:35+00:00"
        },

When running with 1.17.0

  • php -v
PHP 8.2.11 (cli) (built: Oct  6 2023 10:18:26) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.11, Copyright (c) Zend Technologies
    with Zend OPcache v8.2.11, Copyright (c), by Zend Technologies
    with Xdebug v3.3.0, Copyright (c) 2002-2023, by Derick Rethans
  • php -i | grep mongo -i
/etc/php/8.2/cli/conf.d/20-mongodb.ini,
mongodb
MongoDB support => enabled
MongoDB extension version => 1.17.0
MongoDB extension stability => stable
libmongoc bundled version => 1.25.1
libmongoc SSL => enabled
libmongoc SSL library => OpenSSL
libmongoc crypto => enabled
libmongoc crypto library => libcrypto
libmongoc crypto system profile => disabled
libmongoc SASL => enabled
libmongoc ICU => disabled
libmongoc compression => enabled
libmongoc compression snappy => enabled
libmongoc compression zlib => enabled
libmongoc compression zstd => enabled
libmongocrypt bundled version => 1.8.2
libmongocrypt crypto => enabled
libmongocrypt crypto library => libcrypto
mongodb.debug => no value => no value
  • composer show mongodb/mongodb : composer is not install in our Docker image, but composer.lock show this
        {
            "name": "mongodb/mongodb",
            "version": "1.17.0",
            "source": {
                "type": "git",
                "url": "https://github.com/mongodb/mongo-php-library.git",
                "reference": "9d9c917cf7ff275ed6bd63c596efeb6e49fd0e53"
            },
            "dist": {
                "type": "zip",
                "url": "https://api.github.com/repos/mongodb/mongo-php-library/zipball/9d9c917cf7ff275ed6bd63c596efeb6e49fd0e53",
                "reference": "9d9c917cf7ff275ed6bd63c596efeb6e49fd0e53",
                "shasum": ""
            },
            "require": {
                "ext-hash": "*",
                "ext-json": "*",
                "ext-mongodb": "^1.17.0",
                "jean85/pretty-package-versions": "^2.0.1",
                "php": "^7.4 || ^8.0",
                "psr/log": "^1.1.4|^2|^3",
                "symfony/polyfill-php80": "^1.27",
                "symfony/polyfill-php81": "^1.27"
            },
            "require-dev": {
                "doctrine/coding-standard": "^12.0",
                "rector/rector": "^0.18",
                "squizlabs/php_codesniffer": "^3.7",
                "symfony/phpunit-bridge": "^5.2",
                "vimeo/psalm": "^5.13"
            },
            "type": "library",
            "extra": {
                "branch-alias": {
                    "dev-master": "1.17.x-dev"
                }
            },
            "autoload": {
                "files": [
                    "src/functions.php"
                ],
                "psr-4": {
                    "MongoDB\\": "src/"
                }
            },
            "notification-url": "https://packagist.org/downloads/",
            "license": [
                "Apache-2.0"
            ],
            "authors": [
                {
                    "name": "Andreas Braun",
                    "email": "andreas.braun@mongodb.com"
                },
                {
                    "name": "Jeremy Mikola",
                    "email": "jmikola@gmail.com"
                },
                {
                    "name": "Jérôme Tamarelle",
                    "email": "jerome.tamarelle@mongodb.com"
                }
            ],
            "description": "MongoDB driver library",
            "homepage": "https://jira.mongodb.org/browse/PHPLIB",
            "keywords": [
                "database",
                "driver",
                "mongodb",
                "persistence"
            ],
            "support": {
                "issues": "https://github.com/mongodb/mongo-php-library/issues",
                "source": "https://github.com/mongodb/mongo-php-library/tree/1.17.0"
            },
            "time": "2023-11-15T09:21:50+00:00"
        },

Expected and Actual Behavior

Capture d’écran, le 2023-12-12 à 17 16 35

additional information

Lately we also tried updating to PHP 8.3 + mongodb extension 1.17.0 but the results are the same : very slow performance.
That's the part on the rightmost of my screenshot, at the right of the red line.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions