Welcome!

AppDynamics the World Leader in APM and DevOps

AppDynamics Blog

Subscribe to AppDynamics Blog: eMailAlertsEmail Alerts
Get AppDynamics Blog via: homepageHomepage mobileMobile rssRSS facebookFacebook twitterTwitter linkedinLinkedIn


Related Topics: Enterprise Application Performance

Blog Feed Post

Instrumenting C/C++ application performance monitoring

image_pdfimage_print

With the AppDynamics Winter ’16 Release, AppDynamics now supports monitoring of C/C++ applications via a monitoring SDK that enables the same real-time, end-to-end, user-to-database performance visibility as other supported languages, for rapid root-cause analysis and issue resolution.

C/C++ has been around a while, and it’s regarded as the language for high-performance applications primarily because it compiles to machine code and directly interfaces with the operating system without an intermediate layer.

While the application complexity has exploded over the years and modern languages have evolved and become more popular due to various reasons, C/C++ based applications are still a core part of business critical application environment for many enterprises. As these applications become increasingly critical to the business, it’s more important than ever to have a simple, yet fast way to monitor, diagnose, and resolve application problems before they affect revenue.

Introducing AppDynamics C/C++ Application Performance Management Module

AppDynamics C/C++ Application Performance Management (APM) module provides end-to-end business transaction-centric management of C/C++ applications in the most complex and distributed environments to deliver exceptional user experience by proactively identifying and resolving performance issues.

As a key module of AppDynamics Application Intelligence Platform, C/C++ APM module monitors the C/C++ applications via a monitoring SDK that enables the same real-time, end-to-end, user-to-database performance visibility as other supported languages, for rapid root-cause analysis and issue resolution.

cpp-application-performance-monitoring-Fig1.png

Fig 1: C/C++ Application Performance Monitoring

You can instrument your C/C++ application code using the SDK, recompile the code and deploy in production to get real-time visibility of performance and find the root cause of code bottlenecks in seconds, all with minimal overhead. AppDynamics C/C++ application monitoring SDK enables automatic discovery and mapping of all tiers that service and interact with the C/C++ applications, automatic dynamic baselining, data collectors, and health rules, as well as managing key metrics including application load and response times, and system resources including CPU, memory, and disk I/O.

Instrumenting C/C++ application for monitoring

It’s pretty straightforward to instrument a C/C++ application code for defining and monitoring business transactions, capturing snapshots, distributed transaction correlation, backend monitoring, error Monitoring and collecting data from methods.

For example, in order to define and monitor a business transaction like what you see in Fig 1, you just need to enclose the code that constitutes the request that you want to monitor between appd_bt_begin() and appd_bt_end()calls. Please see code sample before and after instrumentation below where you will notice just two line of code required to get the code monitored as a business transaction.

Example of code before instrumentation:

AccountOpResult AccountMgr::CreateAccount(const std::string& username, const std::string& password)
{
    AccountOpResult result = AOR_OK;
    if (utf8length(username) > MAX_ACCOUNT_STR)
    {
        result = AOR_NAME_TOO_LONG;
    }
    else if (GetId(username))
    {
        result = AOR_NAME_ALREADY_EXISTS;
    }
    else if (!loginDB.PExecute("INSERT INTO account(username,pass_hash) VALUES('%s','%s')", username, CalculatePassHash(password)))
    {
        result = AOR_DB_INTERNAL_ERROR;
    }
    return result;
} 

Example of code after instrumentation:

AccountOpResult AccountMgr::CreateAccount(const std::string& username, const std::string& password)
{
    AccountOpResult result = AOR_OK;

 appd_bt_handle bt = appd_bt_begin(__func__, NULL);

    if (utf8length(username) > MAX_ACCOUNT_STR)
    {
        result = AOR_NAME_TOO_LONG;
    }
    else if (GetId(username))
    {
        result = AOR_NAME_ALREADY_EXISTS;
    }
    else if (!loginDB.PExecute("INSERT INTO account(username,pass_hash) VALUES('%s','%s')", username, CalculatePassHash(password)))
    {
        result = AOR_DB_INTERNAL_ERROR;
    }
 appd_bt_end(bt);
    return result;
} 

appd_bt_begin() returns a handle to use in subsequent routines that affect that business transaction. If you are creating a business transaction that correlates with an upstream business transaction, pass the correlation header of the upstream transaction so the new transaction that you are creating can correlate with it.

By inserting similar code, you can do distributed transaction correlation, backend monitoring, error monitoring and collect data (key/value) from methods

Hopefully this gives you an overview of C++ monitoring solution and gets you started. Learn more about the configuration, instrumentation and additional details of the C/C++ monitoring SDK in the AppDynamics documentation.

The post Instrumenting C/C++ application performance monitoring appeared first on Application Performance Monitoring Blog | AppDynamics.

Read the original blog entry...

More Stories By AppDynamics Blog

In high-production environments where release cycles are measured in hours or minutes — not days or weeks — there's little room for mistakes and no room for confusion. Everyone has to understand what's happening, in real time, and have the means to do whatever is necessary to keep applications up and running optimally.

DevOps is a high-stakes world, but done well, it delivers the agility and performance to significantly impact business competitiveness.