Last active
December 25, 2015 12:39
-
-
Save pcn/6978407 to your computer and use it in GitHub Desktop.
Can't pass in vars from a recipe to a template and get them evaluated late enough.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ruby_block "set_read_and_write_limits" do | |
| block do | |
| raidable_disks = [] | |
| node["ec2"].each do |k, v| | |
| if (k =~ /^block_device_mapping_ephemeral/) | |
| dev_name = "/dev/" + v.sub('sd', "xvd") | |
| if File.exist?(dev_name) | |
| raidable_disks << dev_name | |
| end | |
| end | |
| end | |
| # Recommendation from Palomino for ec2: | |
| # Concurrent reads: 16 * <# of drives in an array> | |
| # Concurrent writes: 8 * <# of cores> | |
| reads = 16 * raidable_disks.length | |
| writes = 8 * node["cpu"]["total"].to_i | |
| throttle_limit = 2 * (reads + writes) | |
| Chef::Log.warn("concurrent_reads: #{reads} concurent_writes: #{writes} throttle_limit: #{throttle_limit}") | |
| node.set["cassandra"]["concurrent_reads"] = reads | |
| node.set["cassandra"]["concurrent_writes"] = writes | |
| node.set["cassandra"]["throttle_limit"] = throttle_limit | |
| # 2x (concurrent_reads + concurrent_writes) | |
| end | |
| end | |
| # ... | |
| template "#{node["cassandra"]["conf_dir"]}/cassandra.yaml" do | |
| source "cassandra.yaml.erb" | |
| owner "root" | |
| group "root" | |
| mode "0644" | |
| variables ( { | |
| :cassandra => node["cassandra"] | |
| } ) | |
| notifies :restart, "service[cassandra]" | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # ... | |
| # Unlike most systems, in Cassandra writes are faster than reads, so | |
| # you can afford more of those in parallel. A good rule of thumb is 2 | |
| # concurrent reads per processor core. Increase ConcurrentWrites to | |
| # the number of clients writing at once if you enable CommitLogSync + | |
| # CommitLogSyncDelay. --> | |
| concurrent_reads: <%= @cassandra["concurrent_reads"] %> #8 | |
| concurrent_writes: <%= @cassandra["concurrent_writes"] %> #32 | |
| # ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # ... | |
| # Unlike most systems, in Cassandra writes are faster than reads, so | |
| # you can afford more of those in parallel. A good rule of thumb is 2 | |
| # concurrent reads per processor core. Increase ConcurrentWrites to | |
| # the number of clients writing at once if you enable CommitLogSync + | |
| # CommitLogSyncDelay. --> | |
| concurrent_reads: <%= node["cassandra"]["concurrent_reads"] %> #8 | |
| concurrent_writes: <%= node["cassandra"]["concurrent_writes"] %> #32 | |
| # ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment