Giter VIP home page Giter VIP logo

mongoproxy's Introduction

mongoproxy

Mongoproxy is a plugin framework around the mongo wire protocol. This effectively enables arbitrary features to be added into the mongo request flow (e.g. introspection/modification).

mongoproxy's People

Contributors

yinwang-wish avatar yiguo-wish avatar jacksontj avatar

Stargazers

kalle (jag) avatar  avatar  avatar Hao avatar  avatar  avatar Endong Zhu avatar Y Guo avatar

Watchers

 avatar

mongoproxy's Issues

Change authz killCursor behavior

The current killCursor implementation simply maps to a global delete permission. This was "accurate" based on old mongo behavior (<4.2) -- but in later versions users are always allowed to killCursor on cursors they created. So to do this we simply need to change the plugin to check the cursor cache (assocatied with the connection) and if the cursor they are killing is in there -- it doesn't need permissions. Then if the cursorId is not in the cache -- then we should check the same global delete permission.

Why is it faster than direct communication?

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.