cookbook 'swap_tuning', '= 0.1.1'
swap_tuning (6) Versions 0.1.1 Follow4
Creates a swap file of the recommended size considering the system memory.
cookbook 'swap_tuning', '= 0.1.1', :supermarket
knife supermarket install swap_tuning
knife supermarket download swap_tuning
Description
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:
<table>
<tr>
<th>RAM Size</th>
<th>Recommended Swap</th>
</tr>
<tr>
<td>≤ 2 GB</td>
<td>2 × RAM</td>
</tr>
<tr>
<td>2 GB - 8 GB</td>
<td>= RAM</td>
</tr>
<tr>
<td>8 GB - 64 GB</td>
<td>½ × RAM</td>
</tr>
<tr>
<td>> 64 GB</td>
<td>workload dependent</td>
</tr>
</table>
In case you already have swap in the system, creates another swap file with the difference if necessary.
Requirements
Platform:
This cookbook has been tested on the following platforms:
- Amazon
- Arch Linux
- CentOS
- Debian
- Fedora
- RedHat
- Ubuntu
Please, let us know if you use it successfully on any other platform.
Cookbooks:
Applications:
- Ruby 1.9.3 or higher.
Attributes
<table>
<tr>
<th>Attribute</th>
<th>Description</th>
<th>Default</th>
</tr>
<tr>
<td><code>node['swap_tuning']['size']</code></td>
<td>Total swap size in MB.</td>
<td><em>calculated</em></td>
</tr>
<tr>
<td><code>node['swap_tuning']['minimum_size']</code></td>
<td>Swap minimum size in MB.</td>
<td><code>nil</code></td>
</tr>
<tr>
<td><code>node['swap_tuning']['file_prefix']</code></td>
<td>Swap file name prefix.</td>
<td><code>"/swapfile"</code></td>
</tr>
<tr>
<td><code>node['swap_tuning']['persist']</code></td>
<td>Swap file persist.</td>
<td><code>true</code></td>
</tr>
</table>
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::default"
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.onddo.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@onddo.com) |
Copyright: | Copyright (c) 2014, Onddo Labs, SL. (www.onddo.com) |
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.
Dependent cookbooks
swap >= 0.0.0 |
Contingent cookbooks
There are no cookbooks that are contingent upon this one.