ipfs / ipfs-desktop

An unobtrusive and user-friendly desktop application for IPFS on Windows, Mac and Linux.
https://docs.ipfs.tech/install/ipfs-desktop/
MIT License
6.01k stars 865 forks source link

IPFS Desktop should install go-ipfs as a service #1977

Open Arlodotexe opened 2 years ago

Arlodotexe commented 2 years ago

Is your feature request related to a problem? Please describe. This feature request stemmed from an issue on Windows where IPFS was randomly going full throttle, presumably to do DHT bootstrapping or the like.

Since IPFS Desktop and go-ipfs are running as a normal user app in the system try, it treats go-ipfs with the default "normal" process priority. When CPU usage gets high, it interferes with most all other user applications that are open.

As a temporary workaround, you can restrict the number of processor cores allowed, or lower the process priority from task manager.

I've seen some Linux users use a much nicer workaround -- running go-ipfs as a service and setting the priority lower by default.

Describe the solution you'd like Having IPFS Desktop install go-ipfs as a service on Linux, Windows, etc, allows for

Describe alternatives you've considered

Additional context image

image

image

lidel commented 2 years ago

On installation options

Unsure if installing Windows Service is worth effort: it won't improve the default installation method (per user, without admin elevation).

My rationale:

How to fix it in per user install

I think Windows Service is not the solution, but adjusting process priorty could be:

Next steps

If someone wants to work on this, here are some pointers:

The key is to do this with minimal amount of code that is robust against failures (ipfs.exe should run as it does not if unable to set priority).

RubenKelevra commented 2 years ago
  • point_right Is it even worth the effort, if the default install per user will still have these CPU/instability spikes?

Well, I think so.

One advantage is, that it allows more security around the ipfs daemon through access restrictions, like we have with the hardened service for Linux/Systemd. So the worst case scenario gets much less worse if there's a security flaw in ipfs itself.


Regarding CPU/IO spikes, I run my service as background as possible on my Linux box, since I hardly have no CPU time to spare, but giving ipfs a fair share will just increase the overall latency of desktop operations, like open an app etc. This looks like this in systemd:

CPUSchedulingPolicy=idle
Nice=19
IOSchedulingClass=idle
IOSchedulingPriority=7

The effect is certainly noticeable, and I think I wouldn't run ipfs on this box if I couldn't put it in the background like this.