이 페이지에서는 계층적 네임스페이스가 사용 설정된 버킷에서 성능을 최적화하는 방법을 안내합니다.
객체 나열
다음은 객체를 나열할 때의 성능 고려사항입니다.
계층적 네임스페이스가 사용 설정된 버킷에서 전체 버킷 또는 프리픽스를 사용하여 모든 객체를 나열하는 작업은 파일 시스템의 ls -r 명령어와 마찬가지로 각 폴더와 하위 폴더를 순회해야 하므로 리소스 집약적입니다. 따라서 버킷에 있는 폴더가 많을수록 객체 나열 속도가 느려집니다. 빈 폴더가 많으면 객체 나열 성능에도 부정적인 영향을 미칠 수 있습니다. 성능에 부정적인 영향을 미치지 않으려면 각 폴더에 객체 수를 최대로 늘리고 빈 폴더를 정기적으로 삭제하는 것이 좋습니다.
구분자와 특정 프리픽스를 사용하여 특정 폴더 내의 객체와 하위 폴더를 나열하거나 검색하는 것은 객체가 폴더 구조 내에 구성되어 있으므로 계층적 네임스페이스가 사용 설정된 버킷에서 더 효율적입니다. 구분자와 특정 프리픽스를 사용할 때 나열 성능을 최적화하려면 includeFoldersAsPrefixes 파라미터를 설정하세요. 그렇지 않으면 Cloud Storage에서 빈 폴더를 제외하기 위해 추가 검사를 수행하므로 작업 속도가 느려질 수 있습니다. 객체를 나열할 때 includeFoldersAsPrefixes를 사용하는 방법에 대한 자세한 내용은 객체 나열을 참고하세요.
폴더 관리
효율적인 폴더 관리를 위해 다음을 권장합니다.
폴더 구조 사전 생성: 객체 업로드, 재작성, 구성 작업 중에 폴더가 자동으로 생성되는 대신 폴더 생성 작업을 사용하여 원하는 폴더 구조를 미리 가져옵니다.
폴더 구조를 미리 만들면 성능 일관성과 예측 가능성이 향상됩니다.
폴더당 객체 수 비율 최대화: 폴더 생성 및 관리와 관련된 오버헤드를 줄이므로 객체-폴더 비율을 높게 유지하세요.
폴더 생성 및 삭제 요청 제한: 폴더를 생성하거나 삭제하는 것은 계층적 특성으로 인해 개별 객체로 작업하는 것보다 리소스 집약적입니다. 원활한 성능을 위해 Cloud Storage는 각 버킷에 대해 이러한 작업을 초당 1,000개의 요청으로 제한합니다. 이 한도를 초과하는 요청은 명시적으로 제한되지 않지만 리소스 가용성에 따라 성공적으로 처리될 수 있는지 여부가 결정됩니다.
빈 폴더를 정기적으로 삭제: 특히 객체 수명 주기 관리를 사용하거나 상위 폴더를 명시적으로 삭제하지 않고 객체를 삭제하는 경우 빈 폴더가 누적될 수 있습니다. 누적된 폴더는 객체 나열 작업 및 기타 폴더 관련 작업의 성능에 영향을 미칠 수 있습니다. 다음은 빈 폴더를 삭제하는 데 사용할 수 있는 몇 가지 방법입니다.
Google Cloud 콘솔 또는 Google Cloud CLI를 사용하는 경우 재귀 삭제를 사용하여 폴더를 자동으로 삭제할 수 있습니다.
delete_empty_folders.py 스크립트를 사용하여 병렬 처리를 통해 주기적으로 빈 폴더를 삭제할 수 있습니다. 스크립트는 특정 폴더 경로 프리픽스를 타겟팅하는 옵션을 제공하므로 스크립트가 버킷의 디렉터리 구조 하위 집합에서 폴더 삭제를 실행할 수 있습니다. 또한 스크립트는 관리형 폴더와 연결된 IAM 정책을 포함하여 암시적으로 또는 명시적으로 생성된 모든 빈 폴더를 삭제합니다.
스크립트 사용 방법에 관한 자세한 내용은 GitHub의 리드미를 참고하세요.
[[["이해하기 쉬움","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-11(UTC)"],[],[],null,["# Optimize performance in buckets with hierarchical namespace enabled\n\nThis page provides guidance on how you can optimize performance in buckets with\nhierarchical namespace enabled.\n\nListing objects\n---------------\n\nThe following are the performance considerations for listing objects:\n\n- In buckets with hierarchical namespace enabled, listing all objects for the entire bucket or with a prefix is resource-intensive as the operation must traverse each folder and subfolder, similar to the `ls -r` command in a file system. Consequently, if there are more folders in your bucket, the slower the object listing happens. A large number of empty folders can also negatively impact object listing performance. To avoid negatively impacting performance, we recommend that you maximize the number of objects in each folder and regularly delete empty folders.\n- Listing or retrieving objects and sub folders within a specific folder using a delimiter and a specific prefix is more efficient in buckets with hierarchical namespace enabled as the objects are organized within a folder structure. To optimize listing performance when using a delimiter and a specific prefix, set the `includeFoldersAsPrefixes` parameter. Otherwise, Cloud Storage performs additional checks to exclude empty folders, which can slow down the operation. For more information about using the `includeFoldersAsPrefixes` when listing objects, see [Listing objects](/storage/docs/json_api/v1/objects/list).\n\nFolder management\n-----------------\n\nFor efficient folder management, we recommend the following:\n\n- **Pre-create folder structure:** Instead of relying on automatic folder creation during object upload, rewrite, and compose operations, use the create folder operation to obtain your intended folder structure in advance. Pre-creating the folder structure improves the performance consistency and predictability.\n- **Maximize objects per folder ratio:** Aim for a high objects-to-folder ratio as it reduces the overhead associated with folder creation and management.\n- **Limit folder creation and deletion requests:** Creating or deleting folders is more resource-intensive than working with individual objects due to its hierarchical nature. To ensure a smooth performance, Cloud Storage limits these operations to 1000 requests per second for each bucket. Requests exceeding this limit are not explicitly restricted but resource availability determines whether they can be processed successfully.\n- **Regularly delete empty folders:** Empty folders can accumulate, especially when using Object Lifecycle Management or deleting objects without explicitly deleting their parent folders. The accumulated folders can impact the performance of object listing operation and other folder related operations. The following are some of the methods that you can use to delete empty folders:\n - When you use [Cloud Storage FUSE](/storage/docs/gcs-fuse) or [Cloud Storage connector](/dataproc/docs/concepts/connectors/cloud-storage) to interact with a bucket enabled with hierarchical namespace, deleting a directory deletes the corresponding folder in your bucket.\n - You can use a recursive delete to delete folders automatically when using the Google Cloud console or Google Cloud CLI.\n - You can use the [`delete_empty_folders.py`](https://github.com/GoogleCloudPlatform/python-docs-samples/blob/main/storage/hierarchical-namespace/delete_empty_folders.py) script to periodically delete empty folders using parallel processing. The script provides an option to target a specific folder path prefix, which allows the script to perform folder deletions on a subset of the bucket's directory structure. Additionally, the script deletes all empty folders (created implicitly or explicitly) including managed folders and their associated IAM policies. For details about how to use the script, see the [README on GitHub](https://github.com/GoogleCloudPlatform/python-docs-samples/tree/main/storage/hierarchical-namespace/README.d).\n\nWhat's next\n-----------\n\n- [Create and manage folders](/storage/docs/create-folders).\n- [Rename a folder](/storage/docs/rename-hns-folders).\n- [Listing objects](/storage/docs/listing-objects)."]]