Archived
server: DELETE /sessions forgets one stored conversation
A client that deleted a conversation, or compacted it past a prefix, knows the
rest is dead before --prefix-cache-ttl does. DELETE /sessions/<label> (or
?label=, ?id=<engine id>) walks the session's chain from the tip inwards like
expiry: VRAM blocks to the pool, the host copy with them, the session's
snapshots to the store. ?keep_tokens=N keeps the chain's start in whole blocks.
Blocks another stored session shares (the system prompt) and blocks a live
request reads stay and are counted apart; the row is cut at the deepest block
that stayed, so a later release reaches it. A request of the same conversation
in flight is 409. IScheduler::release_session beside reset_prefix_cache,
PrefixCache::release_session over the tiers' session table (find_sessions,
shared_prefix_blocks, cut_session). Counters released{entries,snapshots} on
/sessions and /stats, prefix_cache_released_total{what} on /metrics.
This commit is contained in:
1 parent
123c439684
commit
3aded1bbf8
20 files changed
+722
-2
No files matched your search
@@ -78,6 +78,7 @@ struct SchedMetrics {
|
||||
int64_t prefix_restore_cuts = 0;
|
||||
/* Removed by --prefix-cache-ttl, cumulative. Not evictions: nothing wanted the memory. */
|
||||
int64_t prefix_expired = 0, prefix_ckpt_expired = 0;
|
||||
int64_t prefix_released = 0, prefix_ckpt_released = 0;
|
||||
/* Decoupled prefix caching (spec §7.3). `prefix_hit_rate` is the attention hit rate, as in
|
||||
* vLLM. The linear side hits at a different granularity (whole checkpoints, not blocks), so
|
||||
* it is reported separately, with token counts and checkpoints written. */
|
||||
@@ -168,6 +169,17 @@ struct SessionOccupancy {
|
||||
int64_t host_cap_bytes = 0;
|
||||
};
|
||||
|
||||
/* What a release took out of the store and what it left (PrefixCache::release_session). The
|
||||
* kept counts are apart on purpose: `shared` blocks belong to another stored conversation too,
|
||||
* `live` ones to a request still reading them. */
|
||||
struct SessionReleased {
|
||||
int64_t sessions = 0;
|
||||
int64_t entries = 0, tokens = 0;
|
||||
int64_t device_bytes = 0, host_bytes = 0;
|
||||
int64_t snapshots = 0;
|
||||
int64_t kept_tokens = 0, kept_shared = 0, kept_live = 0;
|
||||
};
|
||||
|
||||
/* One in-flight request, for the live request table: shows which request is stuck, e.g. one
|
||||
* waiting on a prompt that will never fit, which no aggregate metric reveals. */
|
||||
struct RequestStat {
|
||||
@@ -225,6 +237,15 @@ public:
|
||||
* allocated), but it takes the scheduler's lock because a step may be inserting into the map. */
|
||||
virtual int64_t reset_prefix_cache() { return RAD_E_UNSUPPORTED; }
|
||||
|
||||
/* Forgets one stored conversation (DELETE /sessions): every row carrying `label`, or with
|
||||
* `id` nonzero the row of that engine id; `keep_tokens` leaves the chain's start standing.
|
||||
* RAD_E_NOTFOUND when nothing matches (404), RAD_E_STATE while a request of that
|
||||
* conversation is queued or running (409), RAD_E_UNSUPPORTED without a prefix cache (501). */
|
||||
virtual int release_session(const std::string& /*label*/, uint64_t /*id*/,
|
||||
int64_t /*keep_tokens*/, SessionReleased* /*out*/) {
|
||||
return RAD_E_UNSUPPORTED;
|
||||
}
|
||||
|
||||
/* The live request table, oldest first; returns the count. Default: none kept. */
|
||||
virtual int requests(std::vector<RequestStat>* /*out*/) const { return 0; }
|
||||
|
||||
|
||||
Reference in new issue
Block a user