• Re: [gentoo-user] Firefox, Seamonkey to if I can, and memory limits.

    From Wol@21:1/5 to Dale on Fri Aug 23 23:30:01 2024
    On 23/08/2024 19:38, Dale wrote:
    Any ideas on how to limit Firefox memory usage?  Wouldn't mind if I
    could use it for other programs too.

    cgroups? Dunno how they work, but it's something they're supposed to do ...

    Cheers,
    Wol

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Walter Dnes@21:1/5 to Dale on Sat Aug 24 10:40:01 2024
    On Fri, Aug 23, 2024 at 07:42:05PM -0500, Dale wrote

    I still use openrc.  I'll look around and see what I can find.  Now I
    know what to look for.  Thing is, not sure I use cgroups either, unless
    it is on by default.   o_O

    The bottom half of file /etc/rc.conf is devoted to cgroups settings.
    Look for the line...
    # LINUX CGROUPS RESOURCE MANAGEMENT

    --
    There are 2 types of people
    1) Those who can extrapolate from incomplete data

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Wol@21:1/5 to Matt Jolly on Sat Aug 24 11:20:01 2024
    On 24/08/2024 00:03, Matt Jolly wrote:
    I use slices on HPC to limit users from monopolising interactive nodes,
    and our batch jobs kill anything that exceeds requested memory (hope
    that wasn't 100h into a job!). I do this on login with user slices but
    the concept is the same.

    I used something a bit like that on Pr1mos. I had a batch queue that ran
    on maximum priority, if users wanted something done quick. But it had a wall-clock limit of 30 secs. I don't think it got used much, but it was
    nice to know it was there so even if the machine was being hammered you
    could slip small jobs in quickly.

    Cheers,
    Wol

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Michael@21:1/5 to All on Sat Aug 31 18:32:47 2024
    On Sunday, 25 August 2024 16:20:19 BST Dale wrote:
    Walter Dnes wrote:
    On Fri, Aug 23, 2024 at 07:42:05PM -0500, Dale wrote

    I still use openrc. I'll look around and see what I can find. Now I
    know what to look for. Thing is, not sure I use cgroups either, unless
    it is on by default. o_O

    The bottom half of file /etc/rc.conf is devoted to cgroups settings.

    Look for the line...
    # LINUX CGROUPS RESOURCE MANAGEMENT

    I have searched for info on this. I did find the settings in rc.conf.
    I see a lot of discussion about running services, like cups, mysql and
    such, and controlling them. What I don't see is how to set up a regular program like Firefox or any other program that a user runs directly. I suspect it can be done but I can't find a howto that shows how to do it.

    I'll keep digging but if anyone has a link they have ran up on before
    and would like to share, it would be nice. It seems what I want to do
    is not very common. Thing is, Firefox sometimes goes nuts and when it
    does, it is determined to crash my system if I don't catch it. Even if
    I had the full 128GBs, it would just take longer to consume it as well.
    The best way I see to deal with this, limit its access to memory. It
    seems there is a tool to do this, now to figure out how to use it.

    Thanks to all for the help.

    Dale

    :-) :-)

    I have not dived into cgroups in any big way. I would think setting up a dekstop application with many complicated & complex userspace dependencies is not a simple task.

    Perhaps a way to approach this is by launching firefox as a different user and setting a memory limit for that user.

    -----BEGIN PGP SIGNATURE-----

    iQIzBAABCAAdFiEEXqhvaVh2ERicA8Ceseqq9sKVZxkFAmbTU78ACgkQseqq9sKV Zxnl/A/9HWCr9gaHSmbZOPk4okN5iW3+Q2DL/p7mqpDCL1fF+bFhqfO68Z52/fVd mjpgua9nV2ZaI29WbuKi6xANEkGLL9SRmrG1Li65O8f9MTMMpZY67753behF+nMU yy1nqQqFdi3rZVXfU+yWFVKEJiRU6l5UuuVaba7wsAe+8PvsXIPhqzQElf9orAzc SmqzrcEQhqX6QLZnBNucCcSLfUI54wH0trvLiSn1MZZcqxlmTod+0Syku+BWhhaX 5vj7Kn1grPCaeH32H1dhCjOqemTrWrG1S4SVHjv4IoXMKi9wnBGROAae1DsaqH5n m+15Bxzprp8y+5EjEnuLGHpG99w+jT0fnVaYM6vO52NVyidK9VnBIVwAO+gFTfkL qrKSJ4xUkZsxEQpBWntjDg69k6gasog4fchZG93xOQNKFMS4NotxPkeJeAyPDc4q VgBhlkEAevbHoXf0ouIvIiKcRwE6GriZD1qGcn6okqnhdGVIpxPuG7FjavqvkjZc xQ94B2X5FirFsxEqCKNwKAUfvRzgCxhfyCGgo345/m4GTYS/FmJGPGxJDhQ+3Fnk OVNBuCiXVjhursZH1ICoaMVjIF6K93AkQsIReM6iVVkf+8g1pLV3nIXJx28lEQ1t V8f86RlfIb5oKGYhpNbuaqtJXDEJD1LI2w9wDPonyFHHcb1nHeg=
    =fKrT
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Wols Lists@21:1/5 to Dale on Sun Sep 1 11:40:01 2024
    On 31/08/2024 19:39, Dale wrote:
    I did a lot of searching and almost all of it relates to using cgroups
    for services, like mysql or something.  I haven't found anything that explains how to do it for a program started by a user.  It may be doable
    but I've yet to find it.

    I did a quick search and found this ...

    https://unix.stackexchange.com/questions/555080/using-cgroup-to-limit-program-memory-as-its-running

    reading through it, it appears to tell you (a) how to set up the cgroup,
    (b) how to put a running program into a cgroup, and (c) (most
    importantly) how to start a program in a cgroup.

    So what you'd do is create the cgroup, then edit the firefox and
    seamonkey desktop files to use cgexec to start them.

    Beyond that tip, you're on your own but it looks promising. I've not
    done it, so I don't know ...

    Cheers,
    Wol

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Wols Lists@21:1/5 to Dale on Sun Sep 1 21:10:02 2024
    On 01/09/2024 15:24, Dale wrote:
    From that link, it looks like that is done manually.  In other words,
    when I start Firefox, I have to add the process to the cgroup by hand. Shouldn't there be a way to do it automatically?  Like add it to the
    command that runs the program name in the application menu?

    That was that bit about cgexec! I start a whole bunch of programs from
    the terminal, including iirc thunderbird and firefox.

    Or I start them by clicking on an icon which fires them up for me.

    So just read up on cgexec (including where to find it - I've just tried
    and it's not on my system), then edit the .desktop behind your icon to
    start firefox *from* cgexec.

    Then you (presuming you don't start it by typing firefox at the command
    line) will just start as normal, the only change being the icon starts
    cgexec and uses that to start firefox rather than starting firefox directly.

    Cheers,
    Wol

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Wol@21:1/5 to Dale on Sun Sep 1 22:50:02 2024
    On 01/09/2024 20:36, Dale wrote:
    I wonder tho, in one of the replies, it says to create a directory in
    /sys.  Don't those get cleared after a reboot?  I'm almost certain /proc does but think /sys does too.  If so, how does that survive reboots?  I
    may find more info as I search.

    I'll leave you to dig deeper, but let us know how it goes ... :-)

    Just about that /sys thing, that might be if you're trying to put an already-running program into a cgroup. If you're using cgexec to start a program, it should do all that for you.

    Cheers,
    Wol

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Wols Lists@21:1/5 to Dale on Mon Sep 2 08:50:01 2024
    On 01/09/2024 22:36, Dale wrote:
    https://linux.die.net/man/1/cgexec


    I've never seen that looping ... but there are a few sites like that -
    all it is is the linux man page. If you do "man cgexec" you should get
    the exact same text.

    Cheers,
    Wol

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)