Hear from our product management and engineering teams about three topics that will help you unlock more value from our dynamic languages agents:
• Diagnosing a slow business transaction in Node.js
• Using the agent APIs to create custom transactions and exit calls
• Getting the Java proxy out of your Docker containers and connecting multiple agents to one proxy
For more information, go to: www.appdynamics.com
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
Getting More Out of the Node.js, PHP, and Python Agents - AppSphere16
1. Microservices, code profiling, and extensibility
Getting more out of the Node.js, PHP, and Python agents
Dave Roth (Engineering Manager, Node.js & .NET)
Dan Koepke (Engineering Manager, Dynamic Languages)
Viktor Gavrielov (Software Engineer, Dynamic Languages)
Rakesh Patel (Product Manager, Dynamic Languages)
6. Dynamic Languages Agent APIs
Extend and customize various aspects of AppDynamics AIP.
• PHP, Python, and Node.js APIs
• C++ and Golang SDK
AppDynamics Confidential and Proprietary 8
7. Dynamic Languages Agent APIs
AppDynamics Agent APIs let you:
• Start and end custom BTs anywhere and anytime
• Start and end custom Exitcalls anywhere and anytime
• Interact with already discovered Backends
• Add your own Backend
AppDynamics Confidential and Proprietary 9
9. Python Agent API
from appdynamics.agent import api as appd
setup()
while sunIsOut:
bt_handle = appd.start_bt('do work')
try:
do_work()
except Exception as exc:
raise
finally:
appd.end_bt(bt_handle, exc)
teardown()
AppDynamics Confidential and Proprietary 11
10. Python Agent API
setup()
while sunIsOut:
with bt('do work'):
do_work()
teardown()
AppDynamics Confidential and Proprietary 12
11. Dynamic Languages Agent APIs
Extend and customize AppDynamics AIP
• PHP, Python, and Node.js APIs
• C++ and Golang SDK
AppDynamics Confidential and Proprietary 13
13. Setting up a multi-tenant
proxy in Docker
Dan Koepke
Engineering Manager, Dynamic Languages
14. Background: Docker
Docker is a tool for easily creating and running containers.
• Containers are lightweight VMs
• Generally single purpose: just my application/service/micro-service
• Simplifies application deployment
– Build container and ship it to the hosts
– Run locally (for dev/test) the same way as in production
• Get the positives of shared hosting without the negatives
– Better resource utilization
– Isolation for security and reliability
AppDynamics Confidential and Proprietary 16
15. Background: Proxy
AppDynamics proxy performs aggregation and reporting for
dynamic language agents.
• Centralizes common agent logic to reduce agent overhead
• Supports multi-process models (e.g., mod_php, Python)
• Multi-tenant for shared hosting
• Currently implemented in Java
• Proxy must run on same host as agent
AppDynamics Confidential and Proprietary 17
16. Dynamic Languages Agent architecture
AppDynamics Confidential and Proprietary 18
Application
AppDynamics Agent AppDynamics Proxy
AppDynamics Controller
IPC
HTTP
17. Containers and AppDynamics
AppDynamics can monitor your containerized applications and
services.
• Bake the agent into the container
• The proxy can also be baked into the container so that it runs inside,
but...
– Need larger containers
– Pay the JVM overhead for each container
• Alternatively, run a single proxy on the host, shared by the containers
– No extra JVM process running in the containers
– No wasted resources
AppDynamics Confidential and Proprietary 19
18. Shared proxy architecture
Docker host
Containerized
Application
AppDynamics Agent
AppDynamics Proxy
AppDynamics Controller
IP
C
Containerized
Application
AppDynamics Agent
IP
C
19. Steps to a shared proxy
Sharing the proxy in four easy steps
• Install the agent(s) on the host
– Need to install the agent for each type of agent used in the containers
– The proxy is specific to each type of agent
• Run the proxy/proxies on the host
• Mount the proxy communication directory as a data volume in your
containers
• Configure the agent to use the volume to communicate to the proxy
AppDynamics Confidential and Proprietary 21
20. Running the proxy
Slightly different for each agent
• Find on the docs site:
o Node.js: http://bit.ly/2eSOcLK
o PHP: http://bit.ly/2eHbGqH
o Python: http://bit.ly/2ewMhj7
• Setup to run automatically when the host starts
• Specify a unique proxy communication directory for each proxy you
run
AppDynamics Confidential and Proprietary 22
21. The proxy host data volume
A data volume is for accessing persistent or shared data across containers
• Specified with the “-v” option to docker create/run
• A host directory can be mapped to a data volume
– Example: “-v /src/foo:/opt/foo”
– Maps host directory “/src/foo” to directory “/opt/foo” within container
• Proxy communication dir is where IPC occurs, passed to proxy on
startup
• For example:
– docker run -d -P --name web -v /tmp/appd:/tmp/appd apps/web supervisor
start web
AppDynamics Confidential and Proprietary 23
23. Diagnosing a slow BT in
Node.js
Dave Roth
Engineering Manager For Node.js & .NET
24. Three sources of latency in Node.js applications
• The event loop is executing code that is part of the BT.
– Where to look: the call graph of a BT snapshot.
• Exit calls to other tiers, DBs, etc.
– Where to look: exit calls tab of a BT snapshot.
• Callbacks sitting in the event loop queue once an async operation is
done (DB call or HTTP call to another tier).
– Where to look: process snapshots tab
AppDynamics Confidential and Proprietary 26
25. Example: identifying latency in a Node.js BT
This BT took 111ms
to execute. Let’s
drill down to
account for the
latency...
AppDynamics Confidential and Proprietary 27
26. Latency source #1: work for this BT
AppDynamics Confidential and Proprietary 28
In this case, 30 ms were spent doing work for this BT in the event loop.
(The call graph often doesn’t show any methods or shows 0ms as its execution time. That is normal and
means that the event loop did not much time executing the BT itself.)
27. Latency source #2: exit calls
AppDynamics Confidential and Proprietary 29
The exit call was done async and very quickly (10 ms).
28. Latency source #3: the event loop
When exit calls come back from the downstream tiers or DBs, Node.js
is notified that their responses are ready to be consumed.
Node.js will then schedule the callback function for each of those exit
calls to run in the next iteration of the event loop.
If the event loop is doing something else, for another BT or otherwise,
those callback functions will sit in the queue and not get called.
This is the third source of latency.
AppDynamics Confidential and Proprietary 30
29. Latency source #3: the event loop
AppDynamics Confidential and Proprietary 31
• Process snapshots capture all event
loop activity during the time the
snapshot is taken.
• Accessible from the overview tab of
a BT snapshot.
30. Latency source #3: the event loop
The process snapshot
begins to reveal where
the event loop is
spending its time.
AppDynamics Confidential and Proprietary 32
31. Latency source #3: the event loop
AppDynamics Confidential and Proprietary 33
Drilling down to find the
offending class...
32. Latency source #3: the event loop
AppDynamics Confidential and Proprietary 34
…and finally the
offending line of
code, in this case a
logging library.
33. Other places to look: metric browser
AppDynamics Confidential and Proprietary 35
The most useful metrics to use in most
situations are:
• Event loop metrics – shows timing info that
can point to problems or stuck event loops.
• Garbage Collection – GC in Node.js pauses
the process so it’s something important to
keep track of.
• Memory – heap metrics show utilization of
the memory by all the objects in the runtime.
34. Using the metric browser to diagnose event loop issues
AppDynamics Confidential and Proprietary 36
• Average IO time – average time spent running
callbacks. Spikes mean the callbacks are
heavy.
• Avg and Max Tick length – how long is the
event loop tacking to go through an iteration. If
tick length spikes and IO time (above) stays
constant, something else is monopolizing the
event loop
• Tick count is a similar metric as it will show how
many times the event loop iterated over a 1-
minute period.
35. For further reference...
1.Come find us at the booths
2.AppDynamics documentation
3.File a support ticket
AppDynamics Confidential and Proprietary 37
37. Please give us your feedback—Session T12705
• Complete the online survey you'll receive via
email later today or via text at:
Text this number: 878787
Text this word: APPSPHERE
• Every time you submit a session survey, your
name will be entered in a random drawing.
We're giving away Amazon Echos
to 5 lucky winners!
• Thank you for your input
APPDYNAMICS CONFIDENTIAL AND PROPRIETARY 39
Win!