PHP, Node.js and Python Deep Dive
Omed Habib, Product Marketing
Agenda
2015
PHP
Node.js
Copyright © 2015 AppDynamics. All rights reserved. 2
Python
Developer Trends
4.2 Sneak Peak
2015 IN REVIEW
4.1 for PHP
Cross App Correlation
Backend Naming Rules
HTTP Data Collectors
PHP 5.6
API Functions
Copyright © 2015 AppDynamics. All rights reserved. 4
4.1 for Node.js
Error Detection Using HTTP Return Codes
Node.js Backends Discovery & Grouping Rules
Object Instance Tracking
Node.js 0.12
API Functions
Copyright © 2015 AppDynamics. All rights reserved. 5
4.1 for Python
Distributed Transaction Correlation
Cross-App Correlation
Custom Match/Exclude Rules
Linux & Mac
OOTB WSGI Framework Support
API Functions
Copyright © 2015 AppDynamics. All rights reserved. 6
PHP DEEP DIVE
Challenge
Multiple PHP “applications” on a
single server
Copyright © 2015 AppDynamics. All rights reserved. 8
api.acme.com
login.acme.com
admin.acme.com
www.acme.com
Copyright © 2015 AppDynamics. All rights reserved. 9
Before
n applications on the same server
=
1 application in AppDynamics
Copyright © 2015 AppDynamics. All rights reserved. 10
Today
n applications on the same server
=
n applications in AppDynamics
Copyright © 2015 AppDynamics. All rights reserved. 11
Copyright © 2015 AppDynamics. All rights reserved. 12
Before
appdynamics_agent.ini
Copyright © 2015 AppDynamics. All rights reserved. 13
Today
appdynamics_agent.ini
httpd.conf
.htaccess
Copyright © 2015 AppDynamics. All rights reserved. 14
More Flexibility with (same) Configs
agent.controller.hostName
agent.controller.port
agent.applicationName
agent.tierName
agent.nodeName
agent.accountName
agent.accountAccessKey
Copyright © 2015 AppDynamics. All rights reserved. 15
Two Separate Apps, Same Server
<VirtualHost *:80>
DocumentRoot "/Library/WebServer/Documents"
ServerName localhost
ErrorLog "/private/var/log/apache2/error_log"
CustomLog "/private/var/log/apache2/access_log" common
php_value agent.applicationName FrontEnd
php_value agent.tierName FrontTier
php_value agent.nodeName front-node1
</VirtualHost>
Copyright © 2015 AppDynamics. All rights reserved. 16
<VirtualHost *:80>
DocumentRoot "/var/www"
ServerName test.local
<Directory "/var/www">
Options FollowSymLinks Multiviews
AllowOverride Options
Require all granted
</Directory>
ErrorLog "/private/var/log/apache2/error_log"
CustomLog "/private/var/log/apache2/access_log" common
php_value agent.applicationName API
php_value agent.tierName APItier
php_value agent.nodeName api-node1
</VirtualHost>
Copyright © 2015 AppDynamics. All rights reserved. 17
Copyright © 2015 AppDynamics. All rights reserved. 18
Copyright © 2015 AppDynamics. All rights reserved. 19
Multi-Node Support for PHP
Few points to consider…
•  Available for beta after AppSphere
•  4.2 Controller is recommended
•  All apps will share same proxy on server
•  Licenses will stay same (per node) until adjusted
•  Currently in beta, hoping to GA in 4.2
•  Proxy functionality will be replaced with LibAgent in 2016
Copyright © 2015 AppDynamics. All rights reserved. 21
NODE.JS DEEP DIVE
Challenge
Heavy Memory Consumption by
the Node.js Application
Copyright © 2015 AppDynamics. All rights reserved. 23
Memory Leak Diagnostics
V8 Manages Memory
Pro
•  You don’t have to worry
about it.
•  You don’t have to write
code to manage it.
Con
•  You don’t have control
over it.
•  You have to find a way to
find your memory leak.
Copyright © 2015 AppDynamics. All rights reserved. 25
Copyright © 2015 AppDynamics. All rights reserved. 26
Copyright © 2015 AppDynamics. All rights reserved. 27
Copyright © 2015 AppDynamics. All rights reserved. 28
“I can actually say we've had no outages
in production on a Node.js cluster, since
we've been porting over, and I can credit
a large part of that due to the monitoring
of AppDynamics.”
Stace Baal, Director of Engineering
@ eHarmony
Copyright © 2015 AppDynamics. All rights reserved. 29
PYTHON DEEP DIVE
Challenge
A Python Application Executing
Jobs in an Infinite While Loop
Copyright © 2015 AppDynamics. All rights reserved. 31
The Loop
setup()
while (true):
do_work()
teardown()
Copyright © 2015 AppDynamics. All rights reserved. 32
Python Agent API Functions
Copyright © 2015 AppDynamics. All rights reserved. 33
Functions made available
to the application code to
further tailor your APM
solution.
Copyright © 2015 AppDynamics. All rights reserved. 34
from	
  appdynamics.agent	
  import	
  api	
  as	
  appd	
  	
  	
  	
  	
  	
  	
  	
  	
  
setup()	
  
	
  	
  	
  
while	
  (true):	
  
bt_handle	
  =	
  appd.start_bt('do	
  work’)	
  
try:	
  
	
  	
  	
  	
  do_work()	
  
except	
  Exception	
  as	
  exc:	
  
	
  	
  	
  	
  raise	
  
finally:	
  
	
  	
  	
  	
  appd.end_bt(bt_handle,	
  exc)	
  
	
  	
  
teardown()	
  
Custom Exit Calls
Copyright © 2015 AppDynamics. All rights reserved. 35
start_exit_call()
…
end_exit_call()
API Functions
Copyright © 2015 AppDynamics. All rights reserved. 36
•  init(environ=None, timeout_ms=NO_TIMEOUT)
•  shutdown(timeout_ms=None)
•  start_bt(name, correlation_header=None)
•  end_bt(bt_handle, exc=None)
•  add_snapshot_data(bt_handle, key, value)
•  get_active_bt_handle(request)
•  start_exit_call(bt_handle, exit_type, display_name,
identifying_properties, optional_properties=None)
•  end_exit_call(exit_call_handle, exc=None)
•  make_correlation_header(bt_handle, exit_call_handle)
•  bt(name, correlation_header=None)
•  exit_call(bt_handle, exit_type, display_name, identifying_properties,
optional_properties=None)
Copyright © 2015 AppDynamics. All rights reserved. 37
By The Way...
API Functions Are Available Today For
“The new Python agent by AppDynamics
brought the visibility that we’ve come to
expect from the AppDynamics Platform. It
didn't take long for us to qualify that this was
the solution for our deployments of over 3,000
Python instances”
Albert Kemner, Principal Engineer @ Gannett
Copyright © 2015 AppDynamics. All rights reserved. 38
Copyright © 2015 AppDynamics. All rights reserved. 39
DEVELOPER TRENDS
Decoupling Architecture
+
Mindset
=
Merging Teams
Copyright © 2015 AppDynamics. All rights reserved. 41
WHAT’S COMING IN 4.2?
4.2 Roadmap Goal
•  Multi-Node Support
•  SELinux
•  NuSOAP Exit Calls
•  PostgreSQL
Copyright © 2015 AppDynamics. All rights reserved. 43
•  Node.js 4.0 & 5.0
•  Allocation Snapshots
•  Transaction Analytics
•  Heroku Support
•  Windows Support
•  EUM Correlation
•  API Functions
•  Data Collectors
•  MongoDB
Thank You

AppSphere 15 - PHP, Node.js and Python Deep Dive

  • 1.
    PHP, Node.js andPython Deep Dive Omed Habib, Product Marketing
  • 2.
    Agenda 2015 PHP Node.js Copyright © 2015AppDynamics. All rights reserved. 2 Python Developer Trends 4.2 Sneak Peak
  • 3.
  • 4.
    4.1 for PHP CrossApp Correlation Backend Naming Rules HTTP Data Collectors PHP 5.6 API Functions Copyright © 2015 AppDynamics. All rights reserved. 4
  • 5.
    4.1 for Node.js ErrorDetection Using HTTP Return Codes Node.js Backends Discovery & Grouping Rules Object Instance Tracking Node.js 0.12 API Functions Copyright © 2015 AppDynamics. All rights reserved. 5
  • 6.
    4.1 for Python DistributedTransaction Correlation Cross-App Correlation Custom Match/Exclude Rules Linux & Mac OOTB WSGI Framework Support API Functions Copyright © 2015 AppDynamics. All rights reserved. 6
  • 7.
  • 8.
    Challenge Multiple PHP “applications”on a single server Copyright © 2015 AppDynamics. All rights reserved. 8
  • 9.
  • 10.
    Before n applications onthe same server = 1 application in AppDynamics Copyright © 2015 AppDynamics. All rights reserved. 10
  • 11.
    Today n applications onthe same server = n applications in AppDynamics Copyright © 2015 AppDynamics. All rights reserved. 11
  • 12.
    Copyright © 2015AppDynamics. All rights reserved. 12
  • 13.
    Before appdynamics_agent.ini Copyright © 2015AppDynamics. All rights reserved. 13
  • 14.
  • 15.
    More Flexibility with(same) Configs agent.controller.hostName agent.controller.port agent.applicationName agent.tierName agent.nodeName agent.accountName agent.accountAccessKey Copyright © 2015 AppDynamics. All rights reserved. 15
  • 16.
    Two Separate Apps,Same Server <VirtualHost *:80> DocumentRoot "/Library/WebServer/Documents" ServerName localhost ErrorLog "/private/var/log/apache2/error_log" CustomLog "/private/var/log/apache2/access_log" common php_value agent.applicationName FrontEnd php_value agent.tierName FrontTier php_value agent.nodeName front-node1 </VirtualHost> Copyright © 2015 AppDynamics. All rights reserved. 16 <VirtualHost *:80> DocumentRoot "/var/www" ServerName test.local <Directory "/var/www"> Options FollowSymLinks Multiviews AllowOverride Options Require all granted </Directory> ErrorLog "/private/var/log/apache2/error_log" CustomLog "/private/var/log/apache2/access_log" common php_value agent.applicationName API php_value agent.tierName APItier php_value agent.nodeName api-node1 </VirtualHost>
  • 17.
    Copyright © 2015AppDynamics. All rights reserved. 17
  • 18.
    Copyright © 2015AppDynamics. All rights reserved. 18
  • 19.
    Copyright © 2015AppDynamics. All rights reserved. 19
  • 20.
  • 21.
    Few points toconsider… •  Available for beta after AppSphere •  4.2 Controller is recommended •  All apps will share same proxy on server •  Licenses will stay same (per node) until adjusted •  Currently in beta, hoping to GA in 4.2 •  Proxy functionality will be replaced with LibAgent in 2016 Copyright © 2015 AppDynamics. All rights reserved. 21
  • 22.
  • 23.
    Challenge Heavy Memory Consumptionby the Node.js Application Copyright © 2015 AppDynamics. All rights reserved. 23
  • 24.
  • 25.
    V8 Manages Memory Pro • You don’t have to worry about it. •  You don’t have to write code to manage it. Con •  You don’t have control over it. •  You have to find a way to find your memory leak. Copyright © 2015 AppDynamics. All rights reserved. 25
  • 26.
    Copyright © 2015AppDynamics. All rights reserved. 26
  • 27.
    Copyright © 2015AppDynamics. All rights reserved. 27
  • 28.
    Copyright © 2015AppDynamics. All rights reserved. 28
  • 29.
    “I can actuallysay we've had no outages in production on a Node.js cluster, since we've been porting over, and I can credit a large part of that due to the monitoring of AppDynamics.” Stace Baal, Director of Engineering @ eHarmony Copyright © 2015 AppDynamics. All rights reserved. 29
  • 30.
  • 31.
    Challenge A Python ApplicationExecuting Jobs in an Infinite While Loop Copyright © 2015 AppDynamics. All rights reserved. 31
  • 32.
    The Loop setup() while (true): do_work() teardown() Copyright© 2015 AppDynamics. All rights reserved. 32
  • 33.
    Python Agent APIFunctions Copyright © 2015 AppDynamics. All rights reserved. 33 Functions made available to the application code to further tailor your APM solution.
  • 34.
    Copyright © 2015AppDynamics. All rights reserved. 34 from  appdynamics.agent  import  api  as  appd                   setup()         while  (true):   bt_handle  =  appd.start_bt('do  work’)   try:          do_work()   except  Exception  as  exc:          raise   finally:          appd.end_bt(bt_handle,  exc)       teardown()  
  • 35.
    Custom Exit Calls Copyright© 2015 AppDynamics. All rights reserved. 35 start_exit_call() … end_exit_call()
  • 36.
    API Functions Copyright ©2015 AppDynamics. All rights reserved. 36 •  init(environ=None, timeout_ms=NO_TIMEOUT) •  shutdown(timeout_ms=None) •  start_bt(name, correlation_header=None) •  end_bt(bt_handle, exc=None) •  add_snapshot_data(bt_handle, key, value) •  get_active_bt_handle(request) •  start_exit_call(bt_handle, exit_type, display_name, identifying_properties, optional_properties=None) •  end_exit_call(exit_call_handle, exc=None) •  make_correlation_header(bt_handle, exit_call_handle) •  bt(name, correlation_header=None) •  exit_call(bt_handle, exit_type, display_name, identifying_properties, optional_properties=None)
  • 37.
    Copyright © 2015AppDynamics. All rights reserved. 37 By The Way... API Functions Are Available Today For
  • 38.
    “The new Pythonagent by AppDynamics brought the visibility that we’ve come to expect from the AppDynamics Platform. It didn't take long for us to qualify that this was the solution for our deployments of over 3,000 Python instances” Albert Kemner, Principal Engineer @ Gannett Copyright © 2015 AppDynamics. All rights reserved. 38
  • 39.
    Copyright © 2015AppDynamics. All rights reserved. 39
  • 40.
  • 41.
    Decoupling Architecture + Mindset = Merging Teams Copyright© 2015 AppDynamics. All rights reserved. 41
  • 42.
  • 43.
    4.2 Roadmap Goal • Multi-Node Support •  SELinux •  NuSOAP Exit Calls •  PostgreSQL Copyright © 2015 AppDynamics. All rights reserved. 43 •  Node.js 4.0 & 5.0 •  Allocation Snapshots •  Transaction Analytics •  Heroku Support •  Windows Support •  EUM Correlation •  API Functions •  Data Collectors •  MongoDB
  • 44.