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

[Bug Report] Slow scan with large libraries on Hyper-V Docker (Windows) #79

Closed
VegethB opened this issue Jun 22, 2020 · 15 comments · Fixed by #232
Closed

[Bug Report] Slow scan with large libraries on Hyper-V Docker (Windows) #79

VegethB opened this issue Jun 22, 2020 · 15 comments · Fixed by #232
Labels
bug Something isn't working

Comments

@VegethB
Copy link

VegethB commented Jun 22, 2020

Describe the bug
With a library of 35,000 files (35 series ... LOL) when the rescan starts it takes 9 to 20 30 minutes before you can do anything (even access the site itself). Practically it seems that every time there is to scan the library until the website finishes, it doesn't give any signs of response ... in fact, give connection errors.

To Reproduce
Steps to reproduce the behavior:
Create a large serial zip library.
Load it and see that after the first scan the second and subsequent ones block everything.
The library just download with MangaDownloader from the supported sites with setting to create CBZ in .zip with 9 compression and maximum quality (http://redsquirrel87.altervista.org/doku.php).

Expected behavior
Don't get stuck for 20 minutes :)

Environment (please complete the following information):

  • OS: Windows Server 2019 (latest)
  • Browser chrome, edge
  • Mango Version 0.7.1

Docker

  • The docker-compose.yml file:

version: '3'

services:
mango:
image: hkalexling/mango
container_name: mango
expose:
- 25570
ports:
- 25570:25570
volumes:
- ./library:/root/mango/library
- ./config:/root/.config/mango
- ./Data:/root/mango

Additional context
image

Configuration errors are due because I was wrong to update the conf.

Clean installation of 0.7.1 from docker with docker-compose. 2GB ram 1gb Swap 1CPU (standard config of docker VM).
Server 16gb RAM, 2 CPU Xeon L5630.
There are certainly enchanaments as a translation of "entry" for everything with Chapters, Volumes / Issues and features to tell him that the Extra folders are not volumes but only extras (like 2 versions of the chapter in 2 different languages ​​or extra chapters which, however, are not are part of the official volumes). Or a writing of the total chapters on the main page of the open series and the possibility of adding a plot and year but they are all things that come after XD. Sorry for my english.

@VegethB VegethB added the bug Something isn't working label Jun 22, 2020
@hkalexling
Copy link
Member

Wow, I have never tested it with such a huge library. I will try to fill my library with dummy cbz files and find the performance bottleneck. Thanks for the report 👍

@cglatot
Copy link

cglatot commented Jun 23, 2020

@hkalexling - I'm not sure if this is related, but my Home page takes quite a while to load up, yet the Library page doesn't.
Load time for Library page = ~1,200ms
Load time for Home page = ~12,000ms

I only have 11 series (total of 1100 entries) and both pages show the whole amount, so not sure why the Home page is taking 10x longer to load.

Here's a screen of the breakdown for the single longest load item.
image

Let me know if you want to open a separate issue for this. Considering they're both load time related, thought it would be worth dropping here as well just in case. Can provide more info either way as well, just let me know if you'd rather it here or it's own thread.

@VegethB
Copy link
Author

VegethB commented Jun 23, 2020

I had not noticed this detail, actually it took me minutes to load the home (after the server has started and the scan interval is set to 30 days, therefore practically no scans are made). In my opinion it can be kept in the same issue but I change the title.
image
I don't know if it can help. I honestly don't know what else to do to improve the upload. I put 2cpu and 3gb ram in the docker settings (I assume that the bottleneck can also derive from docker). One thing I can confirm is that by putting the periodic scan at 30 days / off moving in the library and displaying chapters does not give problems. Instead, as soon as you return to the home it takes a long time to load it. In addition, it takes a long time to open the page the first time you open after hours of not using the server. Example, I no longer use the server until tomorrow, tomorrow I wake up and open the page ... several more minutes before opening.

@VegethB VegethB changed the title [Bug Report] Great loading times [Bug Report] Extreme website load times with large library and home page with long load times. Jun 23, 2020
@hkalexling
Copy link
Member

@cglatot The issue you mentioned has a different cause, so I've opened #81 for it. Thanks for reporting!

In addition, it takes a long time to open the page the first time you open after hours of not using the server.

This is strange. I have never experienced this even when testing with a huge library. The load time has always been consistent. I will focus on the main issue here (long scan time) and then we will see if the problem you described still persists.

@hkalexling hkalexling changed the title [Bug Report] Extreme website load times with large library and home page with long load times. [Bug Report] Slow scan with large libraries Jun 23, 2020
hkalexling added a commit that referenced this issue Jul 1, 2020
@hkalexling
Copy link
Member

The scan performance has been improved in v0.7.2. I have tested it with a library containing 50 titles and 50,000 entries, and the scan completed within 30 seconds. It's still not ideal, and I will keep this issue open and find some other ways to optimize it.

@VegethB
Copy link
Author

VegethB commented Jul 2, 2020

after updating to 0.7.2 and adding 4 series, this is the time taken:
image
almost 6 minutes.
image

For a complete scan of each series over 20 minutes it is more than acceptable as an improvement. The docker runs on 2.5GB ram and 2 CPUs (I assume Hyper-V uses the same frequencies as my Xeon L5630 2.13ghz CPU. I'm more of a VMWare expert than Hyper-V ... 🤷‍♂️)
Maybe it could depend on the quality or quantity of images inside a ".cbz / .zip". Some series have been released with 300 "png" in a single volume for a total of 41 times (currently 41 volumes of about 300 png).
However I am using 0.7.2 and the improvements are visible 👌
The only thing I can try now is to run a linux OS directly or use linux integration on windows and see if the times are still going down. If they go down then it could be due to Hyper-V.

@VegethB
Copy link
Author

VegethB commented Jul 4, 2020

@hkalexling Bad... I took the phantom test I was talking about.
Then:
Dell, PowerEdge SC1420
CPU x2 Intel Xeon-3000 (3.0ghz)
RAM 8gb DDR2 SDRAM
HDD 160gb Hitachi Sata2 (so slow speed vs Sata3 hdd)
OS: Ubuntu 19 desktop amd64 (20 won't install)
From clean installation I started "mango" and then turned off. Copied and pasted the current 44 series library and the DB. So, second boot after ONLY 1.2 seconds had already finished.
image
Instead I started a scan on the docker and after 9 minutes it finished. I immediately started another one and that lasted 4 minutes.
We take into account that I doubt it is my server with windows in terms of hardware, it is an HP DL380 G6 x2 Xeon l5630 and 16GB RAM DDR3 + 2.5 "HDD Sata3. I bought it at the time just to replace that airplane and city of servers that I had (the sc1420 consumes madness and makes an even more absurd noise)
So, the docker is really the bottleneck, but I don't know where to look for the problem). Last test I can try is to use a complete VMWare (the docker is NOT a complete virtual machine) and see if it works like this too. I hope so in a sense, at least we know 100% that the bottleneck is docker.
EDIT:
Tested, With hyper-V ubuntu 19 desktop virtual machine the system itself is very slow. VMWare works without problems 🙃.
Perfect, you can't use Hyper-V and VMWare on windows servers at the same time.
I ask who is already using it @jaredlt , I have the system installed on 120gb ssd and only 40gb are free. This is the main reason why I didn't want to put WSL (Windows Subsystem Linux), I'm afraid that Microsoft didn't put the possibility to change the base folders. I would like to avoid finding myself C: \ Users \ My name \ all linux folders and similar stuff in C.

@VegethB VegethB changed the title [Bug Report] Slow scan with large libraries [Bug Report] Slow scan with large libraries on Hyper-V Docker (Windows) Jul 5, 2020
@hkalexling
Copy link
Member

This looks like a common issue: docker/for-win#188. When scanning, Mango has to perform heavy read/write operations on files in the shared volume. I don't use Windows so hopefully @jaredlt can answer your questions. I have some ideas to optimize the scan time and I will work on it soon.

@jaredlt
Copy link
Collaborator

jaredlt commented Jul 5, 2020

@zFerry98 Do you mean where you store your library? This is a bit of a tricky question depending on which version of WSL you use.

See: https://docs.microsoft.com/en-us/windows/wsl/compare-versions

Basically, if you use WSL1 (formerly just WSL), it has better IO if you leave your files in the Windows file system. So you can store you library on another drive if you wish, but yes, the main Linux distro would still be in C: (this is what I use).

If you use WSL2, it has much better performance if you store your files within the Linux file system. It seems you can access the distro Home directory from Windows using \\wsl$ ref, and there may be support for moving where the distro is stored too (but I don't know how official this is and I'd be hesitant to do this yet). WSL2 is quite new and you need the latest Windows version, which is still rolling out and not available for me yet (or opt-in to be a Windows Insider and get the newer releases of Windows).

Regarding running the service at startup, there are ways to do this:

Hope that helps!

@VegethB
Copy link
Author

VegethB commented Jul 5, 2020

@jaredlt OK then. The Docker website says it is (rightly) not made for production. the performance issue with host paths is known. However, Hyper-V's performance sucks regardless of docker.
At this point I ask @hkalexling if it is possible to have a 32bit version (or in any case if you can compile to 32 for your own purposes) because I have 3 PCs that I could use for mango but they are all 3 at 32bit. WSL1 and 2 are not good. I understand WSL1 and 2 and will try my luck. The problem of SSDs that at least 15% must be free (personal experiences) if putting WSL goes into C the OS and by chance the usual windows update that creates Windows.old comes out is practically 35gb of windows.old + linux on the remaining 5gb. .. I know it's my problem but I just wanted to share it. A 1.6ghz x2 core laptop, with 2gb ram, 32bit in my opinion is more than enough.

@hkalexling
Copy link
Member

@zFerry98 I just released v0.7.3, which is 32-bit compatible. I don't have a 32-bit machine so I tested it with an i386 Ubuntu docker image and it works great. There's no pre-built binary or docker image for i386 at this moment, so you will have to compile from source, but I am happy to help if you encounter any issues.

@VegethB
Copy link
Author

VegethB commented Jul 7, 2020

@zFerry98 Do you mean where you store your library? This is a bit of a tricky question depending on which version of WSL you use.

See: https://docs.microsoft.com/en-us/windows/wsl/compare-versions

Basically, if you use WSL1 (formerly just WSL), it has better IO if you leave your files in the Windows file system. So you can store you library on another drive if you wish, but yes, the main Linux distro would still be in C: (this is what I use).

If you use WSL2, it has much better performance if you store your files within the Linux file system. It seems you can access the distro Home directory from Windows using \\wsl$ ref, and there may be support for moving where the distro is stored too (but I don't know how official this is and I'd be hesitant to do this yet). WSL2 is quite new and you need the latest Windows version, which is still rolling out and not available for me yet (or opt-in to be a Windows Insider and get the newer releases of Windows).

Regarding running the service at startup, there are ways to do this:

Hope that helps!

@jaredlt
So after messy messes and hours of reading on ACPI and states P0 and C0 😵... I removed Hyper-v 🎉, I think it is the worst VM IN ABSOLUTE! I use the server in P3 and C6 with "Custom OS" power regulator profile and on windows "maximum performance" profile ... changed to c0 and p0 and high performance ... Nothing any VM on Hyper-V is 💩.
As proof of the fact that after removing Hyper-v and running VMWare with ubuntu 20, the difference in performance is already absurd (2 hours installation vs 40 minutes or 15 20 if install only base software). Unfortunately I could not test the VM directly because VMWare decided that the HOST folders (therefore units where I keep the manga) are not writable for ubuntu (I do not speak of the permission to put "read and write) I mean that after 1 day of research on commands and commands mango kept giving "Access denied".

So I went to test WSL (1). First thing, on the windows server the microsoft store is not there, so thanks to this you can install where you want the official distro (on the microsoft docs website there is the link for Ubuntu 20.04.appx that just change ".appx" in ".zip" and extract zip where you want to install the distro, Ex:
image

@hkalexling
Nothing, the distro works 🐱‍🏍 (let's say I perceive a latency that I can't explain, it seems to me as if it were always in a state of rest and when you do something it recovers after a few MS, I speak of the server "magno" on WSL). Indeed the performances with WSL (1) make the best solution for windwos users. However, the fact remains that those who use the docker on windows have this problem. Thanks for the support 👍.
Last thing, I didn't think WSL (1) would allow you to read linux folders directly from windows and modify them or whatever. ES:
image,

@hkalexling
Copy link
Member

hkalexling commented Jul 8, 2020

@zFerry98 Glad to know that it's working now! Just curious, how long does the scan take on WSL1?

@VegethB
Copy link
Author

VegethB commented Jul 8, 2020

@hkalexling
image

@mango-assistant
Copy link

Hi there! The issue has been fixed in v0.24.0. Thanks for the bug report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants