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

High load on Emby Server during sync with Ombi #2230

Closed
Jdiesel87 opened this issue May 7, 2018 · 13 comments
Closed

High load on Emby Server during sync with Ombi #2230

Jdiesel87 opened this issue May 7, 2018 · 13 comments

Comments

@Jdiesel87
Copy link

Ombi build Version:

V 3.0.3295

Update Branch:

Open Beta

Media Sever:

Emby

Media Server Version:

3.4.0.4

Operating System:

Ubuntu 16.04

Ombi Applicable Logs (from /logs/ directory or the Admin page):


(Logs go here. Don't remove the ' tags for showing your logs correctly. Please make sure you remove any personal information from the logs)

Problem Description:

Ombi hammers Emby with requests during the scheduled sync causing Emby to become unresponsive at time. Can something be done to reduce the load on Emby durning the sync? @LukePulverenti mentioned he is willing to help with solution to the current way of syncing with Emby.

Reproduction Steps:

Navigate Emby webui when a sync is in progress. Webui is slow and sometimes unresponsive. View Emby log file to see request from Ombi.

@tidusjar
Copy link
Member

tidusjar commented May 7, 2018

Ok interesting.

The way we sync with Emby hasn't changed since I did it really. I'll update this with the steps we do later and maybe Luke can let me know if there is a better way to interact with Emby

@LukePulverenti
Copy link

What I would suggest is getting lists of items from folders rather than pulling down items individually. Not only will this reduce the number of round trips, but the list endpoints return a smaller set of information by default, and you have to opt-in to additional information by specifying the fields that you want. So not only can you reduce the number of requests but you can also reduce the amount of data that has to be pulled.

Second, and I don't know too much about the Ombi syncing process, but if at all possible I would let users configure when the sync takes place so that they can set it up for off hours, like in the middle of the night for example.

@tidusjar
Copy link
Member

tidusjar commented May 7, 2018

Hey @LukePulverenti Thanks for the input.

Do you have any further information on the actual API's you are referring to?

Ombi allows the user to customize the sync.

@LukePulverenti
Copy link

Well how are you getting all of the item Id's in the first place? I would imagine you're getting them from querying folders, right?

@tidusjar
Copy link
Member

Sorry for the late reply, this is the process @LukePulverenti :

  • Get all the movies
    • emby/users/{userId}/items?Recursive=true&IncludeItemTypes=Movie
  • Foreach movie check if the type is a boxset
    • If it is then Get the collection: emby/users/{userId}/items?parentId={mediaId}
    • foreach of the items returneds above get the Movie Information: emby/users/{userId}/items/{mediaId}

Then

  • Get all shows
    • emby/users/{userId}/items?Recursive=true&IncludeItemTypes=Series
  • Get all the series information from the above emby/users/{userId}/items/{mediaId}

Once those processes are complete we then move onto episodes

  • Get all episodes
    • emby/users/{userId}/items?Recursive=true&IncludeItemTypes=Episode
    • If it's LocationType is Virtual then skip it
  • Get the ep info from the above: emby/users/{userId}/items/{mediaId}

If there are any improvements that you suggest i'd be happy to make changes

@anojht
Copy link
Contributor

anojht commented May 23, 2018

ping @LukePulverenti

@LukePulverenti
Copy link

Ok let's start with movies. Your initial query is fine:
emby/users/{userId}/items?Recursive=true&IncludeItemTypes=Movie

If it is then Get the collection: emby/users/{userId}/items?parentId={mediaId}

This will never happen. Instead, to get a user's boxsets, you can do this:
emby/users/{userId}/items?Recursive=true&IncludeItemTypes=BoxSet

foreach of the items returneds above get the Movie Information: emby/users/{userId}/items/{mediaId}

This is the part that you don't need, because you already have it when you query for the list of movies. You can use the Fields param to control what fields you get back.

Can you tell me what movie information you're using, and then I'll give you a sample query. Thanks.

@LukePulverenti
Copy link

As far as the list of shows, same comment & question as above. Thanks !

@LukePulverenti
Copy link

Episodes will also be the same, however you can avoid having to post-filter client-side by doing this:
emby/users/{userId}/items?Recursive=true&IncludeItemTypes=Episode&IsVirtualItem=false

@tidusjar
Copy link
Member

Thanks for that information!

So the information I am after for Movies is:
ProviderIds (ImdbId, Tmdb),
That's why I call the movie individually

Same for TV and episodes but Tvdb aswell as the others.

@LukePulverenti
Copy link

So then for all of those queries just add &Fields=ProviderIds. If you need the Overview then it would be &Fields=ProviderIds,Overview

You can then get everything from those list queries without having to pull down items individually.

@tidusjar
Copy link
Member

Awesome! That should improve things!

I'll get this done asap. Thanks for the help.

tidusjar pushed a commit that referenced this issue Jun 27, 2018
@tidusjar
Copy link
Member

Improvements made in the develop branch

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