Jika Anda membuat fungsi baru, lihat Panduan Memulai Konsol di Cloud Run. Konten di halaman ini hanya berlaku untuk fungsi lama yang sudah ada yang dibuat dengan Cloud Functions v1 API.
Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Mengonfigurasi batas memori dan vCPU (generasi ke-1)
Anda dapat menyediakan fungsi Cloud Run dengan jumlah memori yang berbeda untuk mengontrol
batas jumlah memori yang dapat digunakan oleh suatu fungsi. Jumlah memori yang dialokasikan
yang Anda pilih sesuai dengan jumlah CPU yang dialokasikan untuk fungsi Anda.
Tingkat memori dan CPU yang tersedia ditunjukkan dalam tabel berikut:
Memori
CPU
128 MB
.083 vCPU
256 MB
.167 vCPU
512 MB
.333 vCPU
1024 MB
.583 vCPU
2048 MB
1 vCPU
4.096 MB
2 vCPU
8192 MB
2 vCPU
Tidak tersedia
4 vCPU
Tidak tersedia
8 vCPU
Secara default, memori yang dialokasikan untuk fungsi adalah 256 MB atau 256 MiB, bergantung
pada versi produk fungsi Cloud Run.
Lihat Harga fungsi Cloud Run untuk mengetahui informasi tentang biaya
yang terkait dengan alokasi memori dan CPU.
Menetapkan batas memori
Anda dapat menetapkan memori fungsi yang dialokasikan saat deployment menggunakan
Google Cloud CLI atau konsol Google Cloud :
gcloud
Jika Anda men-deploy fungsi menggunakan gcloud CLI, gunakan
flag --memory:
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-08-19 UTC."],[[["\u003cp\u003eCloud Run functions can be provisioned with varying memory amounts, which directly correlates to the allocated CPU for the function.\u003c/p\u003e\n"],["\u003cp\u003eThe memory and CPU tiers available range from 128MB with .083 vCPU to 8192MB with 2 vCPU, as outlined in the provided table.\u003c/p\u003e\n"],["\u003cp\u003eBy default, a function is allocated 256MB of memory, however, this can be changed.\u003c/p\u003e\n"],["\u003cp\u003eYou can adjust the allocated memory for a function during deployment using the \u003ccode\u003e--memory\u003c/code\u003e flag in the gcloud CLI or through the "Memory allocated" field in the Google Cloud console.\u003c/p\u003e\n"],["\u003cp\u003eMemory and CPU allocations impact the costs associated with running Cloud Run functions, detailed information regarding pricing can be found on the Cloud Run functions Pricing page.\u003c/p\u003e\n"]]],[],null,["# Configure memory and vCPU limits (1st gen)\n==========================================\n\nYou can provision Cloud Run functions with different amounts of memory to control\nthe limit on how much memory a function can use. The amount of allocated\nmemory you choose corresponds to an amount of allocated CPU for your function.\nAvailable memory and CPU tiers are shown in the following table:\n\n| **Note:** 1 vCPU is equal to 2.4GHz. CPU allocations are an approximation. Actual allocation of CPU clock cycles may vary slightly across function invocations.\n\nBy default, the memory allocated for a function is 256MB or 256 MiB depending\non the Cloud Run functions product version.\n\nSee [Cloud Run functions Pricing](/functions/pricing) for information about costs\nassociated with memory and CPU allocations.\n\nSet a memory limit\n------------------\n\nYou can set a function's allocated memory at deployment using the\nGoogle Cloud CLI or the Google Cloud console: \n\n### gcloud\n\nIf you are deploying a function using the gcloud CLI, use the\n[`--memory`](/sdk/gcloud/reference/functions/deploy#--memory) flag: \n\n```sh\ngcloud functions deploy YOUR_FUNCTION_NAME --no-gen2 --memory=MEMORY_LIMIT ...\n```\n\n### Console\n\nTo set the allocated memory during function creation in the\nGoogle Cloud console:\n\n1. Go to the [Cloud Run functions Overview page](https://console.cloud.google.com/functions/list) in the Google Cloud console.\n2. Click **Create function**.\n3. Fill in the required fields for your function.\n4. Expand the **Runtime, build...** section at the end of the page and click the **Runtime** tab.\n5. In the **Memory allocated** field, select an amount of memory.\n6. Click **Next**.\n7. Click **Deploy**."]]