با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
دو نسخه از Cloud Functions for Firebase وجود دارد:
Cloud Functions (نسل دوم) ، که توابع شما را به عنوان سرویس در Cloud Run به کار میبرد و به شما امکان میدهد آنها را با استفاده از Eventarc و Pub/Sub فعال کنید.
Cloud Functions (نسل اول) ، نسخه اصلی توابع با محرکهای رویداد و قابلیت پیکربندی محدود.
توصیه میکنیم تا جایی که ممکن است Cloud Functions (نسل دوم) را برای عملکردهای جدید انتخاب کنید. با این حال، ما قصد داریم به پشتیبانی از Cloud Functions (نسل اول) ادامه دهیم.
این صفحه ویژگی های معرفی شده در Cloud Functions را شرح می دهد و مقایسه ای بین دو نسخه محصول ارائه می دهد.
Cloud Functions (نسل دوم)
Cloud Functions نسل بعدی Functions-as-a-Service Firebase است. Cloud Functions (نسل دوم) که بر روی Cloud Run و Eventarc ساخته شده است، زیرساخت های پیشرفته و پوشش رویدادهای گسترده تر را برای Cloud Functions به ارمغان می آورد، از جمله:
ساخته شده در Cloud Run : توابع با Cloud Build ساخته شده و به عنوان خدمات Cloud Run با استفاده از محیط اجرای پیشفرض Cloud Run اجرا میشوند. این به شما این امکان را می دهد که عملکرد خود را مانند سرویس Cloud Run شخصی سازی کنید. برای بررسی گزینههای پیکربندی سرویس خود، مانند محدودیتهای حافظه ، متغیرهای محیطی و غیره، به مستندات Cloud Run مراجعه کنید.
زمانهای پردازش درخواست طولانیتر : بارهای کاری طولانیتر مانند پردازش جریانهای بزرگ داده از Cloud Storage یا BigQuery را اجرا کنید.
اندازههای نمونه بزرگتر : حجمهای کاری بیشتر در حافظه، محاسبات فشرده و موازی را اجرا کنید.
همزمانی بهبودیافته : چندین درخواست همزمان را با یک نمونه تابع مدیریت کنید تا شروع سرد را به حداقل برسانید و تاخیر را بهبود بخشید.
مدیریت ترافیک : ترافیک را بین ویرایشهای عملکرد مختلف تقسیم کنید یا یک تابع را به نسخه قبلی برگردانید.
ادغام Eventarc : پشتیبانی بومی برای راهاندازهای Eventarc ، که تمام 90+ منبع رویداد پشتیبانی شده توسط Eventarc را به Cloud Functions میآورد.
پشتیبانی گستردهتر CloudEvents : پشتیبانی از CloudEvents استاندارد صنعتی در تمام زمانهای اجرا زبان، ارائه یک تجربه توسعهدهنده ثابت.
از آنجایی که Cloud Functions توابع را به عنوان خدمات در Cloud Run به کار می گیرد، Cloud Functions سهمیه ها و محدودیت های منابع را با Cloud Run به اشتراک می گذارد. سهمیه ها را ببینید.
جدول مقایسه
ویژگی
Cloud Functions (نسل اول)
Cloud Functions
رجیستری تصویر
Container Registry یا Artifact Registry
فقط Artifact Registry
درخواست مهلت زمانی
تا 9 دقیقه
تا 60 دقیقه برای عملکردهای فعال شده با HTTP
تا 9 دقیقه برای عملکردهای ایجاد شده توسط رویداد
حساب خدمات*
حساب سرویس Google App Engine ( PROJECT_ID @ appspot.gserviceaccount.com)
حساب سرویس محاسباتی پیشفرض Google Cloud ( PROJECT_NUMBER -compute@developer.gserviceaccount.com)
اندازه نمونه
تا 8 گیگابایت رم با 2 vCPU
حداکثر 16 گیگابایت رم با 4 vCPU
همزمانی
1 درخواست همزمان برای هر نمونه تابع
حداکثر 1000 درخواست همزمان در هر نمونه تابع
* این حساب سرویس پیشفرض است که برای دسترسی به Firebase یا Cloud API از یک تابع در حال اجرا استفاده میشود. هنگامی که بدون آرگومان مقداردهی اولیه می کنید، توسط Firebase Admin SDK استفاده می شود.
اگر از شما خواسته شد، حساب صورتحساب مرتبط با پروژه Google Cloud خود را انتخاب کنید.
در پانل فیلترها ، در زیر برچسبها ، یک فیلتر برچسب با کلید goog-managed-by و مقدار cloudfunctions اضافه کنید.
محدودیت ها
Cloud Functions for Firebase (نسل دوم) از رویدادهای Analytics پشتیبانی نمی کند.
اگرچه Cloud Functions for Firebase (نسل دوم) از رویدادهای مسدودکننده احراز هویت پشتیبانی میکند، اما از همان مجموعه رویدادهای Authentication اولیه مانند نسل اول پشتیبانی نمیکند.
با این حال، از آنجا که توابع نسل اول و نسل دوم میتوانند در کنار هم در یک فایل منبع وجود داشته باشند، همچنان میتوانید Analytics و محرکهای اولیه Authentication در نسل اول همراه با توابع نسل دوم توسعه و استقرار دهید.
تاریخ آخرین بهروزرسانی 2025-09-04 بهوقت ساعت هماهنگ جهانی.
[[["درک آسان","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-09-04 بهوقت ساعت هماهنگ جهانی."],[],[],null,["\u003cbr /\u003e\n\nThere are two versions of Cloud Functions for Firebase:\n\n- **Cloud Functions (2nd gen)** , which deploys your functions as services on Cloud Run, allowing you to trigger them using Eventarc and Pub/Sub.\n- **Cloud Functions (1st gen)**, the original version of functions with limited event triggers and configurability.\n\nWe recommend that you choose Cloud Functions (2nd gen) for new functions\nwherever possible. However, we plan to continue supporting Cloud Functions\n(1st gen).\n\nThis page describes features introduced in Cloud Functions and\nprovides a comparison between the two product versions.\n\nCloud Functions (2nd gen)\n\nCloud Functions is Firebase's next-generation\nFunctions-as-a-Service offering. Built on Cloud Run and\nEventarc, Cloud Functions (2nd gen) brings enhanced\ninfrastructure and broader event coverage to Cloud Functions, including:\n\n- **Built on Cloud Run** : Functions are built with Cloud Build and deployed as Cloud Run services using the default [Cloud Run execution environment](//cloud.google.com/run/docs/about-execution-environments). This gives you the ability to customize your function as you would a Cloud Run service. Refer to Cloud Run documentation to explore options for configuring your service, such as [memory\n limits](//cloud.google.com/run/docs/configuring/services/memory-limits), [environment variables](//cloud.google.com/run/docs/configuring/services/environment-variables), and so forth.\n- **Longer request processing times** : Run longer-request workloads such as processing large streams of data from Cloud Storage or BigQuery.\n- **Larger instance sizes**: Run larger in-memory, compute-intensive, and parallel workloads.\n- **Improved concurrency**: Handle multiple concurrent requests with a single function instance to minimize cold starts and improve latency.\n- **Traffic management**: Split traffic between different function revisions or roll a function back to a prior version.\n- **Eventarc integration** : Native support for Eventarc triggers, bringing all 90+ event sources supported by Eventarc to Cloud Functions.\n- **Broader CloudEvents support** : Support for industry-standard [CloudEvents](https://cloudevents.io/) in all language runtimes, providing a consistent developer experience.\n\nSee the [comparison table](#comparison-table) for details.\n\nBecause Cloud Functions deploys functions as services on Cloud Run,\nCloud Functions shares resource quotas and limits with\nCloud Run. See [Quotas](/docs/functions/quotas).\n\nComparison table\n\n| Feature | Cloud Functions (1st gen) | Cloud Functions |\n|-------------------|------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------|\n| Image registry | Container Registry or Artifact Registry | Artifact Registry only |\n| Request timeout | Up to 9 minutes | - Up to 60 minutes for HTTP-triggered functions - Up to 9 minutes for event-triggered functions |\n| Service account\\* | Google App Engine service account (\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e@appspot.gserviceaccount.com) | Google Cloud default compute service account (\u003cvar translate=\"no\"\u003ePROJECT_NUMBER\u003c/var\u003e-compute@developer.gserviceaccount.com) |\n| Instance size | Up to 8GB RAM with 2 vCPU | Up to 16GiB RAM with 4 vCPU |\n| Concurrency | 1 concurrent request per function instance | Up to 1000 concurrent requests per function instance |\n\n\\* This is the default service account used to access Firebase or Cloud APIs\nfrom a running function. It is used by the Firebase Admin SDK when you\n[initialize without arguments](/docs/admin/setup#initialize-sdk).\n\nPricing\n\nFor pricing information, see [Firebase pricing plans](https://firebase.google.com/pricing#cloud-functions).\n\nYou can view your costs associated with Cloud Functions as follows:\n\n1. Go to the [Cloud Billing Reports page](https://console.cloud.google.com/billing/reports) in the Google Cloud console.\n2. If prompted, select the billing account associated with your Google Cloud project.\n3. In the **Filters** panel, under **Labels** , [add a label filter](//cloud.google.com//billing/docs/how-to/reports#filters) with the key `goog-managed-by` and the value `cloudfunctions`.\n\n| **Note:** If you are using Cloud Functions for Firebase (1st gen) and are interested in Cloud Functions, see [Upgrade 1st gen Node.js functions to 2nd gen](/docs/functions/2nd-gen-upgrade).\n\nLimitations\n\nCloud Functions for Firebase (2nd gen) does not provide support for Analytics\nevents.\n\nThough Cloud Functions for Firebase (2nd gen) supports authentication blocking\nevents, it does not support the same set of basic Authentication events as\n1st gen.\n\nHowever, because 1st gen and 2nd gen\nfunctions can coexist side-by-side in the same source file, you can still\ndevelop and deploy Analytics and basic Authentication triggers in 1st gen\ntogether with 2nd gen functions."]]