-
-
Notifications
You must be signed in to change notification settings - Fork 320
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
Album downloads are too taxing on the server #1295
Comments
How large an album are we talking about? Your Now, a point can be made that photo/video media files are compressed already and having Lychee try to compress them again is a waste of time anyway. I'll see if there is an option in the Zip compressors we use to disable compression... |
This will be solved by a big, pending re-factoring which largely improves on error handling. Note, that the user won't see a direct error message, because the ZIP archive is downloaded via an ordinary HTTP GET request. But at least the logs will contain a proper error message.
Actually, the download should already start streaming to the client while more photos are added to the ZIP archive progressively. |
I'm talking about an album with 78 photos, 7-10mb each one. My hosting provides 1,5GB of RAM which get exhausted. CPU gets to a 100%, but I'm not sure what the specs are in that regard |
I wouldn't expect RAM to be an issue because, as @nagmat84 wrote, the zip file is streamed to the client while media files are added to it, so the total archive size shouldn't matter for the server. Our Zip compressor is supposed to use twice as much RAM as the current source file being compressed, so it shouldn't be more than some 20 MB in your case. Let's try to disable the compression though and see if that helps. Our Zip compressor already does that for files that it considers "large", but the default threshold is at 20 MB. You are on the 4.4.0 release, correct? Can you modify the following file: Lychee/app/Actions/Album/Archive.php Lines 40 to 42 in 5b51765
Add the following line between the current lines 41 and 42:
Can you then try to download the album again and let us know if it works better now? Thanks! |
Now it hangs for a while and then the page "unloads" to say so. See this example: ***** |
This sounds a little like a buffering problem. How does your setup look like? Which HTTP server and how does PHP interact with the server (included, cgi, php-fpm)? If the webserver tries to buffer the output of Lychee and waits until the whole process has been terminated, this would also explain the memory consumption. |
Agreed. I tried with smaller albums, like "EMOZ" and "Zaragoza", and I was able to download those, but at least on the first attempt there was a curious delay before the download started (like 5-6 seconds long), for which there really is no explanation. It seems like something is caching the responses on the server side. Are you running some sort of a proxy? |
Not that I know. This is a shared hostinger (hosting24) server, with some interesting perks (unlimited storage and bandwidth). I don't know exactly how they run the servers, but I have a fair amount of access to it (even ssh) and I couldn't see a proxy or anything like that |
I do not think this is a problem with Lychee but with a config of the server, we are using ZipStream especially in order to avoid such issue (before we were building the zip before sending it). https://photography.viguier.nl/gallery#JfdRU2VvM5MgZbfPNiocgAdq |
@somas95 It has not necessarily to be a dedicated proxy. I myself have recently run into a similar problem with Apache in combination with PHP-FPM and a particular set of Apache extensions. Apache as well as Nginx have quite a fair amount of caching capabilities built into them. So it would be really interesting to know your server configuration. |
yeah, I do have php-fpm. PHP Modules
|
I meant your Apache modules. Please run |
Hmm, I don't seem able to retrieve those |
What do you mean? I thought you have SSH access?
And I believe that Debian renames the Apache executable to |
I thought I had, but seems I only have access to a limited jailed sh session. I already tried httpd and apache2ctl before, just tried apache2 now and it's the same. So I guess I don't know which modules do they load |
Never mind. The fact that you are using Apache together with PHP-FPM suggests that you might suffer from the same configuration error which I myself had encountered recently. The issue only occurs in combination with the Apache modules You need to disable the compression functionality which is provided by these two modules for certain URLs otherwise you will end up with a "double" compression. The fix is part of PR #1217. However, you can apply the needed changes locally to your The crucial part are the Let me know, if this fixes the problem for you. |
BTW: The potential bug fix has been merged into the |
I tried editing the .htaccess with no avail. Reviewing usage stats seems that I consistently hit an I/O usage cap of 3mb/s, but that should only throttle the process, no kill it. So I'm still in the dark, albeit I guess I can't expect much from a shared server |
Each time a user tries to download an album Lychee tries to compress all the photos in it, which for big albums can be quite taxing in both RAM and CPU usage, and in many cases ends with the operation being killed without more feedback to the user. I understand compressing files is a CPU bound operation, but maybe it could be explored another option (gradually adding files to a cached zip folder when importing photos into a folder? Compressing files in small batches?), or, at the very least, provide the user with some feedback on what went wrong
Output of the diagnostics [REQUIRED]
The text was updated successfully, but these errors were encountered: