gunthercox / DataHub

A fast data feed designed for machine consumption
https://hub.docker.com/r/gunthercox/datahub/
MIT License
9 stars 2 forks source link

Switch from Postgres to MongoDB #7

Closed gunthercox closed 6 years ago

gunthercox commented 6 years ago

There are a number of benefits to switching from Postgres to MongoDB for this project.

  1. No migrations needed :tada:
  2. A significant performance improvement (see details bellow)

Benchmarks recorded the the following statistics for 1000 requests to the API:

Postgres:

Post time: 8.78 seconds Get time: 7.11 seconds Total execution time: 15.89 seconds

Mongo:

Post time: 3.76 seconds Get time: 7.88 seconds Total execution time: 11.64 seconds

Although the get time for MongoDB is a bit longer, retrial of data is much easier to optimize with caching.