Skip to main content

Comparing Other Solutions

Cloud Hosting Comparison

Function Cloud Hostingprovides a functional code development framework building onCloud Hosting, and compared to directly using Cloud Hosting`, the advantages include:

  1. Function: Function Cloud Hosting supports deploying functional code in Cloud Hosting, which is more suitable for functional programming styles and easier to write.
  2. Lightweight: Function Cloud Hosting does not involve concepts like containers or images, requires no Dockerfile writing, and is more lightweight.
  3. Stability: The Function Cloud Hosting framework has built-in capabilities including Graceful restart, concurrency control, timeout control, parameter optimization, and logging, enabling developers to focus more on business logic development.
  4. Logging: The Function Cloud Hosting framework provides logging capabilities, which is more convenient than manually handling logs when directly using Cloud Hosting.
  5. Ease of Use: Function Cloud Hosting provides more development assistance features, such as cli tools, local debugging, hot restart, inter-function routing, and code reuse.
  6. Foundation: Function Cloud Hosting is built upon Cloud Hosting and supports all its features, such as automatic scale-out, auto-scaling, etc.

Cloud Function Comparison

Compared to Cloud Functions, Function Cloud Hosting differs in aspects such as runtime, triggering methods, deployment, and capabilities. Function Cloud Hosting supports long-connection capabilities like SSE and WebSocket, Stream streaming responses, file upload/download capabilities, multiple functions per instance, is friendly to database long-connection scenarios, offers more convenient development and debugging, and has shorter invocation times, among other features. The following table compares the main differences between Function Cloud Hosting and Cloud Functions:

Runtime

Comparison ItemsCloud FunctionsFunction Cloud Hosting
Concurrency ModelSingle instance, single concurrencySingle instance, multiple concurrency
HPA ModeThe Cloud Functions platform scales based on concurrency and supports pre-provisioned concurrencyLeverages the HPA capability of the deployment platform, e.g., the Kubernetes container platform can configure HPA based on CPU/MEM
Memory LimitSupports MEM size limitsControlled via the runtime platform
CPU LimitUnaware of CPU core countAware of CPU core count, controlled via the runtime platform
Timeout ControlSupports timeout control for function execution; execution can be terminated after timeoutSupports timeout control for function invocation; function code can continue to run after timeout
Debugging CapabilityLocal debugging is difficultThe framework supports local execution and hot restart, making debugging easier
Development ExperienceInconvenient for local developmentMore convenient for local development, provides ts type support
LogsProvides invocation records and advanced logsProvides access logs and advanced logs; access logs offer users more detailed information
Dependency InstallationSupports cloud-based npm dependency installationSupports cloud-based npm, yarn, and pnpm dependency installation
Runtime VersionPlatform-provided specific node.js runtime versionAny node.js runtime version that meets the minimum requirements can be used
Cold StartCold starts occur with shorter duration; cold start rate can be reduced through pre-provisioned concurrencyCold starts occur with longer duration; can be avoided by configuring minimum instance count to prevent scaling to zero
Resident Instance"Not supported" (unaware of function instances)Aware of the instance concept; instances can be configured to be resident or not
Provisioned ConcurrencySupportedNot applicable, similar to manual scaling out
Long Connection CapabilityNot supportedSupports long connections via SSE and WebSocket
Database ConnectionBased on a single-instance, single-concurrency model, which is not conducive to long-lived database connectionsNo difference from a regular node.js program
Asynchronous FunctionSupported; static configuration cannot be dynamically switched, with execution duration limitationsSupported; function code can self-control whether to execute asynchronously
Asynchronous TasksPartially supported in some versionsSupported; function code can self-control whether to execute asynchronously
File UploadNot supportedSupports form-data and other HTTP native binary upload capabilities
File DownloadNot supportedSupported
Streaming ResponseNot supportedSupports streaming response via Stream
Built-in RoutingNoneThe framework features built-in routing, supports multi-function startup, enables easier code sharing between functions, and allows in-memory data sharing between functions
Single-instance Multi-functionNot applicableSupported; multiple functions can run within a single instance, facilitating code sharing and project management

Triggering Methods

CategoryCloud FunctionsFunction Cloud Hosting
Triggering MethodsTriggered via Cloud Development SDK, HTTP, or timersNative HTTP calls or wx.cloud.callContainer, supports obtaining HTTP request context; currently does not support timer triggers
Link DifferencesLink latency is relatively longLink latency is shorter

Deploy

CategoryCloud FunctionsFunction Cloud Hosting
Platform DependencyOnly supports deployment to the Cloud Development Cloud Function platformCan be deployed to any environment supporting Node.js runtime, including local execution