-
Notifications
You must be signed in to change notification settings - Fork 279
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
Loading home page seems very slow #5311
Comments
@p0psicles this is part of the reason I was suggesting vuex-persistedstate. I think we should look at caching the shows array and having it update on load but in the background. Since new shows are just shown with a @h3llrais3r would you mind checking the network tab, the rendering of vue isn't the issue it's the network requests, we currently block the whole UI from rendering while we fetch a large resource. I have a feeling if we moved this to a For example try running a new copy of medusa seperate from your main install and look at how quick the pages load without any shows. |
15s is a long time. Lets first analyze what does this. |
@OmgImAlexis, @p0psicles I notice the slow loading on my server installation: @OmgImAlexis, these are the details of the network tab during a refresh of the page: |
That's like 12s only loading the html? There isn't any api call in there right? @OmgImAlexis ? |
I just checked the debug logs, but no logging at the time of requesting the /home path. |
Are you getting the same loading times when you do a hard reload? |
Yes, boh F5 and ctrl + F5 give the same 12s wait time... |
I also have like an initial wait time of 12s. But a hard reload shortens it to about 2.5 |
You know, the thing is. We're still in a transition fase of implementing a new frontend. It's going slow but steady. Currently we're getting the shows when calling the /home index.html. But after that we're also getting all the shows through the apiv2. When everything has moved to apiv2, we can remove the calls in /home index.html. And that loading time will drop significally. I would say, bare with us a little. In the mean time, we could ask @OmgImAlexis and @sharkykh to free up some time for vuefiying /home further. |
No need to rush, I just noticed that it was a lot slower than before and wanted to share it. 😉 |
@h3llrais3r would you mind making these changes? I'd love to see the page loading times after. This SHOULD remove that 12s on the mako file. diff --git a/medusa/server/web/home/handler.py b/medusa/server/web/home/handler.py
index ac5e07436..01b23b4c7 100644
--- a/medusa/server/web/home/handler.py
+++ b/medusa/server/web/home/handler.py
@@ -134,40 +134,40 @@ class Home(WebRoot):
def index(self):
t = PageTemplate(rh=self, filename='home.mako')
- selected_root = int(app.SELECTED_ROOT)
- shows_dir = None
- if selected_root is not None and app.ROOT_DIRS:
- backend_pieces = app.ROOT_DIRS
- backend_dirs = backend_pieces[1:]
- try:
- shows_dir = backend_dirs[selected_root] if selected_root != -1 else None
- except IndexError:
- # If user have a root selected in /home and remove the root folder a IndexError is raised
- shows_dir = None
- app.SELECTED_ROOT = -1
-
- series = []
- if app.ANIME_SPLIT_HOME:
- anime = []
- for show in app.showList:
- if shows_dir and not show._location.startswith(shows_dir):
- continue
- if show.is_anime:
- anime.append(show)
- else:
- series.append(show)
-
- show_lists = [[order, {'Series': series, 'Anime': anime}[order]] for order in app.SHOW_LIST_ORDER]
- else:
- for show in app.showList:
- if shows_dir and not show._location.startswith(shows_dir):
- continue
- series.append(show)
- show_lists = [['Series', series]]
-
- stats = self.show_statistics()
- return t.render(show_lists=show_lists, show_stat=stats[0],
- max_download_count=stats[1], controller='home', action='index')
+ # selected_root = int(app.SELECTED_ROOT)
+ # shows_dir = None
+ # if selected_root is not None and app.ROOT_DIRS:
+ # backend_pieces = app.ROOT_DIRS
+ # backend_dirs = backend_pieces[1:]
+ # try:
+ # shows_dir = backend_dirs[selected_root] if selected_root != -1 else None
+ # except IndexError:
+ # # If user have a root selected in /home and remove the root folder a IndexError is raised
+ # shows_dir = None
+ # app.SELECTED_ROOT = -1
+
+ # series = []
+ # if app.ANIME_SPLIT_HOME:
+ # anime = []
+ # for show in app.showList:
+ # if shows_dir and not show._location.startswith(shows_dir):
+ # continue
+ # if show.is_anime:
+ # anime.append(show)
+ # else:
+ # series.append(show)
+
+ # show_lists = [[order, {'Series': series, 'Anime': anime}[order]] for order in app.SHOW_LIST_ORDER]
+ # else:
+ # for show in app.showList:
+ # if shows_dir and not show._location.startswith(shows_dir):
+ # continue
+ # series.append(show)
+ # show_lists = [['Series', series]]
+
+ # stats = self.show_statistics()
+ return t.render(show_lists=[], show_stat=[],
+ max_download_count=0, controller='home', action='index')
@staticmethod
def show_statistics(): |
@OmgImAlexis Will try this evening (or this weekend) and let you know. |
@OmgImAlexis Running it with your changes results indeed in fast load. |
The more we move away from the mako templates and implement the new UI the faster everything will become. Tnx adressing btw. |
@p0psicles It loads fast, but it doesn't show any shows in the list. So isn't it normal that it loads fast due to the shows not being loaded? |
Its being worked on. Np prob |
@h3llrais3r thank you for that. Yes that's expected as you commented out the whole section that's rendered there. That's why it's empty but it does confirm that if we can remove the mako file it'll be quicker than before. I'm working on a Vueifying the homepage right now but I can't promise anything. Is there a layout you'd want me to do first? I'm more than happy to do one layout at a time so at least people with lots of shows can use it without lag. |
@h3llrais3r would you mind checking out the vueify-home branch and just try the banner layout. It should load quite a bit faster but there are a few columns still unfinished. |
@OmgImAlexis Thanks for that. I'm using the simple table layout. |
Just switch to banner layout and check the loading times. It should load almost instantly. |
@OmgImAlexis Both simple and banner layout are loading fast in the branch, but I think that's normal since I don't have a lot of shows on my dev setup... Left: loading with 3 shows on simple layout |
@h3llrais3r would you mind loading your production database in a test install and trying again? I'd like to see if it fixes it with all your shows or if the speed up is really only going to stay with small libraries. |
I'll see what I can do this week (I don't have the time today, but hopefully somewhere this week). I'll keep you posted. |
@h3llrais3r no worries. The simple layout should also now be working on that branch. I know the XEM and next/prev date columns are still broken, working on that. |
@OmgImAlexis Performance is a bit better, but still a lot of time needed for /home (in banner mode on vueify-home branch) Perhaps a stupid remark: I don't see any changes yet in the branch in the handler.py for the /home path.... so isn't it logic that it's still slow because the delay was coming from here? |
@OmgImAlexis, @p0psicles Code changes: Log output:
Performance & network: As you can see, the almost 20s needed to get the |
@h3llrais3r try the newest commit on that branch. |
@OmgImAlexis It's still the |
Yay. 🎉
That's to be expected at least for now. The UI SHOULD load while that happening though as we don't actually wait for the call to finish, we just dispatch it and the layout will update after the stats are pulled in. |
Indeed the layout updates after the stats... but that takes 20s 😉 |
What omg is saying, is that the page is already usable before it loads the stats. Previously that was not the case. Or you only load the page for the stats? |
Ooh thats not good. I think we can fix that. |
That's not an issue, I expected that. Already fixed more or less locally. |
This comment has been minimized.
This comment has been minimized.
@OmgImAlexis can you share your branch where you 'more or less' fixed this? We could continue from there. |
This comment has been minimized.
This comment has been minimized.
I was writing the comment below, and as I was gathering the numbers, I realized they didn't add up: I'll just put this here, as I think it's relevant:
Adding to that - an explanation:Python generates (using Mako) the complete show list, ALL the shows in the database, into one HTML document and serves that up to the client. Taking the banner layout as an example, I simple calculation: So as quoted above, I tested the home page with a show list of |
Just an observation - with ~50 shows now, there is still not much of a difference in load time (still ~10 sec on old C2D). Maybe with a larger number there is . One other thing - there is home.mako under ...\dark and ...\light (in 0.29) . Shouldn't those be modified too (I did modify them for testing..) ? |
For one, 10 seconds is half of the 20 you showed on the video from #6740. And second, this isn't a permanent solution to the problem.
Not sure what you're seeing, because I did change them in my PR. P.S. |
Right, my mistake, I've missed "dark/light" in your PR.
You've missed my update: Agreed, 10 years old PC is old, but good enough to compare before and after (even easier...) . Rafi |
Oh, oops. Sorry. For me it's around 1.5-2 seconds. But my processor is an i7-8700K. |
So, on my i7 laptop as client over LAN (also "old" 2720QM @2.2GHz) , it is ~3 second before and after. Did you see significant improvement in time with 500 shows? I think the show page is even more problematic, especially with series like The Simpsons... |
PS: |
Yes.
It is as problematic. The severity really depends on the show in question.
Because those 20 were actually 40 shows, as I explained above. |
This discussion is 1 year old, much has changed since then. Please open a new discussion if needed. |
Describe the bug
I can be wrong, but since the application becomes more and more vueified, I have the impression that page loading is becoming slower.
For example: loading my home page takes more than 15s while in the past this was a lot faster.
Is this normal?
If you need more info/logs, please let me know and I'll provide it.
Screenshots
Medusa (please complete the following information):
The text was updated successfully, but these errors were encountered: