주요 콘텐츠로 건너뛰기

Serverless vs. Persistent Servers

Leapcell은 다양한 애플리케이션 요구 사항을 충족하기 위해 두 가지 주요 배포 모드인 서버리스(사용한 만큼 지불)영구 서버(시간별 요금 부과) 를 제공합니다.

Leapcell에서는 언제든지 서비스가 서버리스 모드와 영구 서버 모드 간에 전환될 수 있습니다. 특정 사용 사례에 가장 적합한 모드를 선택할 수 있습니다.

이러한 고유한 기능과 장단점을 이해하면 프로젝트에 가장 적합한 옵션을 선택하는 데 도움이 됩니다.

Serverless (Pay-as-you-go)

Serverless Cost

서버리스 모드는 코드가 활성 상태로 실행되는 시간에 대해서만 비용을 지불하는 이벤트 기반 컴퓨팅 모델입니다.

요금 청구는 요청이 수신될 때 시작되어 요청이 완전히 처리되면 종료됩니다. 애플리케이션이 트래픽을 처리하지 않는 유휴 시간에는 비용이 발생하지 않습니다.

Serverless Active Time

Automatic Scaling

이 플랫폼은 트래픽 볼륨에 따라 인스턴스 수를 자동으로 확장하거나 축소합니다.

트래픽 급증을 쉽게 처리하기 위해 수천 개의 인스턴스로 확장할 수 있습니다.

Serverless Scaling
Cold Starts

서비스가 일정 시간(예: 30분) 동안 트래픽을 수신하지 않으면 해당 인스턴스가 휴면 상태가 될 수 있습니다. 새로운 수신 요청은 새 인스턴스를 프로비저닝하기 위해 "콜드 스타트"를 트리거하며, 이로 인해 최대 250ms의 지연 시간이 추가될 수 있습니다. 일관된 트래픽이 있는 서비스는 이 문제를 거의 겪지 않습니다.

Serverless Cold Start

Serverless Advantages and Limitations

Key Advantages

AdvantageDescription
Cost-EffectiveEliminates charges for idle resources, making it ideal for applications with variable or unpredictable traffic patterns.
Automatic ScalingThe platform automatically scales the number of instances up or down based on traffic volume. It can scale to thousands of instances to effortlessly handle traffic spikes.

Limitations to Consider

LimitationDescription
HTTP Short-Lived Requests OnlyThe Serverless model is optimized for short-lived HTTP requests. It is not suitable for long-running connections such as WebSockets, long-polling, or background jobs.
Temporary File SystemOnly the /tmp directory is writable. All other paths in the file system are read-only.
Request TimeoutThe maximum execution time for a single request is 15 minutes.
CPU SuspensionDuring idle periods, the instance's CPU is suspended. This means it cannot run any background tasks when there are no incoming requests.

Persistent Mode (Charge-by-time)

Persistent Server

영구 모드는 로컬 머신 또는 기존 클라우드 서버와 마찬가지로 전용의 지속적으로 실행되는 인스턴스를 제공합니다.

인바운드 요청 볼륨에 관계없이 항상 활성 상태를 유지하며 트래픽을 처리할 준비가 되어 있습니다. 이 모드는 시간당 또는 월별과 같은 고정된 시간 간격을 기준으로 요금이 청구됩니다.

Key Advantages:

FeatureDescription
Cheaper per Unit TimeThe fixed billing model can be more cost-effective for applications with steady workloads. For more details, see Leapcell Pricing.
No Cold StartsThe instance is always active, ensuring the lowest possible latency for every request.
File SystemOffers a writable file system beyond the /tmp directory, allowing for local file I/O, caching, and state management.
Long-Running TasksIdeal for processes that need to run for extended periods without being suspended, such as background jobs, data processing, or maintaining persistent connections (e.g., WebSockets).

Serverless or Persistent for my use case?

For most use cases, we recommend starting with the Serverless mode due to its excellent flexibility and cost efficiency.

When to Use Serverless

When to Use ServerlessDescription
Any stateless HTTP or web serviceYour application state should be stored in object storage or a database, not in the service itself.
Services with unpredictable early-stage trafficIn the early stage, when traffic is low or uncertain, the Serverless model is the most cost-efficient choice.

When to Use Persistent Servers

The Persistent mode is the superior choice in the following scenarios:

When to Use Persistent ServersDescription
High and Sustained TrafficIf your service consistently handles high traffic, the cost-per-hour of a Persistent instance may be lower than the cumulative cost of frequent Serverless invocations.
Long-Running Background JobsFor tasks that exceed the 15-minute limit, such as video encoding, complex data analysis, or training machine learning models.
Dependency on Local File SystemWhen your application requires persistent local storage beyond /tmp, such as for caching or state management.
Ultra-Low Latency RequirementsIdeal for applications where even minimal latency from occasional cold starts is unacceptable.
WebSockets or Long-Lived ConnectionsIf your service requires WebSockets or other long-lived connections, you must use Persistent Servers.