API Management
  • 24 Dec 2024
  • 4 Minutes to read
  • Contributors
  • Dark
    Light

API Management

  • Dark
    Light

Article summary

In this article we will look at the factors affecting costs for API Management

Factors that affect cost


  • How many APIM instances do you have

  • Which SKU you choose

  • If you want network integration

  • Gateway choices

  • How much will I log

  • API Backend performance

Things to Think about


How many APIM instances do you have

Over the years there has been a shift in how people are using APIM.  Initially there was a strong trend towards companies having a single instance of APIM which was then used by everyone.  Today, the single central instance pattern is still used in many companies but it is also true that many companies have multiple instances of APIM.  Sometimes it could be an instance per team/department/product.

The reasons behind this decision point are outside of the scope of this playbook but as an architect you need to think about which choice you will make.  Having multiple instances of APIM can significantly affect your costs.

One of the benefits in APIM is that there are different SKU choices so perhaps multiple instances of consumption would potentially not be as expensive as multiple instances of Premium but there are significant feature differences to consider.

APIM SKU

When you choose to use API Management you will need to choose an SKU and this will affect the costs.  The good news is that you have a good set of choices but there are some feature differences that might influence your decisions.

To get started with a wide range of features at a low price point you have the developer SKU.  This will let you try out many of the features and will be suitable for most development and test environments.  This sku is not suitable for production workloads however.

When we start looking at the other tiers it starts coming down to a trade off between features and price.

Its probably best to look for those features which would bias your decision.  For example if you need outbound VNET integration then you limit your choices to:

  • Premium/Isolated

  • Developer

  • V2 Standard

If you require availability group or multi-region support then your pushing yourself to premium too.

If non of those features influence your decision then it comes down to the number of requests you want to concurrently process, scale out and the SLA you require.

We expect that there are likely to be more V2 Tier plans in the future.

Gateway choice

When your deploy APIM you will be using a gateway that either Microsoft host and run for you, or that you self-host.  If you choose the self-hosted model then there are some additional charges associated with this and also you will need one of the more advanced SKU which will cost more.

You will also have the costs for the host running the gateway.  This is likely to be a node within your AKS cluster.

With the self-hosted gateway there will usually be some design choices that lead up to this decision to host your own.  Ensure that the cost implication of the self-hosted gateway has been factored into that decision making process.

API Backend Performance

If the choice of APIM SKU will be significantly affected by the number of concurrent requests you need to process then its important to consider the performance of the backend API’s that your APIM will proxy.

A good example here is that if your backend performs poorly and requests take a long time then these will hog resources on APIM while the requests are executing.  If you have a standard sku capable of running 2500 requests per second but these requests are hitting a backend API which is taking a minute to respond then these requests are going to clog up your API gateway and require you to scale up or out.

Ensure your teams are spending time to optimize these backend API’s.

Scale-out vs scale up

Under high load, you may need to scale your APIM.  If we assume you are using a standard SKU with no feature constraints for your requirement, then you could scale out to 3 units, giving you 7.5k requests/sec for a lower price than scaling up to premium, which would give you 4k requests/sec.

Ensure you consider the different price plan features, limits and SLA when choosing how you would scale.

Common Optimizations


Logging

In APIM, you have a number of options to configure logging to APIM.  You can tune the logging to include inbound and outbound requests, headers, and message bodies.

The more you log here, the more you will increase the associated App Insights cost, which is a dependency of your APIM logging.

Ensure you are using the right balance of logging to optimize its use for operational support compared with the cost impact.

You can use sampling here which can help with cost management.  Also, minimize the log data retention to a reasonable duration.

Remember that it's not just the direct APIM cost, but there can be indirect costs for resources that you depend on.

Backend Performance

Using App Insights integration for APIM then you can get a lot of visualizations of the performance of your API’s and backends.  Using this data, you can help identify areas on the backend applications which you may want to optimize.  Convincing your application teams to tune their API's will limit the impact on your APIM costs.

Problems in this area can be one of the reasons companies may choose to have multiple instances of APIM.


Was this article helpful?

What's Next
ESC

Eddy AI, facilitating knowledge discovery through conversational intelligence