photoview / photoview

Photo gallery for self-hosted personal servers
https://photoview.github.io/
GNU Affero General Public License v3.0
5.32k stars 397 forks source link

CPU Usage Issue #169

Closed iSkytran closed 3 years ago

iSkytran commented 3 years ago

I'm currently running Photoview on a laptop in my home. This laptop has approximately 70 GB of photos and videos. Whenever I try to scan my photos and videos however, it will get hung up on a large video. The cpu usage spikes to 100% and eventually the laptop crashes a few seconds later. This is probably due to me running Photoview on an underpowered laptop, but are there any other solutions?

viktorstrate commented 3 years ago

There is a discussion about ways the video scanner could be improved or disabled to reduce CPU and cache size, see #131.

But for now you can try to set Scanner Concurrent Workers to 1 in the Settings page. This will limit processing to one item at a time.

iSkytran commented 3 years ago

Unfortunately, while lowering the Scanner Concurrent Workers to 1, it just delayed the inevitable and the laptop still crashed. The video it is getting hung up on is 404 MB large which is likely a part of the problem? I'll try limiting the docker next cpu usage to prevent the computer from crashing, so I'll see how that goes.

viktorstrate commented 3 years ago

Okay, I'll give this issue a high priority. I'm thinking a simple solution would be to add the option to disable video transcoding completely from the settings.

Also only transcode videos that cannot be played in the browser, see also https://github.com/photoview/photoview/discussions/131#discussioncomment-247775

viktorstrate commented 3 years ago

The scanner will now only transcode videos that aren't web compatible. See commit fbebb13.

If you are using the :edge docker tag, you can pull the latest changes, if so do you mind checking if this solves your problem?

iSkytran commented 3 years ago

The changes definitely helped! The computer got further along before crashing, so I believe that it's a hardware problem, but putting a CPU limit in the docker-compose file seemed to prevent the CPU from spiking about 90 degrees Celsius. I just added

deploy:
 resources:
    limits:
        cpus: "2"

and ran docker-compose with docker-compose --compatibility up -d.

Thanks for making such a cool piece of software!

viktorstrate commented 3 years ago

Great to hear that you found a solution and that the changes helped.