Skip to main content

Application

data

Application is one of Leapcell's primary services, and Service acts as the carrier for an Application.

Service is a CaaS (Container as a Service) Serverless service, adhering to the principles of 12 Factor.

It packages your dependencies into an image and runs your code in an event-driven manner. You can trigger your code via HTTP or Cron.

Service currently supports pulling code from Github, and the code must be public. If you need support for other methods, please let us know.

Key features of a Service include:

  • Serverless: Event-driven, no need to manage servers.
  • High Performance: Cold start within 300ms, and each request takes around 10ms during normal operation (data based on testing).
  • Well Observed: You can view your application's logs, monitoring, errors, etc., on Leapcell.
  • Security: The code runs in a sandboxed environment, isolated from other applications. Sensitive information is managed using environment variables.
  • Follows 12 Factor: Your application follows the 12 Factor principles, making it easy to deploy on Leapcell.

Concept

Runtime Environment

CPU, Memory, and Network

Leapcell, like other Serverless services, controls the allocation of CPU and network resources based on the Memory size. You can adjust the Memory size to fine-tune your application's performance.

It's important to note that the computing unit is billed per second. Choosing a smaller Memory size may not necessarily be cheaper. For instance, if a service with Memory size of 128MB takes 1 second to compute, and a service with Memory size of 1024MB takes 0.1 second, their costs will be similar. Additionally, the Memory size determines the network bandwidth. For instance, calling Leapcell Table within a service with Memory size of 300MB takes less than 50ms, while a Memory size of 128MB takes around 100ms. This is not due to Leapcell Table being slow but because the CPU and network resources in the runtime environment are limited.

Configured Memory (MB)Allocated Cores
128-17691
1770-35382
3539-53073
5308-70764

In other words, if you allocate, for example, 300MB, you will only receive this much CPU and the corresponding network.

MemoryCPU Cap
192 MB10.8%
256 MB14.1%

Storage

Storage behaves differently from local storage because Leapcell Service is a dynamic environment with an uncertain lifespan.

Like other FaaS services, Leapcell Service's runtime environment only has write access to the /tmp directory. All other directories are read-only. If you attempt to write to other paths, you will encounter permission issues.

Therefore, you should store your data in the /tmp directory or use other storage services like Leapcell Table.

caution

Do not store your data in the /tmp directory, and keep in mind that this directory is not persistent. If your service restarts, the data in this directory will be lost.

Runtime

The Runtime is an execution environment that includes all the dependencies you need. If you are familiar with Docker, you can think of it as a Docker image.

The currently provided Runtimes include:

RuntimeIncludedDescription
Python AlpinePython 3.11.2, pipMinimal Python runtime suitable for scripts
Python DebianPython 3.11.2, pip, apt-getIncludes apt-get for installing more dependencies
Python NodeJSPython 3.11.2, pip, NodeJS 14.15.4, npmIncludes NodeJS, suitable for bundling frontend applications with backend scripts
NodeJS AlpineNodeJS 20.0.4, npmMinimal NodeJS runtime suitable for NodeJS scripts
NodeJS DebianNodeJS 20.0.4, npm, apt-getIncludes apt-get for installing more dependencies

If you need additional runtimes, such as TensorFlow, please let us know.

Packaging and Deployment

Refer to the following sections (Packaging and Deployment).

Environment Variables

Leapcell recommends using environment variables to manage sensitive information such as database passwords. These environment variables are encrypted and private, ensuring they are not visible to others.

You can set environment variables in the Environment section of the Service page. Variables set here will be injected into your service's runtime environment.

If your service is already running, you don't need to restart it after modifying environment variables. Your service will automatically fetch the latest environment variables.