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

Add database abstraction to avoid hard dependency #9

Closed
Quix0r opened this issue Sep 12, 2016 · 11 comments
Closed

Add database abstraction to avoid hard dependency #9

Quix0r opened this issue Sep 12, 2016 · 11 comments

Comments

@Quix0r
Copy link

Quix0r commented Sep 12, 2016

I would love to see some database-abstraction being added so PeerTube can not just run with MongoDB but with any database (even SQLite).

@Chocobozzz
Copy link
Owner

It would be interesting but the maintenance would require big efforts. I don't think it is very useful for now.

@ldidry
Copy link
Collaborator

ldidry commented Nov 9, 2016

As you say "All pods have an index of all videos of the network", I think MongoDB is a terrible choice.

  • the DB files don't shrink when records are removed (you can shrink them, but it needs stopping Peertube)
  • more videos means more time to start the database. At Framasoft, we used MongoDB for our Etherpad instances and some took 10 minutes to start because of MongoDB (now, with PostgreSQL, it takes one minute max)

It may be a good thing to consider PostgreSQL: it can do NoSQL too, and better than MongoDB. Have a look at http://www.aptuz.com/blog/is-postgres-nosql-database-better-than-mongodb/ 😄

@Chocobozzz
Copy link
Owner

Thanks @ldidry to share your experience. I'll study this more deeply :)

@faddat
Copy link
Contributor

faddat commented Dec 9, 2016

If we are sharing-- I love redis?

Well, redis, or we just scrap node.js for the back end altogether and do it in go. There are webtorrent goodies for go, so might be able to implement in go using storm/boltdb. In the end this means you distribute a single executable that includes the database, and it will go fast.

@ldidry
Copy link
Collaborator

ldidry commented Dec 9, 2016

Well, having the database outside the executable allows you to run it on a different server, which is a good thing when you're beginning to scale. One server for backend (and videos for our case), with a large disk space, and a server with fast disks for the database is a pretty common thing.

My 2 cts.

@Chocobozzz
Copy link
Owner

I'm still benchmarking different DBMS but it seems that PostgreSQL offers better performances than MongoDB or MySQL (with 1 000 000 videos, 3 000 000 tags). And this is a relational DBMS which will simplify things in the future (for playlists etc).
Moreover there are very interesting feature like the Trigram module for the video search for example.

I agree @ldidry and I don't really stay with a NoSQL database. I chose MongoDB because I thought SQL DBMS were not effective enough with big tables but I was wrong (with PostgreSQL at least). And NoSQL databases will make things difficult for PeerTube.

I need to make some other tests but I think I'll switch to PostgreSQL soon. Of course, I'm open to discussions :)

@faddat
Copy link
Contributor

faddat commented Dec 9, 2016 via email

@Chocobozzz Chocobozzz changed the title Add database abstraction to avoid hard dependency (MongoDB is not everywhere installed) Add database abstraction to avoid hard dependency Jan 13, 2017
@Chocobozzz
Copy link
Owner

PostgreSQL is now on master/develop branches. I keep this issue opened since PeerTube only support PostgreSQL for now.

The ORM is sequelize which supports PostgreSQL, MySQL, SQLite and MSSQL so we will be able to add other DBMS in the future.

@Quix0r
Copy link
Author

Quix0r commented Jan 16, 2017

Looks promising. :-) And nice work.

@Chocobozzz
Copy link
Owner

After some consideration, I don't think it's a good idea to support other databases than PostgreSQL. It requires a lot of effort and complicates maintenance. We can see such issues in Diaspora that supports PostgreSQL and MySQL (performance problems with some queries between these DMBS for example).

@ldidry
Copy link
Collaborator

ldidry commented Oct 16, 2017

And it adds a problem: if server A has Pg and is a big instance but server B has SQLite or MySQL, the server B will have poor performances.

So, avoiding other databases will improve performances consistency.

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

No branches or pull requests

4 participants