이 가이드에서는 보안, 성능, 사용 측면에서 Google 지도 API 사용량을 최적화하는 전략을 설명합니다.
보안
보안 권장사항 검토
API 키는 프로젝트 중심의 사용자 인증 정보로, 사용자 ID 및 비밀번호와 동일한 보안 조치를 통해 관리해야 합니다. 키를 의도하지 않게 사용하여 할당량을 과도하게 사용하고 계정에 예상치 못한 요금이 발생하지 않도록 API 보안 권장사항을 검토하세요.
API 키를 사용하여 지도 API 액세스
API 키는 Google 지도 API에 액세스할 때 권장되는 인증 방법입니다. 클라이언트 ID도 계속 지원되고는 있지만 API 키는 더욱 세분화된 보안 관리를 지원하며 세부적인 조정을 통해 특정 웹 주소, IP 주소, 모바일 SDK (Android 및 iOS)와 함께 사용할 수 있습니다. API 키 생성 및 보호에 관한 자세한 내용은 각 API 또는 SDK의 'API 키 사용하기' 페이지를 참고하세요. 예를 들어 Maps JavaScript API의 경우 해당 API 키 사용하기 페이지를 참고하세요.
성능
지수 백오프를 사용하여 오류 처리
앱에서 짧은 시간 내에 API를 호출하려고 과도하게 시도하여 할당량 오류 같은 오류가 발생하는
경우 지수 백오프를 사용하여 요청을 처리할 수
있습니다.
지수 백오프는 500번 대 오류에 가장 유용합니다.
특히 쿼리 속도를 조정하세요. 코드에서
쿼리 간 대기 시간 S초를 추가합니다. 쿼리에 여전히 할당량 오류가 발생하는 경우
대기 시간을 두 배로 늘린 다음 다른 쿼리를 보내세요. 쿼리가
오류 없이 반환될 때까지 이 방식으로 대기 시간을 계속 조정하세요.
요청 시 사용자 상호작용 요청 전송
사용자 상호작용이 포함된 API에 대한 요청은 요청이 있을 때에만 보내야 합니다.
즉, 최종 사용자가 API 요청을 시작하는 작업(예: on-click)을 처리할 때까지
대기한 다음 결과를 사용하여 지도를 로드하거나, 목적지를 설정하거나,
적절한 정보를 표시합니다. 요청 시에만 전송하는 방식을 사용하면 API에 대한 불필요한 요청을 방지하여
API 사용을 줄일 수 있습니다.
지도 이동 시 오버레이 콘텐츠 표시 금지
사용자가 지도를 이동시킬 때 Draw()를 사용하여
지도에 맞춤 오버레이 콘텐츠를 표시하지 않도록 하세요. 사용자가
옮길 때마다 지도가 다시 그려지므로 오버레이 콘텐츠를
동시에 배치하면 지연이나 시각적 끊김 현상이 발생할 수 있습니다. 사용자가 화면 이동이나 확대/축소를 중지했을 때만
지도에서 오버레이 콘텐츠를 추가하거나 삭제하세요.
Draw 메서드에서 집약적인 작업 자제
일반적으로 Draw() 메서드에서는 그리기 이외의
성능 집약적인 작업은 피하는 것이 좋습니다. 예를 들어
Draw() 메서드 코드에서는 다음 작업은 하지 말아야 합니다.
대량의 콘텐츠를 반환하는 쿼리
표시되는 데이터에 대한 많은 변경사항
많은 문서 객체 모델(DOM) 요소 조작
이러한 작업은 지도가 렌더링될 때 성능을 저하시키고 지연이나 시각적 끊김
현상을 유발할 수 있습니다.
마커에 래스터 이미지 사용
지도상의 위치를 식별하기 위해 마커를 추가할 때 .PNG 또는 .JPG 형식의 이미지 같은 래스터
이미지를 사용합니다. Scalable Vector Graphics(SVG) 이미지를 렌더링하면
지도를 다시 그릴 때 지연이 발생할 수 있으므로 SVG 이미지는
사용하지 마세요.
마커 최적화
마커를 최적화하면 다수의 마커가 하나의 정적 요소로 렌더링되므로 성능이 향상됩니다. 이는 많은 수의 마커가 필요한 경우에 유용합니다.
기본적으로 Maps JavaScript API가 마커를 최적화할지 여부를
결정합니다. 다수의 마커가 있는 경우 Maps JavaScript
API에서는 최적화를 사용하여 마커를 렌더링하려고
시도합니다. 모든 마커를 최적화할 수는 없으며, 경우에 따라
Maps JavaScript API에서 최적화 과정 없이 마커를 렌더링해야
할 수도 있습니다. 애니메이션 GIF나 PNG를 대상으로 하거나, 각 마커를 별도의 DOM 요소로
렌더링해야 할 때에는 최적화된 렌더링을 사용하지 않습니다.
클러스터를 만들어 마커 표시 관리
지도상의 위치를 식별할 수 있는 마커 표시를 쉽게 관리할 수 있도록 마커 클러스터러 라이브러리를 사용하여 마커 클러스터를 만드세요.
마커 클러스터러 라이브러리에서는 다음 기능에 대한 옵션이 제공됩니다.
클러스터에서 함께 그룹화할 마커의 수를 지정할 수 있는
그리드 크기
클러스터가 표시되는 최대 확대/축소 수준을 지정할 수 있는
최대 확대/축소
마커 아이콘으로 사용할 그래픽 이미지의 이미지 경로
소비
예산 생성, 할당량 수정, 알림 설정 등 Google Maps Platform 비용 관리에 관한 자세한 내용은 비용 관리를 참고하세요.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["필요한 정보가 없음","missingTheInformationINeed","thumb-down"],["너무 복잡함/단계 수가 너무 많음","tooComplicatedTooManySteps","thumb-down"],["오래됨","outOfDate","thumb-down"],["번역 문제","translationIssue","thumb-down"],["샘플/코드 문제","samplesCodeIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-08-31(UTC)"],[[["\u003cp\u003eThis guide provides strategies for optimizing Google Maps APIs usage, focusing on security, performance, and cost management.\u003c/p\u003e\n"],["\u003cp\u003eSecure your API keys by reviewing security best practices and using them as the preferred authentication method.\u003c/p\u003e\n"],["\u003cp\u003eImprove performance by utilizing techniques like exponential backoff for error handling, sending user-interaction requests on demand, and optimizing marker display.\u003c/p\u003e\n"],["\u003cp\u003eManage costs by setting budget alerts, capping daily API usage, and strategically using different Google Maps Platform products based on your needs.\u003c/p\u003e\n"],["\u003cp\u003eUnderstand Google Maps Platform quotas and how they apply to your API usage to avoid unexpected limitations.\u003c/p\u003e\n"]]],["Optimize Google Maps APIs usage by securing API keys, using them instead of client IDs, and implementing exponential backoff for errors. Enhance performance by sending requests on demand, avoiding overlays during map movement, using raster images for markers, and optimizing/clustering markers. Control consumption by setting budget alerts, capping daily usage, using static images when user interaction isn't needed, using the embed API for basic maps, and using mobile SDKs for mobile. In addition, you can reduce costs with optimized routing, limited waypoints, and cost-effective autocomplete and geocoding options.\n"],null,["# Optimization Guide\n\nThis guide describes several strategies to optimize your Google Maps APIs\nusage in terms of security, performance, and consumption.\n\nSecurity\n--------\n\n### Reviewing security best practices\n\nAPI keys are project-centric credentials that deserve the same precautions\nas user IDs and passwords. Review the\n[API Security Best Practices](/maps/api-security-best-practices) to secure your keys from\nunintended use which could lead to undue quota usage and unexpected charges\nto your account.\n\n### Using API keys to access Maps APIs\n\nAPI keys are the preferred authentication method for accessing\nGoogle Maps APIs. While using the client IDs is still\nsupported, API keys support finer-grained security controls and can be tuned to\nwork with specific web addresses, IP addresses, and mobile SDKs (Android and\niOS). For information on creating and securing an API key, go to the \"Using an\nAPI Key\" page for each API or SDK. (For example, for the\nMaps JavaScript API, visit its page on [Using an API\nKey](/maps/documentation/javascript/get-api-key).)\n\nPerformance\n-----------\n\n### Using exponential backoff to handle errors\n\nIf your apps experience errors from excessive attempts to call an API\nwithin a short period of time, such as quota errors, consider using\n[exponential backoff](http://en.wikipedia.org/wiki/Exponential_backoff) to let the requests process.\nExponential backoff is most useful for errors in the 500s.\n\nSpecifically, adjust the pace of your queries. In your code, add\na waiting period of **`S`** seconds between queries. If the query still results\nin a quota error, double the waiting period and then send another query. Continue\nadjusting the waiting period until the query returns without an error.\n\n### Sending user-interaction requests on demand\n\nRequests to APIs that include user interaction should be sent only on demand.\nThis means waiting for the end user to perform an action (such as `on-click`)\nto initiate the API request, then using the results to load a map, set a\ndestination, or display appropriate information. Using an on-demand approach\navoids unnecessary requests to the APIs, reducing API consumption.\n\n### Avoiding displaying overlay content when a map is moving\n\nAvoid using `Draw()` to display custom overlay content on a map at the same\ntime that a user might be moving the map. Since the map is redrawn every time\na user moves the map, placing overlay content on the map at the same time can\nintroduce lag or visual stuttering. Only add or remove overlay content from a\nmap once the user stops panning or zooming.\n\n### Avoiding intensive operations in `Draw` methods\n\nAs a general rule, it is good practice to avoid performance-intensive\nnon-drawing operations in a `Draw()` method. For example, avoid\nthe following in your `Draw()` method code:\n\n- Queries that return a large amount of content.\n- Many changes to the data being displayed.\n- Manipulating many Document Object Model (DOM) elements.\n\nThese operations can slow performance and introduce lag or visual stuttering\nwhen the map renders.\n\n### Using raster images for markers\n\nUse raster images, such as images in .PNG or .JPG format, when adding\nmarkers to identify a location on a map. Avoid using Scalable Vector\nGraphics (SVG) images, since rendering SVG images can introduce lag when\nthe map is redrawn.\n\n### Optimizing markers\n\nOptimization enhances performance by rendering many markers as a single static\nelement. This is useful in cases where a large number of markers is required.\nBy default, the Maps JavaScript API will decide whether a marker\nwill be optimized. When there is a large number of markers, the\nMaps JavaScript API will attempt to render markers with\noptimization. Not all Markers can be optimized; in some situations, the\nMaps JavaScript API may need to render Markers without\noptimization. Disable optimized rendering for animated GIFs or PNGs, or when\neach marker must be rendered as a separate DOM element.\n\n### Creating clusters to manage marker display\n\nTo help manage the display of markers to identify locations on a map,\ncreate a marker cluster using the\n[Marker Clusterer](https://github.com/googlemaps/js-marker-clusterer) library.\nThe Marker Clusterer library includes options for:\n\n- Grid size, to specify the number of markers to group together in a cluster.\n- Maximum zoom, to specify the maximum zoom level in which to display the cluster.\n- Image paths, for the graphics images to use as marker icons.\n\nConsumption\n-----------\n\nFor information on managing your Google Maps Platform costs, including\ncreating budgets, modifying quotas, and setting alerts, see\n[Manage costs](/maps/billing-and-pricing/manage-costs)."]]