Cloudron makes it easy to run web apps like WordPress, Nextcloud, GitLab on your server. Find out more or install now.


Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Bookmarks
  • Search
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

Cloudron Forum

Apps | Demo | Docs | Install
  1. Cloudron Forum
  2. Support
  3. Memory graph for Services, 50% RAM and 50% Swap.

Memory graph for Services, 50% RAM and 50% Swap.

Scheduled Pinned Locked Moved Solved Support
graphs
11 Posts 4 Posters 1.4k Views 4 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • d19dotcaD Offline
      d19dotcaD Offline
      d19dotca
      wrote on last edited by girish
      #1

      I think I know the answer here but would just like to double-check because it's one of things I think I'm overthinking, lol...

      In this image below, if it's 4 GB assigned and 50% of that is actual RAM and 50% is swap, does this graph mean that it's been dipping into swap and I've reached 100% of the RAM side of things for this particular service?

      a9c1585b-3179-442f-a99f-6c0df4dbfe6d-image.png

      Just looking into fine-tuning my server, specifically for WordPress, and I knew I had plenty of memory assigned to MySQL, but the more I looked at it, it looks around 60-70% used, and if it's only 50% to RAM, then does this mean 10-20% is dipping from the slower swap memory location? This would be a small performance bottleneck for any database lookups, right?

      --
      Dustin Dauncey
      www.d19.ca

      marcusquinnM girishG 2 Replies Last reply
      0
      • d19dotcaD d19dotca

        I think I know the answer here but would just like to double-check because it's one of things I think I'm overthinking, lol...

        In this image below, if it's 4 GB assigned and 50% of that is actual RAM and 50% is swap, does this graph mean that it's been dipping into swap and I've reached 100% of the RAM side of things for this particular service?

        a9c1585b-3179-442f-a99f-6c0df4dbfe6d-image.png

        Just looking into fine-tuning my server, specifically for WordPress, and I knew I had plenty of memory assigned to MySQL, but the more I looked at it, it looks around 60-70% used, and if it's only 50% to RAM, then does this mean 10-20% is dipping from the slower swap memory location? This would be a small performance bottleneck for any database lookups, right?

        marcusquinnM Offline
        marcusquinnM Offline
        marcusquinn
        wrote on last edited by
        #2

        @d19dotca never thought of that, but certainly curious too.

        WP certainly doesn't do well when queries hammer the disk, but that's usually doe to poor query coding. https://www.wpintense.com/ has a lot more on that subject.

        Web Design https://www.evergreen.je
        Development https://brandlight.org
        Life https://marcusquinn.com

        d19dotcaD 1 Reply Last reply
        1
        • marcusquinnM marcusquinn

          @d19dotca never thought of that, but certainly curious too.

          WP certainly doesn't do well when queries hammer the disk, but that's usually doe to poor query coding. https://www.wpintense.com/ has a lot more on that subject.

          d19dotcaD Offline
          d19dotcaD Offline
          d19dotca
          wrote on last edited by d19dotca
          #3

          @marcusquinn Totally. I've always considered performance when designing my client's websites so they all load pretty well, in about 2 seconds or less, sometimes as low as around 1.2 seconds, but I've never spent a ton of time really optimizing all the nitty gritty stuff, and that's what I believe my next "project" will be for my clients.

          Though WordPress optimizations is more of a different topic haha so I'll likely create a dedicated post in the WordPress app category to collect and share some resources for people to use when it comes to fine-tuning the performance of WordPress itself. I believe you're a guru on that yourself, so hopefully you won't mind contributing to it. 🙂

          --
          Dustin Dauncey
          www.d19.ca

          marcusquinnM 1 Reply Last reply
          0
          • d19dotcaD d19dotca

            @marcusquinn Totally. I've always considered performance when designing my client's websites so they all load pretty well, in about 2 seconds or less, sometimes as low as around 1.2 seconds, but I've never spent a ton of time really optimizing all the nitty gritty stuff, and that's what I believe my next "project" will be for my clients.

            Though WordPress optimizations is more of a different topic haha so I'll likely create a dedicated post in the WordPress app category to collect and share some resources for people to use when it comes to fine-tuning the performance of WordPress itself. I believe you're a guru on that yourself, so hopefully you won't mind contributing to it. 🙂

            marcusquinnM Offline
            marcusquinnM Offline
            marcusquinn
            wrote on last edited by
            #4

            @d19dotca Sure, our main weapon is plugin unloading (our own plugin I can share privately but it's hazardous in the wrong hands) and fragment caching (WP Super Cache - tried all the rest but WPSC is the best coded for hooks & filters).

            Web Design https://www.evergreen.je
            Development https://brandlight.org
            Life https://marcusquinn.com

            1 Reply Last reply
            1
            • d19dotcaD d19dotca

              I think I know the answer here but would just like to double-check because it's one of things I think I'm overthinking, lol...

              In this image below, if it's 4 GB assigned and 50% of that is actual RAM and 50% is swap, does this graph mean that it's been dipping into swap and I've reached 100% of the RAM side of things for this particular service?

              a9c1585b-3179-442f-a99f-6c0df4dbfe6d-image.png

              Just looking into fine-tuning my server, specifically for WordPress, and I knew I had plenty of memory assigned to MySQL, but the more I looked at it, it looks around 60-70% used, and if it's only 50% to RAM, then does this mean 10-20% is dipping from the slower swap memory location? This would be a small performance bottleneck for any database lookups, right?

              girishG Do not disturb
              girishG Do not disturb
              girish
              Staff
              wrote on last edited by girish
              #5

              @d19dotca said in Memory graph for Services, 50% RAM and 50% Swap.:

              In this image below, if it's 4 GB assigned and 50% of that is actual RAM and 50% is swap, does this graph mean that it's been dipping into swap and I've reached 100% of the RAM side of things for this particular service?

              The algorithm is not like "RAM gets first priority. When it's over, look into swap". RAM gets allocated but that RAM can get swapped out any time depending on the requirements of other processes in the system. For example, mysql could be using say only 8MB to start with. But 4MB can get swapped out if something else needs it (they are some system calls like mlock which can prevent swapping out). In the graph above, it will show 8MB as green bar.

              IIRC, we can get this information of exactly how much swap and memory is used by a cgroup but this requires the kernel to have memory accounting enabled (which you have no control over in most VPS).

              There's more info at https://docs.docker.com/config/containers/runmetrics/ and https://www.mjmwired.net/kernel/Documentation/cgroups/memory.txt if you want dig deeper.

              d19dotcaD 1 Reply Last reply
              1
              • girishG girish

                @d19dotca said in Memory graph for Services, 50% RAM and 50% Swap.:

                In this image below, if it's 4 GB assigned and 50% of that is actual RAM and 50% is swap, does this graph mean that it's been dipping into swap and I've reached 100% of the RAM side of things for this particular service?

                The algorithm is not like "RAM gets first priority. When it's over, look into swap". RAM gets allocated but that RAM can get swapped out any time depending on the requirements of other processes in the system. For example, mysql could be using say only 8MB to start with. But 4MB can get swapped out if something else needs it (they are some system calls like mlock which can prevent swapping out). In the graph above, it will show 8MB as green bar.

                IIRC, we can get this information of exactly how much swap and memory is used by a cgroup but this requires the kernel to have memory accounting enabled (which you have no control over in most VPS).

                There's more info at https://docs.docker.com/config/containers/runmetrics/ and https://www.mjmwired.net/kernel/Documentation/cgroups/memory.txt if you want dig deeper.

                d19dotcaD Offline
                d19dotcaD Offline
                d19dotca
                wrote on last edited by
                #6

                @girish Ah interesting, so then from the sounds of it, memory is a bit random in terms of whether it's using RAM or swap, right? So I guess then I'll leave it at 4 GB as-is since it's using about 3 GB right now, if that. Is there any possibility / does it even make sense to look at it where RAM is used first and then swap? I.e. does it make sense to sort of set a preference on this at all? Or is this not really possible to do / wouldn't matter anyways?

                --
                Dustin Dauncey
                www.d19.ca

                marcusquinnM girishG 2 Replies Last reply
                0
                • d19dotcaD d19dotca

                  @girish Ah interesting, so then from the sounds of it, memory is a bit random in terms of whether it's using RAM or swap, right? So I guess then I'll leave it at 4 GB as-is since it's using about 3 GB right now, if that. Is there any possibility / does it even make sense to look at it where RAM is used first and then swap? I.e. does it make sense to sort of set a preference on this at all? Or is this not really possible to do / wouldn't matter anyways?

                  marcusquinnM Offline
                  marcusquinnM Offline
                  marcusquinn
                  wrote on last edited by
                  #7

                  @d19dotca I guess it would make sense for the total RAM allocation across all apps not to exceed the total physical RAM available to avoid the disk-swap.

                  I defer to the experts but with WP I find the CPU would max-out before RAM in our typical config ratios.

                  I did a bunch of research on this a while back for MySQL my.cnf settings best-practice for optimal RAM usage, and wrote up here for reference:

                  • https://gitlab.com/d2c.io/wordpress-scalable-lemp-single-server/-/blob/master/configs/my.cnf - Reference

                  @girish Not sure if you optimise my.cnf settings for server specs like this? ^

                  Web Design https://www.evergreen.je
                  Development https://brandlight.org
                  Life https://marcusquinn.com

                  1 Reply Last reply
                  1
                  • d19dotcaD d19dotca

                    @girish Ah interesting, so then from the sounds of it, memory is a bit random in terms of whether it's using RAM or swap, right? So I guess then I'll leave it at 4 GB as-is since it's using about 3 GB right now, if that. Is there any possibility / does it even make sense to look at it where RAM is used first and then swap? I.e. does it make sense to sort of set a preference on this at all? Or is this not really possible to do / wouldn't matter anyways?

                    girishG Do not disturb
                    girishG Do not disturb
                    girish
                    Staff
                    wrote on last edited by
                    #8

                    @d19dotca There is a thing called swappiness which controls when the kernel decides to swap things out - https://linuxhint.com/understanding_vm_swappiness/ . This value can be set a per-container level but we have never experimented with this. It can always be changed at the VM level though using sysctl calls. But like other things, fine tuning these things requires significant time investment to actually understand what they mean and most of the time they don't behave like we expect them to (especially these kernel configs) 🙂

                    d19dotcaD robiR 2 Replies Last reply
                    1
                    • girishG girish

                      @d19dotca There is a thing called swappiness which controls when the kernel decides to swap things out - https://linuxhint.com/understanding_vm_swappiness/ . This value can be set a per-container level but we have never experimented with this. It can always be changed at the VM level though using sysctl calls. But like other things, fine tuning these things requires significant time investment to actually understand what they mean and most of the time they don't behave like we expect them to (especially these kernel configs) 🙂

                      d19dotcaD Offline
                      d19dotcaD Offline
                      d19dotca
                      wrote on last edited by
                      #9

                      @girish That's fair. Thanks for the detailed responses, always learning something new, which I love! 🙂 It's probably not necessary for a while yet then if at all, but would be interested in testing that out sometime (I can be a guinea pig if needed) in the future in case that allows for better performance.

                      --
                      Dustin Dauncey
                      www.d19.ca

                      1 Reply Last reply
                      0
                      • girishG girish

                        @d19dotca There is a thing called swappiness which controls when the kernel decides to swap things out - https://linuxhint.com/understanding_vm_swappiness/ . This value can be set a per-container level but we have never experimented with this. It can always be changed at the VM level though using sysctl calls. But like other things, fine tuning these things requires significant time investment to actually understand what they mean and most of the time they don't behave like we expect them to (especially these kernel configs) 🙂

                        robiR Offline
                        robiR Offline
                        robi
                        wrote on last edited by
                        #10

                        @girish if we change the vm.swappiness on the host, will that persist to the containers?

                        If not, where do we set the Cloudron default?

                        Conscious tech

                        girishG 1 Reply Last reply
                        0
                        • robiR robi

                          @girish if we change the vm.swappiness on the host, will that persist to the containers?

                          If not, where do we set the Cloudron default?

                          girishG Do not disturb
                          girishG Do not disturb
                          girish
                          Staff
                          wrote on last edited by
                          #11

                          @robi That's my understanding, yes. That it will persist to containers. The article I liked in the earlier comment has the sysctl command to set vm swappiness. But as mentioned earlier, fine tuning these things should be done after investigating and understanding those settings because they usually end up having unexpected side effects.

                          1 Reply Last reply
                          1
                          Reply
                          • Reply as topic
                          Log in to reply
                          • Oldest to Newest
                          • Newest to Oldest
                          • Most Votes


                            • Login

                            • Don't have an account? Register

                            • Login or register to search.
                            • First post
                              Last post
                            0
                            • Categories
                            • Recent
                            • Tags
                            • Popular
                            • Bookmarks
                            • Search