Skip to main content

Introduction

`Function Cloud Hosting is a function hosting model introduced by Cloud Development that supports running functional code on Cloud Hosting, thus it can also be called Cloud Hosting - Function Mode.

`Function Cloud Hosting is essentially a development and operation mode of the Cloud Hosting service, supporting the development and running of functional code on Cloud Hosting without the need to develop a complete service as in traditional container services.

`Function Cloud Hosting can make developing container services as simple as developing cloud functions.

Technical Principle: Function Cloud Hosting = Cloud Hosting + Functions Framework (@cloudbase/functions-framework) + function code. The Functions Framework is also commonly referred to as Runtime, which can load and run cloud functions. Cloud Hosting provides a cloud-based containerized runtime environment.


Q: What problem does Function Cloud Hosting solve?

  1. Compared to Cloud Hosting, Function Cloud Hosting offers a simpler development approach.
  2. Compared to Cloud Functions, Function Cloud Hosting supports more scenario capabilities.

`Function Cloud Hosting combines the advantages of both to some extent, allowing developers to choose based on their business scenarios.


Q: How to determine whether function code needs to be deployed to Cloud Hosting?

  1. If business scenarios require support for features such as WebSocket long connections, Server-Sent Events (SSE), form submissions, file uploads/downloads, streaming responses, single-instance multi-function, and shared in-memory data between functions, Function Cloud Hosting needs to be used.
  2. If business scenarios require lower response times and better user experience, it is recommended to use Function Cloud Hosting.
  3. If functions need to connect to databases such as Redis or MySQL, it is recommended to use Function Cloud Hosting.
  4. If functions need to interface with message queues such as Kafka or Pulsar, it is required to use Function Cloud Hosting.
  5. If business scenarios require long-running asynchronous task processing, it is recommended to use Function Cloud Hosting.
  6. If better log query capabilities are needed, it is recommended to use Function Cloud Hosting.
  7. If you want a better development and debugging experience, it is recommended to use Function Cloud Hosting.
  8. Currently, Function Cloud Hosting is still under continuous iteration. If certain features are not yet supported in Function Cloud Hosting, it is recommended to use Cloud Functions for development.

The function framework @cloudbase/functions-framework provides enhanced capability support.


Q: Does Function Cloud Hosting require understanding of Cloud Hosting or containers?

  1. It is necessary to understand Cloud Hosting, for example, to decide on selecting instance specifications, number of instances, etc. Cloud Hosting itself is relatively simple and easy to get started with.
  2. There is no need to understand containers. Developers do not need to learn the concepts and principles of containers or how to use them.
  3. Overall, compared to Cloud Functions, it does not require learning and understanding much new content.

Q: How to migrate existing Cloud Function code to Cloud Hosting?

  1. Existing Cloud Function code can run in the Cloud Hosting environment after minor modifications.
  2. In addition to modifications to the Cloud Function code itself, the client-side code also requires minor adjustments.

Due to certain differences in runtime mechanisms between the function framework (@cloudbase/functions-framework) and Cloud Functions, some modifications may be required.


Q: Can function code written for Function Cloud Hosting run in other environments?

  1. Yes, by using the function framework (@cloudbase/functions-framework), it can run function code in any environment that supports node.js.
  2. Supports local running, primarily for development and debugging scenarios
  3. Supports deployment in traditional host environments, such as cloud server environments
  4. Supports deployment in container environments, such as Docker environments

Compared to running in a cloud hosting environment, deployment in other environments requires self-managing build and deployment processes.


For more detailed comparisons, refer to the Comparison with Other Solutions - Cloud Function Comparison document.

Note: Function Cloud Hosting and Cloud Functions differ in invocation methods, invocation paths, and runtime mechanisms. Existing Cloud Function code requires minor modifications to run on Function Cloud Hosting.