Performance degradation in docker when limit the resource with --cpus

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Done
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • ALL
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      I deployed a mongodb with docker for testing, with following cmd

      docker run --rm --name mongodb -p 27017:27017 -v /mnt/mongo/data:/data/db -m 2g --cpus=2 -d mongo:latest
      

      The host VM is a Ubuntu18.04, with 4 cores and 16G mem.

      The testing works as following:

      Insert 2,000,000 documents into mongodb with python.

      the document is like following:

      {
          event_time: '2021-06-02T11:40:26',
          src_addr: '192.168.75.190',
          src_port: 58612,
          dst_addr: '161.125.178.34',
          dst_port: 786,
          url: 'http://www.orozco.net/',
          mime_type: 'text/css',
          md5: '6aa1af2ba586a0dfae3f880e155f9fdb',
          file_name: 'apply.jpeg',
          server_token: 'Varnish',
          user_agent: 'Mozilla/5.0 (compatible; MSIE 8.0; Windows 98; Trident/4.1)'
      }
      

      Index were set on: event_time, src_addr, src_port, dst_addr, dst_port and file_name.

      The performance is extremely slow: about 200/s.

      I adjust the host VM to 2 cores and 16G mem, and redo the testing, the interesting thing happened. The inserting performance became about 15000/s.

      I think the key point is the core number of the host VM and the index.

      When I remove the index, the performance is about 25000/s even the limited core number is less than the host VM's core.

      When the index is setup, the performance became very slow when the limited core number is not equal to the host VM's.

      Thanks!

      Fred

            Assignee:
            Edwin Zhou
            Reporter:
            fred chen
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: