Apigee는 지속성 및 빠른 검색을 위해 런타임 시 캐시에 데이터를 저장할 수 있는 기능을 제공합니다.
데이터는 처음에 L1 캐시라고 하는 메시지 프로세서의 인메모리 캐시에 저장됩니다.
L1 캐시는 JVM 메모리의 비율로 예약된 메모리 양에 따라 제한됩니다.
캐시된 항목은 나중에 모든 메시지 프로세서에 액세스할 수 있는 L2 캐시에 유지됩니다. 자세한 내용은 아래 섹션에서 확인할 수 있습니다.
L2 캐시에는 캐시 항목 수에 대한 엄격한 제한은 없지만 캐시할 수 있는 최대 항목 크기는 256KB로 제한됩니다.
최적의 성능을 위해 캐시 크기는 256KB가 권장됩니다.
안티패턴
이 특정한 안티패턴은 Apigee 내에서 현재 캐시 크기 제한을 초과할 때의 영향에 대해 설명합니다.
데이터가 256KB를 초과하면 다음과 같은 영향이 발생합니다.
L2 캐시에서 256KB를 초과하는 항목을 사용할 수 없으므로 각 메시지 프로세서에서 처음 실행되는 API 요청은 원본 소스(정책 또는 대상 서버)에서 독립적으로 데이터를 가져와야 합니다.
대용량 데이터(256KB 초과)를 L1 캐시에 저장하면 플랫폼 리소스에 더 큰 부담이 가해지는 경향이 있습니다. 이렇게 하면 L1 캐시 메모리가 더 빠르게 채워지고 다른 데이터에 사용 가능한 공간이 줄어들게 됩니다. 따라서 원하는 만큼 적극적으로 데이터를 캐시할 수 없게 됩니다.
항목 수 제한에 도달하면 메시지 프로세서의 캐시된 항목이 삭제됩니다. 이렇게 하면 데이터를 해당 메시지 프로세서의 원본 소스에서 다시 가져오게 됩니다.
영향
크기가 256KB를 초과하는 데이터는 L2/영구 캐시에 저장되지 않습니다.
원본 소스(정책이나 대상 서버)에 대한 호출을 더 자주 하면 API 요청의 지연 시간이 늘어납니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-09-04(UTC)"],[[["\u003cp\u003eApigee uses a two-tiered caching system (L1 and L2) to store data for persistence and faster retrieval, with L1 being an in-memory cache and L2 being a persistent cache accessible to all Message Processors.\u003c/p\u003e\n"],["\u003cp\u003eThe L2 cache has a size limit of 256 KB per entry for optimal performance, and exceeding this limit results in the data not being stored in L2.\u003c/p\u003e\n"],["\u003cp\u003eCaching data larger than 256 KB causes API requests to fetch data independently from the original source on each Message Processor, and it also stresses the L1 cache, leading to less space available for other data.\u003c/p\u003e\n"],["\u003cp\u003eStoring data under 256 KB is the preferred practice for optimal caching performance, and for data exceeding this size, consider using a database or compressing the data.\u003c/p\u003e\n"],["\u003cp\u003eExceeding the cache size limit increases the frequency of calls to the original source and results in higher API request latency.\u003c/p\u003e\n"]]],[],null,["# Antipattern: Store data greater than 256 KB size in cache\n\n*You're viewing **Apigee** and **Apigee hybrid** documentation.\nView [Apigee Edge](https://docs.apigee.com/api-platform/antipatterns/caching-large) documentation.*\n\nApigee provides the ability to store data in a cache at runtime for persistence and faster\nretrieval.\n\n- The data is initially stored in the Message Processor's in-memory cache, referred to as *L1\n cache*.\n- The L1 cache is limited by the amount of memory reserved for it as a percentage of the JVM memory.\n- The cached entries are later persisted in *L2 cache*, which is accessible to all Message Processors. More details can be found in the section below.\n- The L2 cache does not have any hard limit on the number of cache entries, however the maximum *size* of the entry that can be cached is restricted to 256 KB. The cache size of 256 KB is the recommended size for optimal performance.\n\nAntipattern\n-----------\n\nThis particular antipattern talks about the implications of exceeding the current cache size\nrestrictions within Apigee.\n\nWhen data \\\u003e 256 KB is cached, the consequences are as follows:\n\n- API requests executed for the first time on each of the Message Processors need to get the data independently from the original source (policy or a target server), as entries \\\u003e 256 KB are not available in L2 cache.\n- Storing larger data (\\\u003e 256 KB) in L1 cache tends to put more stress on the platform resources. It results in the L1 cache memory being filled up faster and hence lesser space being available for other data. As a consequence, one will not be able to cache the data as aggressively as one would like to.\n- Cached entries from the Message Processors will be removed when the limit on the number of entries is reached. This causes the data to be fetched from the original source again on the respective Message Processors.\n\nImpact\n------\n\n- Data of size \\\u003e 256 KB will not be stored in L2/persistent cache.\n- More frequent calls to the original source (either a policy or a target server) leads to increased latencies for the API requests.\n\nBest practice\n-------------\n\n- It is preferred to store data of size \\\u003c 256 KB in cache to get optimum performance.\n- If there's a need to store data \\\u003e 256 KB, then consider:\n - Using any appropriate database for storing large data **OR**\n\n - Compressing the data\n\nFurther reading\n---------------\n\n- [Cache internals](/apigee/docs/api-platform/cache/cache-internals)"]]