

# How Neptune Graph Sessions work

 Neptune Graph Sessions are Neptune Analytics graphs whose compute runs only while the session is working. A session is created in about 30 seconds, stops automatically after 15 minutes with no traffic, and resumes in under 20 seconds when the next query arrives. A session keeps your graph data while stopped. Graph sessions run the same Neptune Analytics engine as provisioned graphs, with the same APIs, console, and IAM permissions. 

 The two graph types differ in how compute is managed and billed. For a side-by-side comparison, see [Choosing a graph type: provisioned graphs and Neptune Graph Sessions](gettingStarted-graph-types.md). 

## When should I use a graph session?
<a name="graph-sessions-when-to-use"></a>

 Use a graph session when your usage is intermittent or unpredictable. A session charges for compute only while the session is running, so you don't pay for compute between bursts of work. The following usage patterns fit graph sessions: 
+  **Agentic workloads**: Give an agent, conversation, or knowledge scope its own graph. Whatever the pattern, from minutes per day to a few days a week, you pay for compute only while agents are doing work. 
+  **Per-tenant graphs**: Run one isolated graph per tenant, customer, or user. A fleet of mostly idle per-tenant graphs pays compute only for the sessions that are running. 
+  **Ephemeral analytics**: Create a session, load data from Amazon S3, run the analysis, and then stop or delete the session. For analytics over data stored in a data lake, see graph over data lakes in the [nx-neptune repository](https://github.com/awslabs/nx-neptune) on GitHub. 

 Use a provisioned graph when your workload runs steadily all day or all month. Provisioned graphs also fit workloads that need large memory or predictable latency. Graph sessions aren't always cheaper. A session that runs nearly all the time can cost more than a small provisioned graph. For steady workloads, choose a provisioned graph. 

**Common questions about choosing a graph session**

**Do graph sessions support the same features as provisioned graphs?**  
 Graph sessions and provisioned graphs run the same Neptune Analytics engine, with the same APIs, console, and IAM permissions. Some operational features differ between the two graph types. For the current comparison, see [Choosing a graph type: provisioned graphs and Neptune Graph Sessions](gettingStarted-graph-types.md). 

**Are graph sessions the same as Neptune Serverless?**  
 No. Graph sessions are a graph type in Neptune Analytics. Neptune Serverless is a capacity configuration for Neptune Database, the transactional graph database. For low-latency transactional queries under sustained concurrent load, use Neptune Database. 

**Is a graph session always cheaper than a provisioned graph?**  
 No. Graph sessions save money because you pay for compute only while the session runs, and a stopped session resumes in under 20 seconds. A session that runs nearly all the time can cost more than a small provisioned graph. For steady workloads, use a provisioned graph. 

## What happens when a session starts, stops, and stops automatically?
<a name="graph-sessions-lifecycle"></a>

 A graph session is in one of two states, Running or Stopped. Graph data, vector indexes, and configuration are retained in both states, so you never need to reload data after a stop. 
+  **Running**: The session serves queries and is charged for compute and storage. 
+  **Stopped**: The session serves no queries and has no compute charge. Only storage for the retained graph data is charged. 

 A session stops automatically after 15 minutes with no traffic. You can also stop a session yourself with `StopGraph`. 

 A stopped session resumes in under 20 seconds after it receives a query, or when you call `StartGraph`. The session resumes with its graph state retained. The first query after a start waits for the session to start, so plan client timeouts for that wait. For the conditions that automatic start requires, see [Automatic stop and start for Neptune Graph Sessions](managing-sessions-auto-stop-start.md). For guidance on timeouts and retries, see [Best practices for Neptune Graph Sessions](best-practices-sessions.md). 

 Creating a new session takes about 30 seconds. 

 Delete a session when you no longer need its data. Deleting a session ends both compute and storage charges for that session. 

**Common questions about session lifecycle**

**What does scale to zero mean for a graph session?**  
 Scale to zero means that a stopped session has no compute charge. A stopped session still pays for storage of its retained graph data, so the data is ready when the session starts again. To end storage charges, delete the session. 

**Does a session stop on its own if I forget about it?**  
 Yes. A session stops automatically after 15 minutes with no traffic, and its compute charge stops with it. The session keeps its graph data, vector indexes, and configuration while stopped. 

**How long does a stopped session take to start?**  
 A stopped session resumes in under 20 seconds after it receives a query, or when you call `StartGraph`. The first query after a start waits for the session to start. For client timeout and retry guidance, see [Best practices for Neptune Graph Sessions](best-practices-sessions.md). 

## How much capacity does a session have?
<a name="graph-sessions-capacity"></a>

 A graph session starts at a size of 4 or 8 s-NCU (session Neptune Capacity Units). One s-NCU represents 1 GiB of memory and 0.25 vCPU. You choose the starting size when you create the session, with the `minMemory` parameter. The starting size is also the minimum that you're billed for while the session runs. The s-NCU is the capacity and billing unit for graph sessions, and is separate from the m-NCU that provisioned graphs use. 

 Graph sessions use burstable compute. When your graph or queries need more memory, a session uses more memory than its starting size, and your compute charge follows the memory that the session actually uses. CPU can also burst, to about twice the starting vCPU, at no extra charge. Only memory use above the starting size raises your bill. 


**Starting sizes for graph sessions**  

| Starting size | Minimum billed while running | vCPU (starting, burst) | Memory (starting, burst) | 
| --- | --- | --- | --- | 
| 4 s-NCU | 4 s-NCU | 1 vCPU, bursts to 2 vCPU | 4 GiB, bursts to 8 GiB | 
| 8 s-NCU | 8 s-NCU | 2 vCPU, bursts to 4 vCPU | 8 GiB, bursts to 16 GiB | 

 A session's starting size doesn't change automatically. When a session reaches the burst limit for its starting size, the session is throttled and queries take longer. To get more capacity, change the session's starting size to 8 s-NCU with the `UpdateGraph` API. If your workload needs more than the 8 s-NCU starting size provides, use `UpdateGraph` to convert the session to a provisioned graph. For examples, see [Modifying a Neptune Analytics graph](managing-modifying.md). 

**Common questions about session capacity**

**What is an s-NCU?**  
 An s-NCU (session Neptune Capacity Unit) is the capacity and billing unit for graph sessions. One s-NCU represents 1 GiB of memory and 0.25 vCPU. One s-NCU-hour is one s-NCU used for one hour, billed per second. The s-NCU is separate from the m-NCU that provisioned graphs use. You choose a starting size of 4 or 8 s-NCU when you create a session. 

**What happens when my workload is memory-intensive?**  
 A memory-intensive session uses more memory than its starting size, and the compute charge follows the memory that the session uses. If the session reaches the burst limit for its starting size, the session is throttled. To get more memory, move to a larger starting size or to a provisioned graph. 

**What happens when my workload is CPU-intensive?**  
 A CPU-intensive session can burst to about twice its starting vCPU, at no extra charge: from 1 to 2 vCPU for 4 s-NCU, and from 2 to 4 vCPU for 8 s-NCU. For more vCPU, use `UpdateGraph` to move to the 8 s-NCU starting size, or to a provisioned graph. 

**Does a session change its starting size on its own?**  
 No. A session keeps the starting size that you choose until you change it with the `UpdateGraph` API. Within its starting size, the session uses burstable compute, so memory and CPU can grow when your workload needs them. 

**How many requests and connections can a session handle?**  
 Graph session throughput scales with vCPU. At 4 vCPU, the most that a session reaches when an 8 s-NCU session bursts, a session handles about 40 requests per second and up to 150 concurrent connections. Sessions running on fewer vCPU handle proportionally less. For details, see [Throughput and connection limits for Neptune Graph Sessions](analytics-limits.md#limits-graph-sessions-throughput). 

## How are graph sessions billed?
<a name="graph-sessions-billing"></a>

 Graph sessions are billed in two dimensions, compute and storage: 
+  **Compute**: Charged in s-NCU-hours, per second, only while the session is Running. One s-NCU-hour is one s-NCU used for one hour. The compute charge follows the memory that the session uses, in whole s-NCU increments, and is never below the session's starting size. 
+  **Storage**: Charged per GB-month for the graph data that the session retains, while the session is Running or Stopped. Storage is metered continuously in byte-hours and billed per GB-month on the amount that you store. Each session is billed for at least 1 GB of storage. 

 Database Savings Plans apply to graph session compute, with a 30% discount, the same as for Neptune Serverless. 


**What you pay in each session state**  

| Session state | Compute (s-NCU-hours) | Storage (GB-month) | 
| --- | --- | --- | 
| Running | Charged per second, for the memory used, never below the starting size | Charged | 
| Stopped | Not charged | Charged | 
| Deleted | Not charged | Not charged | 

 A stopped session scales compute to zero, so you pay only for storage. Creating, stopping, and starting a session have no charge. Data transfer and access to source systems, such as Amazon S3, are billed at standard AWS rates. 

 For current prices, see [Neptune Analytics pricing](https://aws.amazon.com/neptune/pricing/). 

**Common questions about session billing**

**How finely is a session's running time billed?**  
 Session compute is billed per second, only while the session is Running. A session that runs for 90 seconds is billed for 90 seconds of compute. 

**How is session storage measured?**  
 Session storage is metered continuously in byte-hours and billed per GB-month. Each session is billed for at least 1 GB of storage, whether the session is Running or Stopped. For current prices, see [Neptune Analytics pricing](https://aws.amazon.com/neptune/pricing/). 

**Do I pay to create, start, or stop a session?**  
 No. Creating, starting, and stopping a session have no charge. Data transfer and access to source systems, such as Amazon S3, are billed at standard AWS rates. 

**Do Database Savings Plans apply to graph sessions?**  
 Yes. Database Savings Plans apply to graph session compute with a 30% discount, the same as for Neptune Serverless. 

**Does CPU use change my bill?**  
 No. CPU bursts are included at no extra charge. A session's compute charge changes only when the session uses more memory than its starting size. 