SlideShare une entreprise Scribd logo
1  sur  28
Télécharger pour lire hors ligne
Performance Tuning 
Your (Puppet) 
Infrastructure 
Nic Benders 
OWNING 
http://nicbenders.com/presentations/puppetconf-2014
I work at New Relic. 
! 
This is a story about treating 
your infrastructure the same 
way you treat your applications. 
! 
This is also a story about how 
we use New Relic, 
at New Relic. 
http://nicbenders.com/presentations/puppetconf-2014
Managing Our Applications 
• Source Control 
• Continuous Deployment 
• Performance Monitoring 
• Operational Analytics 
• Log Collection 
GitHub with Pull Requests 
Jenkins + Capistrano 
New Relic APM 
New Relic Insights 
Heka + ElasticSearch + Kibana
Managing Our Infrastructure 
• Source Control 
• Continuous Deployment 
• Performance Monitoring 
• Operational Analytics 
• Log Collection 
GitHub with Pull Requests 
Jenkins + Capistrano 
New Relic APM 
New Relic Insights 
Heka + ElasticSearch + Kibana
Source Control
Continuous 
Deployment
Performance 
Monitoring
DON’T PANIC 
• These example are for Puppet Enterprise 3.1, but this will work with Puppet 
Open Source, or with newer versions. You’ll just need to make a few changes 
here and there. 
• If you don’t have a New Relic account, you can sign-up for a free “Lite” account. 
• All of the examples are up in a more useful format at the URL below. 
(The URL will also be shown at the end of the presentation.) 
http://nicbenders.com/presentations/puppetconf-2014
Instrumenting the 
Puppet Master 
• Install newrelic_rpm using the 
Puppet’s Ruby interpreter 
• Modify the config.ru in the Puppet 
Master root dir 
• Create a newrelic.yml in the same 
directory 
# 
/var/opt/lib/pe-­‐puppetmaster/config.ru 
! 
# 
Setup 
the 
New 
Relic 
Ruby 
Agent 
before 
anything 
else 
require 
'rubygems' 
require 
'newrelic_rpm' 
# 
END 
New 
Relic 
Ruby 
Agent 
setup 
# 
/var/opt/lib/pe-­‐puppetmaster/newrelic.yml 
! 
common: 
&default_settings 
license_key: 
'000-­‐your-­‐license-­‐key-­‐here-­‐000' 
app_name: 
"Puppet 
Master" 
log_level: 
info 
log_file_path: 
'/var/log/pe-­‐puppet/' 
ssl: 
false 
capture_params: 
true 
transaction_tracer: 
enabled: 
true 
error_collector: 
enabled: 
true 
ignore_errors: 
"ActionController::RoutingError" 
production: 
<<: 
*default_settings 
monitor_mode: 
true
Getting good 
transaction names 
• Use set_transaction_name in a 
Rack Middleware to tell the Ruby 
Agent how we are going to name 
the “web transactions” for the 
Puppet Master 
• Use add_custom_parameters to 
pass the environment and other 
useful data along 
# 
# 
We 
don't 
want 
every 
transaction 
to 
just 
say 
"call", 
so 
define 
a 
# 
Transaction 
"namer" 
for 
the 
Ruby 
Agent 
based 
on 
the 
URL 
structure 
# 
class 
CoolNamer 
def 
initialize(app, 
opts 
= 
{}) 
@app 
= 
app 
end 
def 
call(env) 
req 
= 
Rack::Request.new(env) 
_, 
environment, 
kind_of_thing, 
resource 
= 
req.path.split('/',4) 
NewRelic::Agent.set_transaction_name(kind_of_thing, 
:category 
=> 
:rack) 
NewRelic::Agent.add_custom_parameters(:puppet_env 
=> 
environment) 
NewRelic::Agent.add_custom_parameters(:puppet_resource 
=> 
resource) 
@app.call(env) 
end 
end 
use 
CoolNamer 
# 
END 
Transaction 
"namer"
Getting more detail 
• The Ruby Agent’s MethodTracer 
allows us to get details of what is 
going on inside a Transaction. 
• By hooking into Puppet’s built-in 
Profiler calls, we can quickly 
instrument all the most important 
things. 
• This example is for Puppet 3.3.1. In 
newer versions it is much easier. 
require 
"puppet/util/profiler" 
module 
Puppet::Util::Profiler 
include 
::NewRelic::Agent::MethodTracer 
self.profile(message, 
&block) 
if 
/^Processed 
request 
def 
/ 
=== 
message 
# 
Top 
level 
trace, 
skip 
for 
now 
yield 
else 
metric_name 
= 
self.message_to_metric(message) 
trace_execution_scoped([metric_name]) 
do 
yield 
end 
end 
end 
def 
self.message_to_metric(message) 
message.chomp! 
message.gsub!(/^(Compiled 
catalog) 
for 
.*/, 
'1') 
message.gsub!(/^(Filtered 
result 
for 
catalog) 
.*/, 
'1') 
message.gsub!(/(d+) 
/, 
'') 
message.gsub!(/^(Evaluated 
resource) 
/, 
'1/') 
message.gsub!(/[.*]/,'') 
message.gsub!(/:s/,'/') 
message.gsub!(/^(Called) 
/, 
'1/') 
"Custom/Puppet/#{message}" 
end 
end
Instrumenting the 
Puppet DB 
• Download the Java Agent from 
your “Account Settings” page. 
• Create an /opt/puppet/newrelic 
dir and place the newrelic.jar and 
newrelic.yaml file into it. 
• Modify the newrelic.yaml 
• Modify JAVA_ARGS 
# 
/etc/syslog/pe-­‐puppetdb 
! 
# 
Enable 
the 
New 
Relic 
Java 
Agent 
by 
adding 
this 
# 
to 
the 
bottom 
of 
the 
file 
JAVA_ARGS="-­‐javaagent:/opt/puppet/newrelic/newrelic.jar 
${JAVA_ARGS}" 
# 
/opt/puppet/newrelic/newrelic.yml 
! 
common: 
&default_settings 
license_key: 
'000-­‐your-­‐license-­‐key-­‐here-­‐000' 
! 
app_name: 
'Puppet 
DB' 
log_level: 
info 
log_file_path: 
/var/log/pe-­‐puppetdb/ 
ssl: 
false 
transaction_tracer: 
enabled: 
true 
transaction_threshold: 
apdex_f 
record_sql: 
obfuscated 
stack_trace_threshold: 
0.2 
explain_enabled: 
true 
explain_threshold: 
0.2 
browser_monitoring: 
auto_instrument: 
false 
production: 
<<: 
*default_settings
Operational Analytics
Log Collection
Puppet Agent already goes into Syslog 
• Agent syslogs have a ton of useful 
information. We just need to get it 
to a useful place. 
• Our application and syslog data is 
collected by a Heka process on 
each server. It then makes its way 
to ElasticSearch, where it can be 
queried by Kibana.
Send run reports to the same place 
• Add your log system as a 
Report processor! 
• We use https://github.com/ 
logstash/puppet-logstash-reporter 
• To get the data into Heka, we had 
to write some Lua, but it was 
pretty straightforward.
pe_puppet::master::config_hash: 
reports: 
'http,puppetdb,logstash' 
! 
logstash_reporter::logstash_host: 
'our-­‐heka-­‐server' 
# 
Logstash-­‐style 
report 
processer 
through 
Heka 
class 
{ 
'logstash_reporter': 
logstash_port 
=> 
'22253', 
logstash_host 
=> 
hiera('logstash_reporter::logstash_host'), 
}
Managing Our Infrastructure 
• Source Control 
• Continuous Deployment 
• Performance Monitoring 
• Operational Analytics 
• Log Collection 
GitHub with Pull Requests 
Jenkins + Capistrano 
New Relic APM 
New Relic Insights 
Heka + ElasticSearch + Kibana
We’re Hiring 
Site Reliability Engineers 
MySQL Experts 
Engineering Managers 
Data Pipeline Engineers 
newrelic.com/about/careers
http://nicbenders.com/presentations/puppetconf-2014 
nic@newrelic.com

Contenu connexe

Tendances

OpenNebula and SaltStack - OpenNebulaConf 2013
OpenNebula and SaltStack - OpenNebulaConf 2013OpenNebula and SaltStack - OpenNebulaConf 2013
OpenNebula and SaltStack - OpenNebulaConf 2013
databus.pro
 

Tendances (20)

OpenNebula and SaltStack - OpenNebulaConf 2013
OpenNebula and SaltStack - OpenNebulaConf 2013OpenNebula and SaltStack - OpenNebulaConf 2013
OpenNebula and SaltStack - OpenNebulaConf 2013
 
Puppet Performance Profiling
Puppet Performance ProfilingPuppet Performance Profiling
Puppet Performance Profiling
 
Intelligent infrastructure with SaltStack
Intelligent infrastructure with SaltStackIntelligent infrastructure with SaltStack
Intelligent infrastructure with SaltStack
 
Tp install anything
Tp install anythingTp install anything
Tp install anything
 
Deployment with capistrano
Deployment with capistranoDeployment with capistrano
Deployment with capistrano
 
Salt conf 2014 - Using SaltStack in high availability environments
Salt conf 2014 - Using SaltStack in high availability environmentsSalt conf 2014 - Using SaltStack in high availability environments
Salt conf 2014 - Using SaltStack in high availability environments
 
Capistrano
CapistranoCapistrano
Capistrano
 
A user's perspective on SaltStack and other configuration management tools
A user's perspective on SaltStack and other configuration management toolsA user's perspective on SaltStack and other configuration management tools
A user's perspective on SaltStack and other configuration management tools
 
Cookbook testing with KitcenCI and Serverrspec
Cookbook testing with KitcenCI and ServerrspecCookbook testing with KitcenCI and Serverrspec
Cookbook testing with KitcenCI and Serverrspec
 
Capistrano - Deployment Tool
Capistrano - Deployment ToolCapistrano - Deployment Tool
Capistrano - Deployment Tool
 
Background Jobs with Resque
Background Jobs with ResqueBackground Jobs with Resque
Background Jobs with Resque
 
Capistrano - automate all the things
Capistrano - automate all the thingsCapistrano - automate all the things
Capistrano - automate all the things
 
Designing net-aws-glacier
Designing net-aws-glacierDesigning net-aws-glacier
Designing net-aws-glacier
 
Php resque
Php resquePhp resque
Php resque
 
Background processing with Resque
Background processing with ResqueBackground processing with Resque
Background processing with Resque
 
Real-time Infrastructure Management with SaltStack - OpenWest 2013
Real-time Infrastructure Management with SaltStack - OpenWest 2013Real-time Infrastructure Management with SaltStack - OpenWest 2013
Real-time Infrastructure Management with SaltStack - OpenWest 2013
 
The SaltStack Pub Crawl - Fosscomm 2016
The SaltStack Pub Crawl - Fosscomm 2016The SaltStack Pub Crawl - Fosscomm 2016
The SaltStack Pub Crawl - Fosscomm 2016
 
Getting Started with Capistrano
Getting Started with CapistranoGetting Started with Capistrano
Getting Started with Capistrano
 
Spot Trading - A case study in continuous delivery for mission critical finan...
Spot Trading - A case study in continuous delivery for mission critical finan...Spot Trading - A case study in continuous delivery for mission critical finan...
Spot Trading - A case study in continuous delivery for mission critical finan...
 
Managing Puppet using MCollective
Managing Puppet using MCollectiveManaging Puppet using MCollective
Managing Puppet using MCollective
 

En vedette

To the Future! - Goals for Puppet 4 - PuppetConf 2014
To the Future! - Goals for Puppet 4 - PuppetConf 2014To the Future! - Goals for Puppet 4 - PuppetConf 2014
To the Future! - Goals for Puppet 4 - PuppetConf 2014
Puppet
 
Grade 8 Music and Arts Module
Grade 8 Music and Arts ModuleGrade 8 Music and Arts Module
Grade 8 Music and Arts Module
Andrew Cabugason
 

En vedette (7)

Luke Kanies Keynote: Nearly a Decade of Puppet: What We've Learned and Where ...
Luke Kanies Keynote: Nearly a Decade of Puppet: What We've Learned and Where ...Luke Kanies Keynote: Nearly a Decade of Puppet: What We've Learned and Where ...
Luke Kanies Keynote: Nearly a Decade of Puppet: What We've Learned and Where ...
 
To the Future! - Goals for Puppet 4 - PuppetConf 2014
To the Future! - Goals for Puppet 4 - PuppetConf 2014To the Future! - Goals for Puppet 4 - PuppetConf 2014
To the Future! - Goals for Puppet 4 - PuppetConf 2014
 
Puppet Language 4.0 - PuppetConf 2014
Puppet Language 4.0 - PuppetConf 2014Puppet Language 4.0 - PuppetConf 2014
Puppet Language 4.0 - PuppetConf 2014
 
Killer R10K Workflow - PuppetConf 2014
Killer R10K Workflow - PuppetConf 2014Killer R10K Workflow - PuppetConf 2014
Killer R10K Workflow - PuppetConf 2014
 
Puppet at GitHub - PuppetConf 2013
Puppet at GitHub - PuppetConf 2013Puppet at GitHub - PuppetConf 2013
Puppet at GitHub - PuppetConf 2013
 
MAPEH (ARTS) Grade 8-NARRA, Wayang Kulit
MAPEH (ARTS) Grade 8-NARRA, Wayang KulitMAPEH (ARTS) Grade 8-NARRA, Wayang Kulit
MAPEH (ARTS) Grade 8-NARRA, Wayang Kulit
 
Grade 8 Music and Arts Module
Grade 8 Music and Arts ModuleGrade 8 Music and Arts Module
Grade 8 Music and Arts Module
 

Similaire à Performance Tuning Your Puppet Infrastructure - PuppetConf 2014

Similaire à Performance Tuning Your Puppet Infrastructure - PuppetConf 2014 (20)

Advanced technic for OS upgrading in 3 minutes
Advanced technic for OS upgrading in 3 minutesAdvanced technic for OS upgrading in 3 minutes
Advanced technic for OS upgrading in 3 minutes
 
Large-scaled Deploy Over 100 Servers in 3 Minutes
Large-scaled Deploy Over 100 Servers in 3 MinutesLarge-scaled Deploy Over 100 Servers in 3 Minutes
Large-scaled Deploy Over 100 Servers in 3 Minutes
 
Improving Operations Efficiency with Puppet
Improving Operations Efficiency with PuppetImproving Operations Efficiency with Puppet
Improving Operations Efficiency with Puppet
 
Regain Control Thanks To Prometheus
Regain Control Thanks To PrometheusRegain Control Thanks To Prometheus
Regain Control Thanks To Prometheus
 
Treasure Data Summer Internship 2016
Treasure Data Summer Internship 2016Treasure Data Summer Internship 2016
Treasure Data Summer Internship 2016
 
Puppet getting started by Dirk Götz
Puppet getting started by Dirk GötzPuppet getting started by Dirk Götz
Puppet getting started by Dirk Götz
 
PaaSTA: Autoscaling at Yelp
PaaSTA: Autoscaling at YelpPaaSTA: Autoscaling at Yelp
PaaSTA: Autoscaling at Yelp
 
Scaling to-5000-nodes
Scaling to-5000-nodesScaling to-5000-nodes
Scaling to-5000-nodes
 
Puppet Camp New York 2015: Puppet Enterprise Scaling Lessons Learned (Interme...
Puppet Camp New York 2015: Puppet Enterprise Scaling Lessons Learned (Interme...Puppet Camp New York 2015: Puppet Enterprise Scaling Lessons Learned (Interme...
Puppet Camp New York 2015: Puppet Enterprise Scaling Lessons Learned (Interme...
 
Puppet Camp NYC 2014: Build a Modern Infrastructure in 45 min!
Puppet Camp NYC 2014: Build a Modern Infrastructure in 45 min!Puppet Camp NYC 2014: Build a Modern Infrastructure in 45 min!
Puppet Camp NYC 2014: Build a Modern Infrastructure in 45 min!
 
SCM Puppet: from an intro to the scaling
SCM Puppet: from an intro to the scalingSCM Puppet: from an intro to the scaling
SCM Puppet: from an intro to the scaling
 
From SaltStack to Puppet and beyond...
From SaltStack to Puppet and beyond...From SaltStack to Puppet and beyond...
From SaltStack to Puppet and beyond...
 
Capistrano, Puppet, and Chef
Capistrano, Puppet, and ChefCapistrano, Puppet, and Chef
Capistrano, Puppet, and Chef
 
BPMS1
BPMS1BPMS1
BPMS1
 
BPMS1
BPMS1BPMS1
BPMS1
 
PaaSTA: Running applications at Yelp
PaaSTA: Running applications at YelpPaaSTA: Running applications at Yelp
PaaSTA: Running applications at Yelp
 
Ansible benelux meetup - Amsterdam 27-5-2015
Ansible benelux meetup - Amsterdam 27-5-2015Ansible benelux meetup - Amsterdam 27-5-2015
Ansible benelux meetup - Amsterdam 27-5-2015
 
Puppet slides for intelligrape
Puppet slides for intelligrapePuppet slides for intelligrape
Puppet slides for intelligrape
 
Puppet Development Workflow
Puppet Development WorkflowPuppet Development Workflow
Puppet Development Workflow
 
Using Puppet in Small Infrastructures
Using Puppet in Small InfrastructuresUsing Puppet in Small Infrastructures
Using Puppet in Small Infrastructures
 

Plus de Puppet

Puppet camp2021 testing modules and controlrepo
Puppet camp2021 testing modules and controlrepoPuppet camp2021 testing modules and controlrepo
Puppet camp2021 testing modules and controlrepo
Puppet
 
2021 04-15 operational verification (with notes)
2021 04-15 operational verification (with notes)2021 04-15 operational verification (with notes)
2021 04-15 operational verification (with notes)
Puppet
 
Enforce compliance policy with model-driven automation
Enforce compliance policy with model-driven automationEnforce compliance policy with model-driven automation
Enforce compliance policy with model-driven automation
Puppet
 

Plus de Puppet (20)

Puppet camp2021 testing modules and controlrepo
Puppet camp2021 testing modules and controlrepoPuppet camp2021 testing modules and controlrepo
Puppet camp2021 testing modules and controlrepo
 
Puppetcamp r10kyaml
Puppetcamp r10kyamlPuppetcamp r10kyaml
Puppetcamp r10kyaml
 
2021 04-15 operational verification (with notes)
2021 04-15 operational verification (with notes)2021 04-15 operational verification (with notes)
2021 04-15 operational verification (with notes)
 
Puppet camp vscode
Puppet camp vscodePuppet camp vscode
Puppet camp vscode
 
Modules of the twenties
Modules of the twentiesModules of the twenties
Modules of the twenties
 
Applying Roles and Profiles method to compliance code
Applying Roles and Profiles method to compliance codeApplying Roles and Profiles method to compliance code
Applying Roles and Profiles method to compliance code
 
KGI compliance as-code approach
KGI compliance as-code approachKGI compliance as-code approach
KGI compliance as-code approach
 
Enforce compliance policy with model-driven automation
Enforce compliance policy with model-driven automationEnforce compliance policy with model-driven automation
Enforce compliance policy with model-driven automation
 
Keynote: Puppet camp compliance
Keynote: Puppet camp complianceKeynote: Puppet camp compliance
Keynote: Puppet camp compliance
 
Automating it management with Puppet + ServiceNow
Automating it management with Puppet + ServiceNowAutomating it management with Puppet + ServiceNow
Automating it management with Puppet + ServiceNow
 
Puppet: The best way to harden Windows
Puppet: The best way to harden WindowsPuppet: The best way to harden Windows
Puppet: The best way to harden Windows
 
Simplified Patch Management with Puppet - Oct. 2020
Simplified Patch Management with Puppet - Oct. 2020Simplified Patch Management with Puppet - Oct. 2020
Simplified Patch Management with Puppet - Oct. 2020
 
Accelerating azure adoption with puppet
Accelerating azure adoption with puppetAccelerating azure adoption with puppet
Accelerating azure adoption with puppet
 
Puppet catalog Diff; Raphael Pinson
Puppet catalog Diff; Raphael PinsonPuppet catalog Diff; Raphael Pinson
Puppet catalog Diff; Raphael Pinson
 
ServiceNow and Puppet- better together, Kevin Reeuwijk
ServiceNow and Puppet- better together, Kevin ReeuwijkServiceNow and Puppet- better together, Kevin Reeuwijk
ServiceNow and Puppet- better together, Kevin Reeuwijk
 
Take control of your dev ops dumping ground
Take control of your  dev ops dumping groundTake control of your  dev ops dumping ground
Take control of your dev ops dumping ground
 
100% Puppet Cloud Deployment of Legacy Software
100% Puppet Cloud Deployment of Legacy Software100% Puppet Cloud Deployment of Legacy Software
100% Puppet Cloud Deployment of Legacy Software
 
Puppet User Group
Puppet User GroupPuppet User Group
Puppet User Group
 
Continuous Compliance and DevSecOps
Continuous Compliance and DevSecOpsContinuous Compliance and DevSecOps
Continuous Compliance and DevSecOps
 
The Dynamic Duo of Puppet and Vault tame SSL Certificates, Nick Maludy
The Dynamic Duo of Puppet and Vault tame SSL Certificates, Nick MaludyThe Dynamic Duo of Puppet and Vault tame SSL Certificates, Nick Maludy
The Dynamic Duo of Puppet and Vault tame SSL Certificates, Nick Maludy
 

Dernier

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Dernier (20)

DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 

Performance Tuning Your Puppet Infrastructure - PuppetConf 2014

  • 1. Performance Tuning Your (Puppet) Infrastructure Nic Benders OWNING http://nicbenders.com/presentations/puppetconf-2014
  • 2. I work at New Relic. ! This is a story about treating your infrastructure the same way you treat your applications. ! This is also a story about how we use New Relic, at New Relic. http://nicbenders.com/presentations/puppetconf-2014
  • 3. Managing Our Applications • Source Control • Continuous Deployment • Performance Monitoring • Operational Analytics • Log Collection GitHub with Pull Requests Jenkins + Capistrano New Relic APM New Relic Insights Heka + ElasticSearch + Kibana
  • 4. Managing Our Infrastructure • Source Control • Continuous Deployment • Performance Monitoring • Operational Analytics • Log Collection GitHub with Pull Requests Jenkins + Capistrano New Relic APM New Relic Insights Heka + ElasticSearch + Kibana
  • 6.
  • 8.
  • 10. DON’T PANIC • These example are for Puppet Enterprise 3.1, but this will work with Puppet Open Source, or with newer versions. You’ll just need to make a few changes here and there. • If you don’t have a New Relic account, you can sign-up for a free “Lite” account. • All of the examples are up in a more useful format at the URL below. (The URL will also be shown at the end of the presentation.) http://nicbenders.com/presentations/puppetconf-2014
  • 11. Instrumenting the Puppet Master • Install newrelic_rpm using the Puppet’s Ruby interpreter • Modify the config.ru in the Puppet Master root dir • Create a newrelic.yml in the same directory # /var/opt/lib/pe-­‐puppetmaster/config.ru ! # Setup the New Relic Ruby Agent before anything else require 'rubygems' require 'newrelic_rpm' # END New Relic Ruby Agent setup # /var/opt/lib/pe-­‐puppetmaster/newrelic.yml ! common: &default_settings license_key: '000-­‐your-­‐license-­‐key-­‐here-­‐000' app_name: "Puppet Master" log_level: info log_file_path: '/var/log/pe-­‐puppet/' ssl: false capture_params: true transaction_tracer: enabled: true error_collector: enabled: true ignore_errors: "ActionController::RoutingError" production: <<: *default_settings monitor_mode: true
  • 12.
  • 13. Getting good transaction names • Use set_transaction_name in a Rack Middleware to tell the Ruby Agent how we are going to name the “web transactions” for the Puppet Master • Use add_custom_parameters to pass the environment and other useful data along # # We don't want every transaction to just say "call", so define a # Transaction "namer" for the Ruby Agent based on the URL structure # class CoolNamer def initialize(app, opts = {}) @app = app end def call(env) req = Rack::Request.new(env) _, environment, kind_of_thing, resource = req.path.split('/',4) NewRelic::Agent.set_transaction_name(kind_of_thing, :category => :rack) NewRelic::Agent.add_custom_parameters(:puppet_env => environment) NewRelic::Agent.add_custom_parameters(:puppet_resource => resource) @app.call(env) end end use CoolNamer # END Transaction "namer"
  • 14.
  • 15. Getting more detail • The Ruby Agent’s MethodTracer allows us to get details of what is going on inside a Transaction. • By hooking into Puppet’s built-in Profiler calls, we can quickly instrument all the most important things. • This example is for Puppet 3.3.1. In newer versions it is much easier. require "puppet/util/profiler" module Puppet::Util::Profiler include ::NewRelic::Agent::MethodTracer self.profile(message, &block) if /^Processed request def / === message # Top level trace, skip for now yield else metric_name = self.message_to_metric(message) trace_execution_scoped([metric_name]) do yield end end end def self.message_to_metric(message) message.chomp! message.gsub!(/^(Compiled catalog) for .*/, '1') message.gsub!(/^(Filtered result for catalog) .*/, '1') message.gsub!(/(d+) /, '') message.gsub!(/^(Evaluated resource) /, '1/') message.gsub!(/[.*]/,'') message.gsub!(/:s/,'/') message.gsub!(/^(Called) /, '1/') "Custom/Puppet/#{message}" end end
  • 16.
  • 17. Instrumenting the Puppet DB • Download the Java Agent from your “Account Settings” page. • Create an /opt/puppet/newrelic dir and place the newrelic.jar and newrelic.yaml file into it. • Modify the newrelic.yaml • Modify JAVA_ARGS # /etc/syslog/pe-­‐puppetdb ! # Enable the New Relic Java Agent by adding this # to the bottom of the file JAVA_ARGS="-­‐javaagent:/opt/puppet/newrelic/newrelic.jar ${JAVA_ARGS}" # /opt/puppet/newrelic/newrelic.yml ! common: &default_settings license_key: '000-­‐your-­‐license-­‐key-­‐here-­‐000' ! app_name: 'Puppet DB' log_level: info log_file_path: /var/log/pe-­‐puppetdb/ ssl: false transaction_tracer: enabled: true transaction_threshold: apdex_f record_sql: obfuscated stack_trace_threshold: 0.2 explain_enabled: true explain_threshold: 0.2 browser_monitoring: auto_instrument: false production: <<: *default_settings
  • 18.
  • 19.
  • 20.
  • 23. Puppet Agent already goes into Syslog • Agent syslogs have a ton of useful information. We just need to get it to a useful place. • Our application and syslog data is collected by a Heka process on each server. It then makes its way to ElasticSearch, where it can be queried by Kibana.
  • 24. Send run reports to the same place • Add your log system as a Report processor! • We use https://github.com/ logstash/puppet-logstash-reporter • To get the data into Heka, we had to write some Lua, but it was pretty straightforward.
  • 25. pe_puppet::master::config_hash: reports: 'http,puppetdb,logstash' ! logstash_reporter::logstash_host: 'our-­‐heka-­‐server' # Logstash-­‐style report processer through Heka class { 'logstash_reporter': logstash_port => '22253', logstash_host => hiera('logstash_reporter::logstash_host'), }
  • 26. Managing Our Infrastructure • Source Control • Continuous Deployment • Performance Monitoring • Operational Analytics • Log Collection GitHub with Pull Requests Jenkins + Capistrano New Relic APM New Relic Insights Heka + ElasticSearch + Kibana
  • 27. We’re Hiring Site Reliability Engineers MySQL Experts Engineering Managers Data Pipeline Engineers newrelic.com/about/careers