11436 SSO

Persistence Services for Optimizing Performance, Building Business Logic, and Scaling APIs

Oct 10, 2013

Persistence services and caching are essential for optimizing for performance, building business logic, and scaling APIs to serve more traffic than a back-end service could otherwise support. One of the important factors of building a full-service API layer is to have access to different kinds of persistence services.

The Apigee API Platform offers several flavors of persistence and provides an API and a GUI for self-service management of the cache.

The benefits of using a cache include:

  • Reducing latency: A request is satisfied from the cache (which is closer to the client) instead of the origin server, so the cache gets the representation and displays it in a shorter time, making the server more responsive.

  • Reducing network traffic: Representations are reused, so the impact of processing duplicate or redundant requests is reduced.

  • Persisting data across transactions: Session data can be stored for reuse across HTTP transactions.

Different types of persistence and caching solutions address diverse usecases:

  • Cache: Caching is the most important performance optimization technique. Apigee provides a distributed cache for caching the entities for optimizing performance. This cache should be used for storing short-lived information like short-lived tokens, session IDs, and so on. This cache can be populated and looked up by policies. There is a policy also for forced invalidation. See this sample for how to store access tokens in memory and check out the documentation to learn about optimizing performance using cache.

  • Response Cache: The Apigee API Platform provides a distributed cache for caching backend service responses. This cache is partially HTTP compliant. The ResponseCache policy allows the backend services’ responses to be cached automatically and looked up based on HTTP headers and query parameters. Check out the response caching sample on github and the documentation to learn about reducing latency using the Response Cache.

  • Key Value Map: Apigee provides a distributed key-value map implementation for persisting API logic related data. It exposes lightweight persistence for data that needs to be accessed at runtime by policies or code running on the API Platform. This key-value map store is distributed across different regions. The KeyValueMapOperations policy provides policy-based access to the API Platform's key/value store and is typically used to persist long-lived information that needs to be reused over multiple request/response transactions.

    There are public APIs available for all of these activities external to runtime flow. This persistence store should be used to store data which can also be managed externally without needing to go through Apigee API runtime. Check out the key-value map sample on github and the documentation for information about persisting data using the Key Value Map.

  • App Services: Apigee provides an advanced persistence solution as a separate component - App Services. This persistence store provides a query interface, social graph of data, user management, and so on. App Services is typically used for advanced data storage use cases in which you are leveraging data in multiple ways and in ways other than in API logic.

  • User Datastore
  • Social Activity Datastore
  • Device Meta-data Datastore
  • Location Lookups
  • Generic Datastore

Apigee API Platform services provide a broader platform than a pure API management solution and enables API and app development to drive enterprise digital transformation.

Scaling Microservices