Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-21928

Mongos uses too much memory

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.0.4, 3.0.7
    • Component/s: Sharding
    • None
    • Environment:
      Description: Ubuntu 14.04.2 LTS
      Release: 14.04
      Codename: trusty
    • Linux

      On one of our hosts the mongos process uses a lot memory until the OOM kills it.
      This host is used to call php scripts (cron based) which talk to this mongos router. So we think it's related to our php scripts (php driver?), since other mongos don't have this issue.
      Memory is increasing over time, but it's not easy to say when.

      Our Cluster uses mongodb version 3.0.4. We have 25 shards.
      Here are some system insights:

      $ uname -a
      Linux hostname.domain.net 3.13.0-49-generic #83-Ubuntu SMP Fri Apr 10 20:11:33 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
      
      $ free -m
                   total       used       free     shared    buffers     cached
      Mem:         64321      44405      19915         55        701      10353
      -/+ buffers/cache:      33350      30970
      Swap:          975        975          0
      
      $ mongostat --port 27017
      insert query update delete getmore command flushes mapped vsize   res faults qr|qw ar|aw netIn netOut conn set repl     time
          *0    *0     *0     *0       0     2|0       0        24.5G 21.1G      0   0|0   0|0  133b     6k    5      RTR 12:52:52
          *0    *0     *0     *0       0     1|0       0        24.5G 21.1G      0   0|0   0|0   79b     6k    5      RTR 12:52:53
          *0    *0     *0     *0       0     1|0       0        24.5G 21.1G      0   0|0   0|0   79b     6k    5      RTR 12:52:54
          *0    *0     *0     *0       0     2|0       0        24.5G 21.1G      0   0|0   0|0  137b     7k    5      RTR 12:52:55
          *0    *0     *0     *0       0     2|0       0        24.5G 21.1G      0   0|0   0|0  133b     6k    5      RTR 12:52:56
      
      $ mongos --version
      MongoS version 3.0.4 starting: pid=100831 port=27017 64-bit host=hostname.domain.net (--help for usage)
      git version: 0481c958daeb2969800511e7475dc66986fa9ed5
      OpenSSL version: OpenSSL 1.0.1f 6 Jan 2014
      build sys info: Linux ip-10-45-73-23 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:11:08 UTC 2014 x86_64 BOOST_LIB_VERSION=1_49
      
      $ ps auxw |grep -v grep |grep mongos
      mongodb  133123 12.4 33.5 25685928 22088344 ?   Sl   Dec11 1089:22 /usr/bin/mongos --config /etc/mongodb/mongodb-router-27017.conf --logpath /var/log/mongodb/mongodb-router-27017.log
      
      $ php -v
      PHP 5.6.16-2+deb.sury.org~trusty+1 (cli)
      Copyright (c) 1997-2015 The PHP Group
      Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies
          with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2015, by Zend Technologies
      
      $ pecl list
      Installed packages, channel pecl.php.net:
      =========================================
      Package  Version State
      apcu     4.0.8   stable
      imagick  3.1.2   stable
      mogilefs 0.9.2   beta
      mongo    1.6.9   stable
      msgpack  0.5.6   beta
      stats    1.0.3   stable
      uuid     1.0.3   stable
      xhprof   0.9.4   beta
      

      At this point after 6 days running it uses 22GB of memory with 5 active connections.

      We also tested version 3.0.7 of mongos on this host with same result.

      We think this is a bug in the mongos, that it doesn't clean up memory.

            Assignee:
            Unassigned Unassigned
            Reporter:
            steffen Steffen
            Votes:
            4 Vote for this issue
            Watchers:
            12 Start watching this issue

              Created:
              Updated:
              Resolved: