> ## Documentation Index
> Fetch the complete documentation index at: https://docs.5x.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Deployment options

> Configure when your Cube service runs with always-on, on-demand, or scheduled deployment modes

**Focus:** Understand deployment options for your Cube service, including always-on, on-demand, and scheduled modes, and how to configure them for your specific use case.

Deployment options control when your Cube service runs and how it manages compute resources. Choose the right deployment mode based on your requirements for availability, cost, and use case.

## Deployment modes overview

### **Available options**

Metrics Store supports multiple deployment modes:

* **Always on** - Service runs continuously
* **On demand** - Service starts when needed
* **Scheduled** - Service runs on a time-based/CRON-based schedule

Each mode has different characteristics and use cases.

## Always on deployment

### **Overview**

**Always on** deployment keeps your Cube service running continuously, providing constant availability for queries and API access.

**Characteristics:**

* ✅ Service runs 24/7
* ✅ Immediate availability for queries
* ✅ No startup delays
* ✅ Consistent performance
* ⚠️ Higher compute costs
* ⚠️ Resources always allocated

### **When to use**

**Production environments:**

* Critical business applications
* High-traffic dashboards
* Real-time analytics requirements
* SLA-driven use cases

**Always-available analytics:**

* Executive dashboards
* Customer-facing analytics
* Operational reporting
* Time-sensitive queries

### **Configuration**

1. **Access project settings**
   * Click **"Settings"** button in header
   * Or click project name → **"Edit project"**

2. **Select deployment mode**
   * Choose **"Always on"** from deployment options
   * Save changes

3. **Service starts**
   * Service starts immediately
   * Heartbeat status reaches **"RUNNING"**
   * Available for queries right away

<Note>
  **Production recommendation**

  Always on deployment is recommended for production environments where consistent availability and performance are critical.
</Note>

## On demand deployment

### **Overview**

**On demand** deployment starts the Cube service when it's needed and stops it when idle, optimizing resource usage and costs.

**Characteristics:**

* ✅ Cost-effective for low usage
* ✅ Automatic start on first request
* ✅ Automatic stop when idle
* ⚠️ Startup delay on first request
* ⚠️ Cold start time required

### **When to use**

**Development and testing:**

* Development environments
* Testing and QA
* Experimentation
* Non-critical workloads

**Low-traffic scenarios:**

* Occasional analytics needs
* Ad-hoc reporting
* Personal dashboards
* Cost-sensitive use cases

### **Configuration**

1. **Access project settings**
   * Go to project settings
   * Navigate to deployment options

2. **Select deployment mode**
   * Choose **"On demand"** from options
   * Save changes

3. **Service behavior**
   * Service starts when first query arrives
   * Runs while active
   * Stops automatically after idle period
   * Restarts on next request

<Note>
  **Startup time**

  On demand deployment requires a startup time when the service starts. Users may experience a delay on the first request after an idle period.
</Note>

## Scheduled deployment

### **Overview**

**Scheduled** deployment runs your Cube service on a specific schedule, such as business hours or specific days of the week.

**Characteristics:**

* ✅ Runs during specified times
* ✅ Stops automatically outside schedule
* ✅ Cost optimization for time-based needs
* ✅ Predictable availability windows
* ⚠️ Not available outside schedule
* ⚠️ Requires schedule configuration

### **When to use**

**Business hours operations:**

* Office hours analytics
* Business day reporting
* Time-zone specific needs
* Cost-optimized production

**Scheduled reporting:**

* Daily reports
* Weekly analytics
* Monthly dashboards
* Batch processing windows

### **Configuration**

1. **Access project settings**
   * Go to project settings
   * Select **"Scheduled"** deployment mode

2. **Configure schedule**
   * Choose schedule type:
     * **Whole Week** - Monday-Sunday with time range
     * **Only Weekdays** - Monday-Friday with time range
     * **CRON Expression** - Cron-based scheduling

3. **Set time range**
   * **Start time** - When service should start (e.g., 09:00)
   * **End time** - When service should stop (e.g., 18:00)
   * **Timezone** - Auto-detected or manually selected

4. **Save configuration**
   * Schedule is saved and activated
   * Service starts/stops according to schedule

### **Schedule types**

<Tabs>
  <Tab title="Whole Week">
    **Monday-Sunday schedule:**

    * Runs all week with time range
    * Configure start and end times
    * Example: 08:00 - 20:00 Monday-Sunday
    * Stops outside time range

    **Use cases:**

    * Extended hours operations
    * Daily time windows
    * Regular availability periods
  </Tab>

  <Tab title="Only Weekdays">
    **Monday-Friday schedule:**

    * Runs Monday through Friday
    * Configure start and end times
    * Example: 09:00 - 18:00 Monday-Friday
    * Stops automatically on weekends

    **Use cases:**

    * Business hours operations
    * Office hours analytics
    * Workday reporting
  </Tab>

  <Tab title="CRON Expression">
    **Cron-based scheduling:**

    * Advanced scheduling with cron expressions
    * Full flexibility for complex schedules
    * Start and end cron expressions
    * Example: `0 9 * * 1-5` (9 AM weekdays)

    **Use cases:**

    * Complex scheduling needs
    * Multiple time windows
    * Irregular schedules
    * Advanced automation
  </Tab>
</Tabs>

### **Timezone configuration**

**Auto-detection:**

* System automatically detects browser timezone
* Uses detected timezone for schedule
* Convenient default for most users

**Manual selection:**

* Override auto-detected timezone
* Select from available timezones
* Useful for remote teams or specific regions

**Timezone format:**

* IANA timezone format (e.g., `America/New_York`)
* Supports all major timezones
* Handles daylight saving time automatically

## Comparing deployment modes

### **Quick comparison**

| Feature          | Always On  | On Demand     | Scheduled                    |
| ---------------- | ---------- | ------------- | ---------------------------- |
| **Availability** | 24/7       | When needed   | On schedule                  |
| **Startup time** | None       | 30-60 seconds | None (within schedule)       |
| **Cost**         | Highest    | Lowest        | Medium                       |
| **Use case**     | Production | Development   | Business hours               |
| **Performance**  | Consistent | Cold starts   | Consistent (within schedule) |

### **Choosing the right mode**

**Select Always On if:**

* Production environment with high availability needs
* Real-time analytics requirements
* Consistent performance is critical
* Cost is not a primary concern

**Select On Demand if:**

* Development or testing environment
* Low-traffic or occasional use
* Cost optimization is important
* Startup delays are acceptable

**Select Scheduled if:**

* Business hours operations
* Predictable usage patterns
* Cost optimization for time-based needs
* Availability during specific windows is sufficient

## Best practices

### **Deployment strategy**

<CardGroup cols={2}>
  <Card title="Environment separation" icon="layer-group">
    **Different modes per environment**

    Use Always On for production, On Demand for development, and Scheduled for staging.
  </Card>

  <Card title="Cost optimization" icon="dollar-sign">
    **Right-size deployment**

    Choose deployment mode based on actual usage patterns, not just availability needs.
  </Card>

  <Card title="Monitor usage" icon="chart-line">
    **Track patterns**

    Monitor usage patterns to optimize deployment mode and schedule configuration.
  </Card>

  <Card title="Plan for growth" icon="trending-up">
    **Scale appropriately**

    Start with On Demand or Scheduled, upgrade to Always On as usage grows.
  </Card>
</CardGroup>

### **Configuration tips**

* **Test deployment changes** - Verify service starts/stops correctly
* **Monitor heartbeat status** - Ensure service is running when expected
* **Set appropriate schedules** - Align with actual usage patterns
* **Consider timezones** - Configure schedules for your team's timezone
* **Review periodically** - Adjust deployment mode as needs change

## Troubleshooting

### **Common issues**

<AccordionGroup>
  <Accordion icon="clock" title="Service not starting">
    **Possible causes:**

    * Deployment mode configuration issues
    * Schedule not configured correctly
    * Environment or resource constraints
    * Service startup errors

    **Solutions:**

    * Verify deployment mode is set correctly
    * Check schedule configuration (if scheduled)
    * Review environment configuration
    * Check server logs for errors
    * Try changing deployment mode
  </Accordion>

  <Accordion icon="exclamation-triangle" title="Service stops unexpectedly">
    **Possible causes:**

    * Schedule configuration (if scheduled)
    * Idle timeout (if on demand)
    * Resource constraints
    * Service errors

    **Solutions:**

    * Check schedule configuration and timezone
    * Verify on demand idle timeout settings
    * Review resource limits
    * Check service logs for errors
    * Consider switching to Always On
  </Accordion>

  <Accordion icon="calendar" title="Schedule not working">
    **Possible causes:**

    * Incorrect schedule configuration
    * Timezone mismatch
    * Cron expression errors
    * Service not respecting schedule

    **Solutions:**

    * Verify schedule type and time range
    * Check timezone configuration
    * Validate cron expressions (if custom)
    * Test schedule configuration
    * Review schedule in project settings
  </Accordion>
</AccordionGroup>

***

<CardGroup cols={2}>
  <Card title="Project Management" icon="folder" href="/core-features/metric-store/project-management">
    **Manage projects**

    Learn how to configure deployment options in project settings.
  </Card>

  <Card title="Getting Started" icon="rocket" href="/core-features/metric-store/getting-started">
    **Quick start**

    Understand deployment options when creating your first project.
  </Card>
</CardGroup>
