3

I am currently performing some benchmarks on my application using Vert.x and I am trying to compare results when I use the mongo java sync or async driver.

And to my surprise, the results seems to be far better with the sync driver, because it uses really few mongodb connections compared to the async one. As a consequence, the mongo requests are slower and mongo always finished by crashing with async driver.

Is this normal that the async driver open so many connections compared to the sync one ? If yes, do we need to install mongo as a replica set to better scale with async driver ?

For example, here are results of test with wrk with 200 connections in 30 seconds with 16 threads.

With Sync driver:

~ • wrk -t16 -c200 -d30s http://localhost:8080/f0e7a0f5/status
    Running 30s test @ http://localhost:8080/f0e7a0f5/status
    16 threads and 200 connections
    Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency   131.90ms   42.75ms 567.64ms   78.19%
    Req/Sec    92.61     21.28   171.00     66.36%
    43997 requests in 30.10s, 3.23MB read
    Socket errors: connect 0, read 55, write 0, timeout 0
    Requests/sec:   1461.89
    Transfer/sec:    109.93KB

With Async driver (mongodb crashes) :

~ • wrk -t16 -c200 -d30s http://localhost:8080/f0e7a0f5/status
    Running 30s test @ http://localhost:8080/f0e7a0f5/status
    16 threads and 200 connections
    Thread Stats   Avg      Stdev     Max   +/- Stdev
     Latency   424.87ms  205.89ms   1.38s    73.84%
     Req/Sec    31.68     20.04   118.00     64.01%
    13597 requests in 30.11s, 1.00MB read
    Socket errors: connect 0, read 31, write 0, timeout 0
    Requests/sec:    451.65
    Transfer/sec:     33.96KB
  • MongoDB 3.2.7 WiredTiger
  • Mongo Java Driver 3.2.2
  • Vertx 3.3.1
  • Mac OS X El Capitan 2.5 Ghz I7 16 Go RAM

UPDATE 1 : I solved the mongodb crash problem on my local machine by configuring files and process limits : https://unix.stackexchange.com/questions/108174/how-to-persist-ulimit-settings-in-osx-mavericks However, I still have many opened connections with the async driver, which slow my application.

UPDATE 2 : Here is some code with the async driver. The verticle : http://pastebin.com/SygKuDhg

The config :

"mongo-platform" : {
        "pool_name": "mongo-platform",
        "host": "localhost",
        "port": 27017,
        "db_name": "mongo_platform",
        "maxPoolSize": 250,
        "minPoolSize": 20,
        "useObjectId": true
    }

UPDATE 3: And here is the code for the sync driver

http://pastebin.com/FJ7JeSPU

I use Jongo as a wrapper of the java sync driver and vertx-hk2 for dependency injection into my REST verticle.

Community
  • 1
  • 1
rico
  • 1,843
  • 2
  • 24
  • 41
  • In order to make a fair judgment of the benchmark you should show its code. I believe that the async driver is making more connections since it does not impose a limit (back pressure). If the async driver supports pipelining it could probably be reused and solve your crash. – Paulo Lopes Jul 12 '16 at 11:11
  • I have updated my question. I solved the mongodb crash problem but I still have the many open connections problem. – rico Jul 12 '16 at 11:58
  • @PauloLopes Question updated with code. – rico Jul 12 '16 at 12:15
  • 1
    could you also share the sync code? I've asked on the Vert.x forum https://groups.google.com/forum/#!topic/vertx-dev/K5sgT_tfaYc if someone can help you out but i think we need both tests to investigate what is going on first. – Paulo Lopes Jul 13 '16 at 12:19
  • @PauloLopes Sync code added. Thanks for the topic creation on vertx forum. – rico Jul 13 '16 at 19:55
  • 1
    https://github.com/vert-x3/vertx-mongo-client/issues/85 – Martijn Verburg Jul 14 '16 at 19:00
  • Did you ever solve the open connections issue? – judepereira Sep 07 '16 at 10:44
  • @judepereira I am still waiting for the performance testing results from vertx-mongo-client team. – rico Sep 25 '16 at 10:03
  • Ever find out why so many more connections were opened by the async driver? – Scott Rice Mar 04 '21 at 19:38

0 Answers0