Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why is it faster than direct communication? #36

Open
applejag opened this issue Aug 2, 2024 · 0 comments
Open

Why is it faster than direct communication? #36

applejag opened this issue Aug 2, 2024 · 0 comments

Comments

@applejag
Copy link

applejag commented Aug 2, 2024

Hello! I was toying around with the pkg/mongoproxy package from this repo, and I was using the mongo plugin to just have my application act as a "middleware" towards the real MongoDB.

As an experiment, I wanted to benchmark it to see what kind of performance impact it has.

I don't know many MongoDB benchmarking tools, so I used https://github.com/johnlpage/POCDriver

git clone https://github.com/johnlpage/POCDriver
cd POCDriver
podman build . -t pocdriver

I then ran it with the following arguments:

podman run --rm -it \
    --network host \
    pocdriver \
    -k 20 -i 10 -u 10 -b 20 -e -d 300 \
    --host 'mongodb://localhost:27017/?retryWrites=false'

The MongoDB I was testing was just:

podman run --rm -it -p 27017:27017 mongo

I ran the test once by letting POCDriver talk directly to MongoDB, and then another time by talking to my Go application that was using the mongoproxy to proxy the requests to MongoDB.

Here's the results:

Operation direct via mongoproxy %
inserts 1,424 20,237 1,561.59%
keyqueries 1,640 6,984 425.85%
updates 2,322 21,209 913.39%

I enabled debug logging to make sure it's working as expected, and also tried creating some new mongoproxy plugins to further analyze that it is working as expected. I'm not 100% sure, but it seems to be.

Any idea of why this is?

I was expecting an overhead, but instead I got a 10x performance boost?

All services were running locally on my machine btw. I also tried running the mongoproxy inside a podman container too to see if that made a difference, but it didn't.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant