spy16 / droplets

Droplets is a platform for Gophers.
MIT License
321 stars 95 forks source link

Embedded database instead of Mongo? #6

Open xeoncross opened 5 years ago

xeoncross commented 5 years ago

Given the simple design of the stores and the goal of helping new developers structure their app; I would consider moving off MongoDB onto BBolt, GoLevelDB, Badger, or one of the many other embedded databases.

There are many helper libraries like Bolthold or Storm which can serve as higher-level access helpers.

I have demo repo with some benchmarks and usage samples here.

spy16 commented 5 years ago

Absolutely right. Initially I did think of using something very lightweight and simple that doesn't require external process (considered both boltdb and sqlite).. but writing SQL queries in case of sqlite or converting data into key-value in case of boltdb seemed like too much work (didn't really dig into wrapper libraries though.) So went with mgo which has a very simple API.

Now that mongo store is already implemented, it would be cool to add store implementations using boltdb or some embedded db and make it configurable I think. That way point of store interfaces might become clearer as well. Thoughts?

skydev2020 commented 5 years ago

I get this error message after running ./bin/droplets

/bin/droplets FATA[0000] failed to connect to mongodb: no reachable servers

Should I install mongodb

spy16 commented 5 years ago

Yes. Mongodb is required to run this.

skydev2020 commented 5 years ago

Although I install mongodb and run "mongod" it still says "./bin/droplets FATA[0000] failed to connect to mongodb: no reachable servers" which file should I take a look at for database settings?

spy16 commented 5 years ago

You can run MONGO_URI=<url> ./bin/droplets (replace <url> with whatever addr mongo is running on. By default this looks at localhost)

xeoncross commented 3 years ago

@89z it depends on your queries. Every database is '100 times slower' for certain workloads. They aren't all designed for the same query paths. Dynamo vs MySQL vs Mongo vs Dgraph vs Redis does not make sense given their radically different architectures.