Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ libmicrohttpd-0.9.77-w32-bin.zip
openssl-3.1.4.zip
readline-5.0-1-lib.zip
benchmark/server
benchmark/hey
nul
mt-tools/data/
mt-tools/.venv/
mt-tools/uv.lock
11 changes: 10 additions & 1 deletion benchmark/run-benchmark.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,19 @@ if command -v hey &> /dev/null; then
HEY_CMD="hey"
elif [ -f "$HOME/go/bin/hey" ]; then
HEY_CMD="$HOME/go/bin/hey"
else
elif command -v go &> /dev/null; then
echo "Installing hey..."
go install github.com/rakyll/hey@latest
HEY_CMD="$HOME/go/bin/hey"
else
echo "Go not found. Downloading hey binary..."
HEY_DIR="$(cd "$(dirname "$0")" && pwd)"
HEY_BIN="$HEY_DIR/hey"
if [ ! -f "$HEY_BIN" ]; then
curl -sSL -o "$HEY_BIN" "https://storage.googleapis.com/hey-releases/hey_linux_amd64"
chmod +x "$HEY_BIN"
fi
HEY_CMD="$HEY_BIN"
fi

# Parse arguments
Expand Down
4 changes: 2 additions & 2 deletions runners/client/ClientRunner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ void ClientRunner::run_get_models_request(
jb.stop_object();

auto res = jb.as_cslice().str();
http_send_static_answer(std::move(res), std::move(promise));
http_send_static_answer(std::move(res), std::move(promise), "application/json");
});
} else {
auto request = cocoon::create_serialize_tl_object<cocoon_api::client_getWorkerTypesV2>();
Expand Down Expand Up @@ -134,7 +134,7 @@ void ClientRunner::run_get_models_request(
jb.stop_object();

auto res = jb.as_cslice().str();
http_send_static_answer(std::move(res), std::move(promise));
http_send_static_answer(std::move(res), std::move(promise), "application/json");
});
}
}
Expand Down
14 changes: 9 additions & 5 deletions scripts/cocoon-launch
Original file line number Diff line number Diff line change
Expand Up @@ -506,13 +506,15 @@ def run_client_local(cfg: Config):

# Start router (SOCKS5 only, no reverse proxy) with colored output
router = f'{cfg.build_dir}/tee/router'
router_proc = popen([router, '-S', '8116@tdx', '--serialize-info'],
router_policy = os.environ.get('COCOON_ROUTER_POLICY', 'tdx')
router_proc = popen([router, '-S', f'8116@{router_policy}', '--serialize-info'],
stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True, bufsize=1)
router_thread = threading.Thread(target=stream_output, args=(router_proc, 'ROUTER', '36'), daemon=True)
router_thread.start()

# Run client with colored output
client_cmd = [f'{cfg.build_dir}/client-runner', '--config', f'{cfg.local_run_dir}/client-config.json', '-v3']
client_verbosity = os.environ.get('COCOON_CLIENT_VERBOSITY', '3')
client_cmd = [f'{cfg.build_dir}/client-runner', '--config', f'{cfg.local_run_dir}/client-config.json', f'-v{client_verbosity}']
if cfg.fake_ton:
client_cmd += ['--disable-ton', f'{cfg.local_run_dir}/fake-ton-config.json']

Expand Down Expand Up @@ -651,9 +653,11 @@ def ensure_build(build_dir: Path, targets: list[str]):
'-S', str(script_dir),
'-B', str(build_dir)], check=True)

# Build targets
print(f'Building {", ".join(targets)}...')
run(['cmake', '--build', str(build_dir), '-j', str(os.cpu_count() or 4),
# Build targets (set COCOON_BUILD_JOBS if you hit OOM e.g. on WSL)
jobs = os.environ.get('COCOON_BUILD_JOBS')
jobs = int(jobs) if jobs is not None else (os.cpu_count() or 4)
print(f'Building {", ".join(targets)}... (jobs={jobs})')
run(['cmake', '--build', str(build_dir), '-j', str(jobs),
'--target'] + targets, check=True)


Expand Down