Git Product home page Git Product logo

cgrouper's Introduction

CGrouper

CGrouper provides tools to manage cgroup cpu and memory settings for multiple services across fleets of servers.

It's funny because right now, the systemd module does not allow one to execute the "set-property" sub command, which would let you just do this type of stuff with that module. Anyway, I think I've put a pretty cool spin on it, so enjoy!

Total Ansible n00b, so feel free to modify or send me a PR to update.

Requirements

Linux distro running systemd - all testing done on Fedora and RHEL Right now, cgroups version 1 (default through RHEL 8)

Role Variables

This role takes the variable cgrouper_limits as a list.

Possible values for each list entry are:

service - name of the service, such as httpd. You need this one

setting - the actual cgroup setting we're changing. Currently three are supported
   - CPUShares - This controls the balance of processer time against other services when the system is under load. Default value on RHEL/Fedora is 1024 
   - CPUQuota - maximum cpu time. tranlates to "cpu_quota". 100% is 100% of a single core, can be higher (250% for instance is 2 and a half cores. Which is a terrible sitcom). Setting ends with a percent sign, do not forget to use it
   - MemoryLimit - maximum memory the service can cosume. End with M for megabytes and G for gigabytes

value - the setting for the cgroup. Note that CPUQuota MUST be expressed with a % after the number. You'll get an error running your playbook if you don't.

Example Playbook

This playbook will set up the cgroup configs for all web servers so the Apache gets 4 times the processoer time of other daemons when the system is under load. It will also cap the mandatory malware scanner to 10% of a single CPU and will stop RAM Hog 2018 from using more than 512 MB.

- name: Apache is important
   hosts: web
   vars:
     cgrouper_limits:
       - service: httpd
         setting: CPUShares
         value: 2048
       - service: mscan
         setting: CPUQuota
         value: 10% 
       - service: ramhogd
         setting: MemoryLimit
         value: 512M
   roles:
     - CGrouper

License

GPL v 3

Author Information

Original author Marc Richter - [email protected]

cgrouper's People

Contributors

unclemarc avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.