6 ways to optimize your API management costs with Apigee
Ankur Srivastava
Customer Engineer, Business Application Platform, Google Cloud
Varun Krovvidi
Product Marketing Manager, Google Cloud
Try Google Cloud
Start building on Google Cloud with $300 in free credits and 20+ always free products.
Free trialIn the current economic climate every organization is faced with a unique triple squeeze from inflation, scarce/expensive talent, and disrupted/constrained global supplies. IT leaders are faced with the challenge of optimizing their spend while continuing the momentum from pandemic forced digitalization. New research shows that in response, organizations are doubling down on cloud, modernizing infrastructure, and migrating even more applications out of on-premise environments. These efforts amplified the adoption and usage of APIs as they are critical to maximize the value from old and new systems.
At Google Cloud we are committed to helping you accelerate the adoption of APIs whilst driving value from your API programs. We recently announced a Pay-as-you-go pricing model to give you the flexibility to manage your API management costs without any upfront commitment. With Pay-as-you-go pricing, you will be charged on your usage of:
- Apigee gateway nodes: a unit of environment that processes API traffic, you are charged on the number of nodes used per minute.
- API analytics: Total number of API requests (Every API proxy call processed by the runtime whether successful or not) processed by Apigee analytics per month.
Beyond these primary drivers, you will also incur charges on networking (eg.network egress) based on usage.
As we welcome more customers to Apigee with our new pricing model, we wanted to share 6 ways you can optimize your API management costs using Apigee. These best practices are intended to help you rightsize your cloud costs to the needs of your business.
#1 Always set maximum value for Apigee Gateway nodes
The Apigee runtime can automatically scale up to 1000 nodes and each gateway node can process up to 300 requests per second (varies according to policies, request/response sizes, backend latencies etc.,). If you are starting small, you probably don’t need to autoscale to such high limits. A maximum value for nodes protects you from excessive costs in the event of an unexpected spike in traffic.
#2 Avoid setting a high value for “minimum nodes” unnecessarily
As success of every modern application is heavily reliant upon its performance, engineering teams focus on fine tuning every aspect of their application. In an attempt to reduce latency during unexpected traffic spikes we have seen a few customers set a high value for “minimum nodes”. Each Apigee gateway node costs $1.025 per hour and these over-provisioning costs can quickly add up. Apigee runtime scales aggressively to help you avoid latency. We have observed scaling from 2k requests per second (RPS) to 20k RPS within minutes and without any increase in the p50/p90 latency (pXX latency - XX% of requests have responses equal to or faster than pXX latency value). Instead of setting arbitrary high values to absorb spikes in demand, we recommend analyzing Apigee gateway node usage (available in Cloud Monitoring) to define an appropriate number of “minimum nodes''. In addition we also recommend configuring alerts on node usage to respond in time for unexpected demand increases.
#3 Avoid manual adjustments to node values
To avoid latency during sudden wall of traffic scenarios (for example: ahead of an ecommerce event like Black Friday) it is a common practice for engineering teams to update minimum and maximum node limits temporarily just a few hours before the expected event. If you are manually adjusting the node limits, you run the risk of incurring over-provisioning costs if you don't scale down the node values in time. Instead of relying on manual adjustments, we recommend automating scheduled adjustments with Apigee’s management APIs. With the management APIs you can embed the adjustments to Apigee nodes into existing workflows designed for the expected traffic spikes.
#4 Secure at the edge to prevent unnecessary charges
Apigee offers a robust set of policies to secure your API traffic. However these policies are executed at runtime where an API request is authenticated or filtered based on the security policy criteria. In both of these scenarios, API requests are processed by Apigee analytics whether they are successful or not. As a result, you also incur partial costs for unsuccessful API requests (As part of Apigee’s Pay-as-you-go pricing you are charged on the total number of requests processed by API analytics).
Consider enforcing security policies at the edge to filter out malicious traffic (based on IP, Geo Region, content, signature, etc) even before it reaches the Apigee runtime. There are many popular edge solutions in the Google Cloud marketplace which can be leveraged to block bot traffic and to protect your endpoints. For example Google Cloud’s web application and API protection (WAAP) solution combines Apigee, Cloud Armor, and reCAPTCHA to provide comprehensive threat protection. Since ingress into Apigee is controlled by a Google Cloud load balancer, the seamless integration between Apigee and Cloud Armor helps detect and drop malicious traffic at the edge of Google Cloud network.
#5 Split existing nodes across multiple regions instead of adding resources
In scenarios where users are distributed across multiple regions, it is a common practice to deploy additional nodes in those regions to maintain high availability. But deploying nodes always comes with an additional cost. If you are scaling across multiple regions and require availability higher than 99.9%, we recommend considering adding regions to your Apigee organization rather than spinning up additional resources. For example if you are already operating more than 4 minimum nodes, you can split them across regions to increase availability while maintaining lower costs (additional analytics charges will still apply based upon the number of requests processed). Note that there is a minimum of two nodes required for each environment provisioned in each region.
#6 Choose the optimal Apigee pricing model
Pay-as-you-go is ideal for customers who want to maintain flexibility and control over their costs, start with no upfront commitments, or need freedom to experiment. If your API program reaches a certain scale (based on # of API calls or gateway nodes), a subscription plan might be a more cost effective alternative for you. For high API volumes or predictable pricing, Apigee offers multiple subscription plans
Estimating your costs and monitoring your usage
Before starting (or even during) your journey with Apigee using Pay-as-you-go pricing, you can evaluate the potential costs in the pricing calculator. Check out examples here to estimate the costs based on your use case.
If you are already using Pay-as-you-go pricing, Apigee provides multiple tools to view your usage, configure billing alerts, estimate billing, and support for billing related questions.
Next steps
Pay-as-you-go is a newer, low-cost entry approach of getting access to Google’s proven Apigee API management platform. As more customers adopt this new model we will continue to find and share tips on maximizing value for a variety of use cases. Learn more about Apigee or get started with Apigee’s Pay-as-you-go pricing in the console.