Modern SaaS applications are architected and deployed as a bunch of high-performing, loosely coupled microservices tied together with APIs, which help power interactions and functionalities between these services.
API usage is exploding across all industries, with more organizations using an API-first approach to create innovative new products and solutions and to accelerate development and go-to-market cycles. APIs come in a number of flavors — from Private APIs that help integrate application components to Partner APIs for strategic business partner integrations, to publicly available Public/Open APIs for external integrations.
Why monitor APIs?
With so many APIs deployed around us — and with external users and customers depending upon them for business functionality and data — it’s imperative to know that APIs are:
- Available when required.
- Functioning properly.
- Responding within time as per your service-level agreements (SLAs).
- Scaling and performing as designed.
With AppDynamics Synthetic API Monitoring, our customers can proactively:
- Validate API functionality, responses, SLAs and more.
- Test API workflow by chaining multiple requests.
- Analyze network stats such as wait time, and TCP and DNS-resolution times, in an API call.
- Be notified via alerts based on API uptime and SLA breaches.
Synthetic web monitoring versus API monitoring
AppDynamics offers Browser Synthetic Monitoring for baselining the performance and availability of web applications. This provides visibility into availability, correctness and performance issues.
Web monitoring focuses on observing the synthetic user experience of web applications from a given location. It provides key insights such as:
- DOM-readiness of a monitored web page.
- Page resource (CSS HTML, scripts, images, etc.) load times.
- Visual completeness of a page.
It also automates the scheduled execution of a customer-defined script from various locations and uses browser automation to baseline and benchmark the experience synthetically.
The monitoring script can also use browser automation to test APIs in a similar fashion. However, the user experience for a web page is very different from an API.
For API testing, web page-specific benchmarking statistics like DOM readiness, resource load times or visual completeness do not make much sense. But network statistics such as DNS resolution, wait time and TCP handshake — as well as API-level details including request size (in bytes), response status code, response header and body size — matter a lot more for APIs since these determine how an API is performing in terms of uptime, correctness and functionality. Users can also receive alerts based on availability and performance thresholds.
These metrics must be presented to customers in a user experience that is relevant to their API-monitoring point of view, hence the need to build a separate user interface to define API-monitoring jobs and visualize API-monitoring statistics through individual dashboards.
AppDynamics Synthetic API Monitoring architecture
Our Synthetic API Monitoring architecture is depicted below. Users access the AppDynamics UI to visualize the performance of their API-monitoring collections and jobs. They also use the UI to create, modify and delete API-monitoring jobs as well as visualize metrics and charts on the dashboards. Alerts are based on health rules configured for API-monitoring jobs.
The intuitive interface also hosts an editor, where users can write scripts for monitoring APIs. These jobs are stored in a config-store, which later gets scheduled for execution based on a user-defined frequency and schedule. Each API-measurement request is then queued to run at the agent location.
The agent locations are separate cloud environments where we host microservices responsible for executing customer API measurements in a Lambda-like architecture, as discussed in our previous blog on synthetic monitoring.
Synthetic API Monitoring agent
We have developed a specific agent for automatic execution of API-monitoring scripts. Why? A web-monitoring agent requires CPU- and memory-intensive operations to determine web page load time and visual completeness. In the case of API monitoring, we do not have to take screenshots to determine visual completeness of a web page.
Our Synthetic API Monitoring agent is lightweight and uses less memory and CPU footprint to run scripts measuring API uptime and responsiveness. It’s also cost-effective in hosting agents in cloud provider locations.
The cost of our Synthetic API Monitoring agent is less than that of our synthetic web-monitoring agent, hence we developed a separate Kubernetes-based Linux agent for API-monitoring use cases.
Additionally, the Synthetic API Monitoring agent allows us to execute synthetic jobs with a frequency of up to one minute.
Monitoring private APIs
Hosted agent locations are capable of monitoring publicly available APIs. But to monitor private APIs, customers need to deploy the Synthetic API Monitoring agent in their private on-prem network.
Once the private-API monitoring agent is deployed and configured in a Kubernetes™ cluster, it appears as an agent location in the synthetic job editor. Users can arrange API-monitoring jobs for this private location by modifying the job schedule. The agent starts receiving measurement requests from the controller cloud based on its schedule. Subsequent execution of API measurements happens on the customer’s private on-prem network, where the agent is able to monitor private APIs hosted there.