vills / swap_tuning-cookbook

Chef cookbook to create a swap file of the recommended size considering the system memory.

Home Page:https://supermarket.chef.io/cookbooks/swap_tuning

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Swap Tuning Cookbook

Cookbook Version Dependency Status Code Climate Build Status Coverage Status

Chef cookbook to create a swap file of the recommended size considering the system memory.

This can be considered a general purpose cookbook but certainly not recommended for all cases.

Swap size is chosen based on the following documentation:

RAM Size Recommended Swap
≤ 2 GB 2 × RAM
2 GB - 8 GB = RAM
8 GB - 64 GB ½ × RAM
> 64 GB workload dependent

In case you already have swap in the system, creates another swap file with the difference if necessary.

Requirements

Supported Platforms

This cookbook has been tested on the following platforms:

  • Amazon
  • Arch Linux
  • CentOS
  • Debian
  • Fedora
  • OpenSUSE
  • RedHat
  • SUSE
  • Ubuntu

Please, let us know if you use it successfully on any other platform.

Required Cookbooks

Required Applications

  • Ruby 1.9.3 or higher.

Attributes

Attribute Default Description
node['swap_tuning']['size'] calculated Total swap size in MB.
node['swap_tuning']['minimum_size'] nil Swap minimum size in MB.
node['swap_tuning']['file_prefix'] '/swapfile' Swap file name prefix.
node['swap_tuning']['persist'] true Swap file persist.

Recipes

swap_tuning::default

Creates the swap file.

Usage

Including in a Cookbook Recipe

You can simply include it in a recipe:

# in your recipe
include_recipe 'swap_tuning'

Don't forget to include the swap_tuning cookbook as a dependency in the metadata:

# metadata.rb
depends 'swap_tuning'

Including in the Run List

Another alternative is to include it in your Run List:

{
  "name": "app001.example.com",
  "[...]": "[...]",
  "run_list": [
    "[...]",
    "recipe[swap_tuning]"
  ]
}

Testing

See TESTING.md.

Contributing

Please do not hesitate to open an issue with any questions or problems.

See CONTRIBUTING.md.

TODO

See TODO.md.

License and Author

Author: Xabier de Zuazo (xabier@zuazo.org)
Copyright: Copyright (c) 2015, Xabier de Zuazo
Copyright: Copyright (c) 2014, Onddo Labs, SL.
License: Apache License, Version 2.0
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

About

Chef cookbook to create a swap file of the recommended size considering the system memory.

https://supermarket.chef.io/cookbooks/swap_tuning

License:Apache License 2.0


Languages

Language:Ruby 97.1%Language:Shell 2.9%