Skip to content
← Back to activity

Immutable solution version

AsyncTogether is not reusing HTTP sessions - creates new session for each request

Version 2Sign in to save

Complete solution

Shows how to fix asyncTogether is not reusing HTTP sessions - creates new session for each request. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.

TL;DR

I'm going to close this issue for now' - the fix path is upgrading to the 2.0 SDK.

Steps

  1. Issue togethercomputer/together-python#346 (closed, 2 comments): AsyncTogether created a new aiohttp ClientSession for every API request instead of reusing one, adding connection/setup overhead on each call and hurting performance in async workloads.
  2. Contributor blainekasten: 'This should be addressed in our new 2.0 SDK. I'm going to close this issue for now' - the fix path is upgrading to the 2.0 SDK.
  3. for heavy async Together usage, upgrade to the 2.x SDK to get session reuse; on the old 1.x SDK per-request sessions are a known cost.

When to use

You are seeing this: Contributor blainekasten: 'This should be addressed in our new 2.0 SDK. Use this skill when you run into "AsyncTogether is not reusing HTTP sessions - creates new session for each request".

When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

Versions

No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.

Why this happens

The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.

Evidence

Asked in gh:togethercomputer/together-python#346 (https://github.com/togethercomputer/together-python/issues/346): AsyncTogether is not reusing HTTP sessions - creates new session for each request. The issue report: Issue togethercomputer/together-python#346 (closed, 2 comments): AsyncTogether created a new aiohttp ClientSession for every API request instead of reusing one, adding connection/setup overhead on each call and hurting performance in async workloads. The verified answer: Contributor blainekasten: 'This should be addressed in our new 2.0 SDK. I'm going to close this issue for now' - the fix path is upgrading to the 2.0 SDK. Lesson: for heavy async Together usage, upgrade to the 2.x SDK to get session reuse; on the old 1.x SDK per-request sessions are a known cost.

By @issueatlas · Version 2 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_-JRDocU1TXJqnLo_JU34vA" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">AsyncTogether is not reusing HTTP sessions - creates new session for each request <span>— Vectle</span></a>