Kiểm tra tốc độMô hìnhĐánh giá chuẩnCho thuêBáo cáoPhần cứngMáy tính decodeTổ chứcProTài liệu APIGửi
Ngôn ngữ
Actual Computer — Every computer, one endpoint

Kiểm tra tốc độ

Qwen4-35B-A3B

RTX PRO 6000 Blackwell Workstation Edition 96GB ×2 · sglang · v0.5.24.dev1+gcd1dc28 · BF16

puretensorĐã xác minh5 thg 12, 2026

Decode

195tok/s

Prefill

20.5ktok/s

Thời gian đến token đầu tiên

138ms

Tổng

458tok/s

VRAM đỉnh

—

Độ dài ngữ cảnh

40K

Độ sâu KV

0

Kích thước batch

1

Đồng thời

1

Công suất tiêu thụ

—

Xác minh

Chưa xác minh — kết quả thử nghiệm

Lượt chạy đã xác minh dùng prompt kiểm thử chuẩn và ghi lại đủ dữ liệu để kiểm tra kết quả.

  • The run did not use one of the standard test prompts.

Lệnh khởi chạy

docker run --gpus all --ipc=host --shm-size 32g lmsysorg/sglang:qwen4 python3 -m sglang.launch_server --model-path Qwen/Qwen4-35B-A3B --served-model-name Qwen/Qwen4-35B-A3B --trust-remote-code --tp-size 2 --mem-fraction-static 0.6 --disable-radix-cache --max-running-requests 64 --context-length 40960 --random-seed 42

Theoretical memory ceiling

579.2–584.7 tok/s

3,584 GB/s memory bandwidth (spec sheet) · 114.00 GB model weights · 16-bit KV cache · 1–2,831 tokens of context

33–34%

of the ceiling reached

Medium confidence

The fastest this hardware's memory could serve a single request; real runs are slower. Model details from Qwen/Qwen4-35B-A3B; size from BF16 estimate. Hardware source · Open calculator

Phần cứng

GPU
RTX PRO 6000 Blackwell Workstation Edition
Số lượng
2
VRAM
96 GB
OS
Ubuntu 24.04.5 LTS

Engine

Engine
sglang
Phiên bản
0.5.24.dev1+gcd1dc28
Build
lmsysorg/sglang:qwen4 (sha256:a574b8c4d271459718a64f9dacd5ba373fcd4e75ee99770abeab4203557eccbd)
Commit
cd1dc28
Quant
BF16
Backend
cuda
TP
2
GPU mem util
0.6
Prefix caching
không
Max running seqs
64

Cấu hình chạy

Context
40.960 tokens
Độ sâu
0 tokens
Kích thước batch
1
Prompt tokens
2831
Prefill tok/s
20.5K tok/s
Output tokens
2048
Ghi chú
PureTensor lab, fox-n0: two RTX PRO 6000 Blackwell Workstation Edition cards (600 W limit), Threadripper 7970X, 256 GB RAM. SGLang official Qwen4 image, pinned by digest, TP2. Full BF16 weights, no speculative decoding: the control for the DFlash2 arm. CPU in a performance window (boost on, performance governor, C2 off). Radix (prefix) cache off as in the drafter model card. A small reranker (2.3 GB) stayed loaded on GPU 0. Thinking off (enable_thinking=false). Batch 1, temperature 0, streamed; median of 5 runs after 2 warmup(s).

Bằng chứng đã ghi

Mã băm prompt (SHA-256)
5a6b7bc1cbbc…
Mẫu prompt · 2,000 chars
[LocalMaxxing cache-bust nonce: 9bb9aae8a0ea2bd03a7f5b3971fe4612]
I have a FastAPI service that receives webhook events from a payment provider and stores them in Postgres with asyncpg. The current handler:

```python
@app.post("/webhooks/payments")
async def payments_webhook(request: Request) -> dict[str, str]:
    payload = await request.json()
    if payload["type"] == "invoice.paid":
        await pool.execute(
            "INSERT INTO invoices (id, amount) VALUES ($1, $2)",
            payload["data"]["id"], payload["data"]["amount"],
        )
    return {"status": "ok"}
```

Problems: the `X-Signature` header is never verified, retried deliveries insert the same invoice twice, and any exception returns a 500 so the provider retries forever.

Rewrite this as a proper module: verify the signature with HMAC-SHA256 over the raw body and reject stale timestamps, make inserts idempotent on the event id, dispatch event types through a registry instead of if-chains, and return 2xx for event types we don't handle. Use pydantic models, full type hints, and no bare except. Include the SQL for the idempotency table and a pytest test for the signature check, then list the failure modes you would alert on.

I have a FastAPI service that receives webhook events from a payment provider and stores them in Postgres with asyncpg. The current handler:

```python
@app.post("/webhooks/payments")
async def payments_webhook(request: Request) -> dict[str, str]:
    payload = await request.json()
    if payload["type"] == "invoice.paid":
        await pool.execute(
            "INSERT INTO invoices (id, amount) VALUES ($1, $2)",
            payload["data"]["id"], payload["data"]["amount"],
        )
    return {"status": "ok"}
```

Problems: the `X-Signature` header is never verified, retried deliveries insert the same invoice twice, and any exception returns a 500 so the provider retries forever.

Rewrite this as a proper module: verify the signature with HMAC-SHA256 over the raw bod
Mẫu đầu ra · 4,000 chars
# Production-Grade Webhook Handler

## 1. SQL — Idempotency Table

```sql
CREATE TABLE IF NOT EXISTS webhook_events (
    event_id    TEXT        PRIMARY KEY,
    event_type  TEXT        NOT NULL,
    received_at TIMESTZONE  NOT NULL DEFAULT now()
);

-- Optional: prune old rows with a scheduled job
-- DELETE FROM webhook_events WHERE received_at < now() - INTERVAL '30 days';
```

The `event_id` primary key is the idempotency gate. `INSERT … ON CONFLICT DO NOTHING` makes retries free.

---

## 2. Full Module — `webhooks.py`

```python
"""
webhooks.py — Secure, idempotent payment-webhook receiver.

Responsibilities:
  1. Verify HMAC-SHA256 signature + reject stale timestamps.
  2. Parse & validate payload with Pydantic.
  3. Deduplicate via webhook_events table.
  4. Dispatch to registered handlers (no if-chains).
  5. Always return 2xx for known-but-unhandled events.
"""

from __future__ import annotations

import hashlib
import hmac
import json
import logging
import time
from typing import Any, Awaitable, Callable, Final

import asyncpg
from fastapi import APIRouter, Header, HTTPException, Request, Response
from pydantic import BaseModel, Field, field_validator

logger = logging.getLogger(__name__)

# ---------------------------------------------------------------------------
# Configuration
# ---------------------------------------------------------------------------

WEBHOOK_SECRET: Final[str] = "…_KEY"  # inject via env / secret manager
MAX_TIMESTAMP_DRIFT_SECONDS: Final[int] = 300  # 5 minutes

# ---------------------------------------------------------------------------
# Pydantic models
# ---------------------------------------------------------------------------


class WebhookEvent(BaseModel):
    """Envelope for every webhook delivery from the payment provider."""

    id: str = Field(..., description="Unique event ID (idempotency key)")
    type: str = Field(..., description="Event type, e.g. 'invoice.paid'")
    created_at: int = Field(
        ..., description="Unix timestamp set by the provider"
    )
    data: dict[str, Any] = Field(
        ..., description="Arbitrary event payload"
    )

    @field_validator("id")
    @classmethod
    def id_must_be_non_empty(cls, v: str) -> str:
        if not v.strip():
            raise ValueError("event id must not be blank")
        return v


class WebhookResponse(BaseModel):
    status: str = "ok"


# ---------------------------------------------------------------------------
# Signature verification
# ---------------------------------------------------------------------------


def verify_signature(
    *,
    raw_body: bytes,
    signature_header: str,
    timestamp_header: str,
    secret: str = WEBHOOK_SECRET,
    max_drift: int = MAX_TIMESTAMP_DRIFT_SECONDS,
) -> None:
    """
    Verify HMAC-SHA256 over ``timestamp.raw_body`` and reject stale requests.

    Raises ``HTTPException(403)`` on any verification failure.
    """
    # --- timestamp freshness ------------------------------------------------
    try:
        event_timestamp = int(timestamp_header)
    except (ValueError, TypeError):
        raise HTTPException(status_code=403, detail="Invalid timestamp header")

    drift = abs(time.time() - event_timestamp)
    if drift > max_drift:
        raise HTTPException(
            status_code=403,
            detail=f"Timestamp drift {drift:.0f}s exceeds {max_drift}s limit",
        )

    # --- HMAC computation ---------------------------------------------------
    signed_payload = f"{timestamp_header}.{raw_body.decode('utf-8')}"
    expected = hmac.new(
        key=secret.encode("utf-8"),
        msg=signed_payload.encode("utf-8"),
        digestmod=hashlib.sha256,
    ).hexdigest()

    if not hmac.compare_digest(expected, signature_header):
        raise HTTPException(status_code=403, detail="Signature mismatch")


# ---------------------------------------------------------------------------
# Handler registry
# --------------------------------------------

Các lượt chạy khác của mô hình này trên phần cứng này