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
@@ -173,6 +173,16 @@ struct IPrefixCache {
|
||||
/* Restores the pool could not hold whole (PrefixCache::Stats::restore_cuts). */
|
||||
virtual int64_t restore_cuts() const { return 0; }
|
||||
virtual int64_t ckpt_expired() const { return 0; }
|
||||
/* Entries and snapshots a client released on purpose (release_session). */
|
||||
virtual int64_t released() const { return 0; }
|
||||
virtual int64_t ckpt_released() const { return 0; }
|
||||
|
||||
/* Forget one stored conversation now, by the client's label or the engine's session id
|
||||
* (PrefixCache::release_session). RAD_E_UNSUPPORTED from a cache without a session table. */
|
||||
virtual int release_session(const std::string& /*label*/, uint64_t /*id*/,
|
||||
int64_t /*keep_tokens*/, SessionRelease* /*out*/) {
|
||||
return RAD_E_UNSUPPORTED;
|
||||
}
|
||||
|
||||
/* Tokens of context held only by the cache right now. Blocks a running sequence also reads
|
||||
* are excluded. Separates a working cache from a leak in the pool figures. */
|
||||
@@ -424,6 +434,12 @@ struct PCBinding final : IPrefixCache {
|
||||
int64_t expired() const override { return m->stats().expired; }
|
||||
int64_t restore_cuts() const override { return m->stats().restore_cuts; }
|
||||
int64_t ckpt_expired() const override { return m->stats().ckpt_expired; }
|
||||
int64_t released() const override { return m->stats().released; }
|
||||
int64_t ckpt_released() const override { return m->stats().ckpt_released; }
|
||||
int release_session(const std::string& label, uint64_t id, int64_t keep_tokens,
|
||||
SessionRelease* out) override {
|
||||
return m->release_session(label, id, keep_tokens, out);
|
||||
}
|
||||
int64_t held_tokens() const override { return m->unshared_tokens(); }
|
||||
|
||||
int64_t next_checkpoint_after(int64_t p) const override { return m->next_checkpoint_after(p); }
|
||||
|
||||
Reference in new issue
Block a user