Håvard Geithus
Håvard Geithus

Reputation: 5613

Spring Data + MongoDB somehow extremely slow after upgrade to macOS Sierra

After upgrading to macOS Sierra, the communication between Spring Data and MongoDB is somehow extremely slow, basically not usable.

Concretely, a collection of interactions with the database which previously took ~100 ms, now takes ~10 minutes.

I'm using the most recent stable versions of the driver and spring data:

MongoDB Java Driver

<dependency>
    <groupId>org.mongodb</groupId>
    <artifactId>mongodb-driver</artifactId>
    <version>3.3.0</version>
</dependency>

Spring Data MongoDB

<dependency>
    <groupId>org.springframework.data</groupId>
    <artifactId>spring-data-mongodb</artifactId>
    <version>1.9.3.RELEASE</version>
</dependency>

Furthermore, I have installed MongoDB using Homebrew.

mongod --version:

db version v3.2.9
git version: 22ec9e93b40c85fc7cae7d56e7d6a02fd811088c
OpenSSL version: OpenSSL 1.0.2h  3 May 2016
allocator: system
modules: none
build environment:
    distarch: x86_64
    target_arch: x86_64

I am not really sure how to resolve this issue. Let me know if you think I should post this elsewhere, and I will.

Thanks.

Update 1: Problem of slowness is still there, after trying to run mongodb in a docker container instead of running it on macOS Sierra.

Update 2: Ended up downgrading to El Capitan.

Upvotes: 6

Views: 1476

Answers (2)

Jeff Sheets
Jeff Sheets

Reputation: 1209

Probably related to https://stackoverflow.com/a/39698914/1469525 with the answer being a modification to the /etc/hosts file for localhost

Upvotes: 4

Mike Thomsen
Mike Thomsen

Reputation: 37506

It is probably a performance problem related to Docker and macOS Sierra, not Mongo. What you can do to try to debug this is install Vagrant and bring up your environment inside of an Ubuntu VM and see what the performance characteristics are like on a similar platform. You can also set up a VM with VirtualBox or VMWare Fusion that runs an older version of macOS. Since Docker is more stable on Linux than OS X, the Vagrant route is probably your best bet to figure out just how serious the problem is.

Upvotes: 0

Related Questions