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
Multi-database support #42
Comments
What do you see as the benefit? |
The ability to use it as a shared data repository for multiple servers. This would allow us to load balance. |
100% on board with this. |
@NumberedThought Fair enough. But it would take more than just a network-database to properly support load balancing. You wouldn't want somebody deleting something on jellyfin server 1 while somebody else was viewing on jellyfin server 2 for example, so some locking would need to be put into place. But that said, mysql/mariadb should be an option only. Sqlite should be perfectly fine (and preferable) for simpler installations that don't need the overhead of managing mysql/mariadb. |
I run a mariadb cluster at home and it would allow me & everyone else to keep all settings/libraries, etc in case of a failure and have to reinstall. The DB would never have to be rebuilt with all the shows/movies, etc. It really is a no brainer todo this. Emby 3.5 was slow as hell with sqlite and even with the current updates, it is still slow. Add mysql/maria and watch the speed increase. Not sure on others., but my sqlite db is over 700MB (has been trimmed, etc), sqlite can handle this, but it gets slow, so why not use a real database. Even sqlite recommends a RDBMS when doing client/server. https://www.sqlite.org/whentouse.html Also as others have said, load balancing, shared resources/data by doing it this way. |
Exactly what is needed. I understand some/maybe a lot won't want to do it, but I am sure that there are several others that will want it. This topic has been posted many & requested many times on the Emby forums. |
@drakus72 Yup, the sqlite DB is slow as hell with my massive media collection. After the LDAP fiasco I never bothered asking for this in the upstream, but we can definitely start to work on it. I think we should support all the big RDBMS's: MariaDB, MySQL, PostgreSQL, and SQLite, using a featureful connector. |
There is other software that will install the database right along with it. One such software that I use is SAM Broadcaster, it installs firebird with it as default as long as you don't select it, it will setup one of the other options like mysql/postgres/MSSQL during setup. |
Yes I'd much rather use a 3rd party connector library, saves us the work of having to support every little bug in the various RDBMSes. |
My only concern is requiring people who want to use a simple (i.e. single instance for a household perhaps) instance is the added complexity of having to install and configure the RDBMS when the simplicity of sqlite is sufficient. |
@brianjmurrell agreed, we should keep sqlite as the default, and simply allow the option to use a more complex RDBMS for those who want to. |
EntityFramework Core is well-supported and pretty database agnostic, it already has providers for SQLite, Postgres, MariaDB, etc. |
The SQLite backend for EFCore is maintained by Microsoft it seems: https://docs.microsoft.com/en-us/ef/core/providers/sqlite/ So that is nice. |
Oh good someone already submitted this, I would LOVE to be able to use MySQL/MariaDB as the back end as well. Most people already covered reasons above. |
This would be a huge benefid. Most of the people wanting this feature already have those running and just need something a little more flexible/performant... Going straight Cassandra Scylla would be over doing it imho. |
Completely agree with this request. It would be great to be able to scale with microservices. |
This sounds really nice and something that i would use heavily. My use-case for this functionality is to load balance / distribute trans-code load across many hosts. by distributed transcode, i mean if i had more than one simultaneous stream, each stream could be transcoded on different instances improving performance. In this case a "non ha" db would be fine (i.e single instance postgres) that both instances could consume, while providing the aforementioned distributed transcode, perhaps across two smaller (less powerful) nodes like say Rpi or in a container environment (kubernetes / swarm) |
@MrBones757 This doesn't sound like a problem that multiple databases is needed to solve. A single database could easily be used and allow distributed transcoding. I would suggest your request is a new ticket for distributed transcoding. |
@MrBones757 you can also look into rffmpeg for now which will kind of meet your criteria. |
Just an opinion: Newsflash: I don't have time nor interest to keep track of all the projects I support individually. That was the nice "magic" of github: Having everything in one place. |
That is fair, but having feature requests as part of Issues was a burden to us. |
Another posible improvement, seeing no more: [2022-05-04 15:51:53.220 +00:00] [DBG] [20] Emby.Server.Implementations.Data.SqliteItemRepository: "GetItemList" query time (slow): 470.8834ms. on a listing. Better indexes, full text search capabilities, etc... |
The first and the main benefit is the SPEED. I'm using jellyfin about a week (minidlna before) and after some basic tuning first thing that i had search is to change database server. And... nothing. I understand everything, but please, dont forget about this future request. PS: my server has 40 cores 2.5GGhz and sata 6Gb/s drives and 64Gb DDR3 memory. Also system has SSD drive for system files (by default your SQLite DB placed there). |
@g0dless Isn't this that the problem that sharding solves? Sharding should be done in the database client/server backend, not by every app that wants to benefit from load sharing across databases. IOW, every app should not have to re-invent that wheel. It should have a consistent (i.e. SQL) API to the database and the database handles the details of balancing load horizontally. |
If Jellyfin supported PostgreSQL then you could replicate DB (across many servers) and shard it aswell (all handled by PostgreSQL itself, that's the point of RDBMS), the issue is currently Jellyfin doesn't have any support. |
Would it be feasible to split away all calls that would normally go to Sqlite to a dummy library whose only purpose is to guarantee the contracts of a database, then copy/paste the existing sqlite-calling code into the dummy library? It seems like it could be a waste of time on the surface, but unless some kind of code-splitting like this happens, it'll be impossible for the community to work in parallel and build database backends for Jellyfin. Moreover, I think this kind of approach makes it possible to enable dynamic linking across FFI boundaries (in the long run) as an implementation option — without ever having to fully stop using sqlite as the out-of-the-box DB provider. |
SQLLite inherently lacks robustness. See list of potential causes of corruption: With Jellyfin on Docker, this amounts so far to three instances of database corruption for me on a BTRFS bind mount and in less than ten days. I believe there are a number of issues open right now with similar requests, to help with a wide range of scenarios:
https://features.jellyfin.org/posts/315/mysql-server-back-end Someone suggested that the plan at some point was to integrate with a back-end-agnostic framework such as EF. I think that a lot of people will find this critical. |
Would love to see postgresql as an available backend, it handles faults gracefully, is just comically fast comparably (especially with the right filesystem under it), and backups are so easy it feels like cheating. |
This comment was marked as spam.
This comment was marked as spam.
On top of that, the horizontal scaling of postgresql is just decades ahead of stuff like MariaDB. |
That having been said, I verified the issue I was experiencing, and it
doesn't seem due to sqllite corruption. Rather, it appears to be a bug
where jellyfin databases when it runs in a container (with ext4 as the
underlying filesystem) don't resist a reboot.
They may still show movies for a time, but those can't be streamed. It's as
if filesystem references had become inaccessible.
…On Sun, 20 Nov 2022 at 18:23, Kjeld Schouten-Lebbing < ***@***.***> wrote:
Would love to see postgresql as an available backend, it handles faults
gracefully, is just comically fast comparably (especially with the right
filesystem under it), and backups are so easy it feels like cheating.
On top of that, the horizontal scaling of postgresql is just decades ahead
of stuff like MariaDB.
—
Reply to this email directly, view it on GitHub
<#42 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAFZ7NGN3N62SM3H37SSMKLWJH3Z3ANCNFSM4GJWFUKQ>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
I fully agree. While I don't necessarily see the need for replication and clusters for a movie database, SQLite simply does not scale when talking about tens of thousands of entries. It performs well in some places, for example it is very fast when inserting, as it foregoes lots of overhead. However, the query planner is lacking when a database grows beyond a few hundred MBs. The general direction should be EF. The only real reasons for not using it would be if loads of views and stored procedures are used - the latter which SQLite doesn't even offer. In all other cases, EF creating reasonably good SQL directly from LINQ is more than enough reason for using it. It'd also mean that plugging in a different database backend would be trivial. |
Wouldn't it be easier to switch to something like this to achieve replication? https://github.com/rqlite/rqlite |
The point isn't "just" replication. Actually replication is a minor note in the whole thing. |
Is there any place where we can see the progress of external DB support, other than git commits? |
I am sure the devs would post an update on this issue here, so you are already subscribed to the best place to get updates! And also here https://features.jellyfin.org/posts/315/mysql-server-back-end |
This issue was closed over a year ago so it's unlikely that status updates will be provided here. Work is ongoing to migrate the database over to Entity Framework and when that's finished support for other database engines will be possible. |
@nielsvanvelzen this is great news. Seemingly not related, but the frequent corruption I have noted with docker (anytime my physical server is restarted) is potentially related to a file system issue. Something to do with file systems not being mounted when Jellyfin starts; I am investigating this. Though not directly related to the database system in use, it appears to bear some kind of relation to database sync/maintenance logic: as if Jellyfin decided that the references are obsolete and discarded them during some routine task. I don't like to cross post, but there is a link. It could simply be worth documenting (if Docker indeed accepts to start with an invalid mount). |
Possibility to add mysql/mariadb to replace or as an option to use instead of sqlite?
The text was updated successfully, but these errors were encountered: