Skip to content

Example file for docker compose and k8s - #1006

Merged
merrymercy merged 5 commits into
sgl-project:mainfrom
LucienShui:chore/docker_entrypoint
Aug 13, 2024
Merged

merrymercy merged 5 commits into
sgl-project:mainfrom
LucienShui:chore/docker_entrypoint

Conversation

@LucienShui

@LucienShui LucienShui commented Aug 9, 2024

Copy link
Copy Markdown
Contributor

Motivation

More convenience to start with docker.

Modification

  1. Add compose.yml for serving as service.
  2. Add k8s example file.
  3. Update README.md for corresponding changes.

Comment thread docker/Dockerfile Outdated
Comment thread compose.yml Outdated
Comment thread README.md Outdated
@merrymercy

Copy link
Copy Markdown
Contributor

Could you revert your changes to the entry points?

@zhyncs

zhyncs commented Aug 12, 2024

Copy link
Copy Markdown
Contributor

@LucienShui May you rebase the latest main branch? Thanks. ref #1033

@zhyncs

zhyncs commented Aug 12, 2024

Copy link
Copy Markdown
Contributor

cc @LucienShui

ref cmd

# first sync fork's main

# next
git checkout main
git pull
git checkout  chore/docker_entrypoint
git rebase main
git push -f

@LucienShui
LucienShui force-pushed the chore/docker_entrypoint branch from f7ec3d1 to bd4b7ec Compare August 12, 2024 16:42
@LucienShui LucienShui changed the title Add entrypoint to Dockerfile, add compose.yml [WIP] Example file for docker compose and k8s Aug 12, 2024
@zhyncs

zhyncs commented Aug 13, 2024

Copy link
Copy Markdown
Contributor

Hi @LucienShui I noticed that you updated your PR. Have the compose and k8s conf been locally verified?

@LucienShui

Copy link
Copy Markdown
Contributor Author

Hi @LucienShui I noticed that you updated your PR. Have the compose and k8s conf been locally verified?

Yes, both compose and k8s have been verified locally, but I want to simplify these files as much as possible to make them more beginner-friendly so I added [WIP] in PR's title.

Feel free to merge it now but it would be better after I make more changes.

BTW, I need to work during the day so I only have time in the evening, my timezone is UTC+8.

@zhyncs

zhyncs commented Aug 13, 2024

Copy link
Copy Markdown
Contributor

Got it. Thanks!

@LucienShui LucienShui changed the title [WIP] Example file for docker compose and k8s Example file for docker compose and k8s Aug 13, 2024
@LucienShui
LucienShui force-pushed the chore/docker_entrypoint branch from 8c0e903 to 652f2a0 Compare August 13, 2024 16:28
@LucienShui

Copy link
Copy Markdown
Contributor Author

This PR is ready to merge, thanks for your time and patience!

@@ -0,0 +1,66 @@
apiVersion: node.k8s.io/v1

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May we add health check, image pull policy and network policy?

@LucienShui LucienShui Aug 13, 2024

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I've just started learning k8s for 4 days, after searching, I still have no idea about what the network policy should do here.

Health check and pull policy was added.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's basically done, and I currently don't have the appropriate environment. It might need to wait for another reviewer to do a simple local verification. Thank you for your contribution!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread docker/compose.yaml
@LucienShui
LucienShui force-pushed the chore/docker_entrypoint branch from b71fbdf to 0b082f5 Compare August 13, 2024 18:09
Comment thread README.md Outdated
@merrymercy
merrymercy enabled auto-merge (squash) August 13, 2024 22:07
@merrymercy
merrymercy disabled auto-merge August 13, 2024 22:07
@merrymercy
merrymercy merged commit 312e849 into sgl-project:main Aug 13, 2024
@merrymercy

Copy link
Copy Markdown
Contributor

@LucienShui Thanks for the contribution!

timethink pushed a commit to timethink/sglang that referenced this pull request Mar 9, 2025
chx96642264 pushed a commit to chx96642264/sglang that referenced this pull request Jul 15, 2026
efschu pushed a commit to efschu/htsglang that referenced this pull request Aug 29, 2026
Boot 65 got further than any boot in this window -- past the ring family, into
decode -- and died as "output with shape [1] doesn't match the broadcast shape
[3]" out of cuda_graph_buffer_registry._foreach_copy. That sentence does not
say WHICH field, and every enabled slot goes into ONE torch._foreach_copy_
call, so one bad pair fails the batch anonymously.

The tier selection is exonerated on the way: the live capture list was
bs=[1, 2, 4] (trimmed from the declared [1,2,4,8,12,16,24] by available
memory, logged at capture), and _pad_to_bucket returns the smallest bucket
>= raw_size, so raw_bs=3 pads to 4, not to 1. The [1] is a slot buffer's own
width, not padded_bs. `axis == "none"` slots take the whole buffer unsliced,
which is the shape a per-rank field under PP=3 would collide with.

So the failure path walks the pairs it just handed to the grouped call and
names every dst/src shape disagreement, with raw_bs, padded_bs and both token
counts. Nothing runs on the happy path -- the walk happens only after the
grouped call has already raised.

This is an instrument and it is deliberate: without the name any fix here is a
guess, and guessing has been the expensive move in this window. One boot turns
"[1] vs [3]" into a field name.

Evidence: desk, executed. py_compile; the naming exists once and appends once,
and it sits inside the except branch. Belegstufe: DESK-BEWIESEN.
efschu pushed a commit to efschu/htsglang that referenced this pull request Aug 30, 2026
…n, die es nicht gibt

== DER BEFUND (gemessen, nicht vermutet) ==
Boot_855_704bgroup2: 57 Prefill-Batches, NULL Decode-Batches, eine 6-Token-Probe
-- und 42 Flips. Die Gruende standen im Log, es hatte sie nur nie jemand
gezaehlt (`PHASE-POLICY arming`, scheduler.py:13627 -- die Zeile existierte
bereits, ich musste kein Instrument bauen):
  21x pp_to_tp: "idle Ns >= Ns, returning to the decode resting layout"
  21x tp_to_pp: "pending prefill N tok > 0 (purity: prefill cannot run in tp,
                 nothing decoding)"
21 Rundtrips auf einer LEEREN Kiste. Die zwei Regeln zertifizierten einander:
diese hier flippte fuer nichts nach TP, die Prefill-Arbeit der Health-Probe
konnte dort nicht laufen, die tp-waertige Regel flippte sofort zurueck. Bei
gemessenen 8,07 s je Rundtrip (4,016 + 4,050 s, RECONCILED `flips`-Tabelle)
sind das ~169 s Naht fuer nichts.

== DIE WURZEL ==
`idle` ist an dieser Stelle der STARKE Leere-Term (`decode_work_bs() == 0 AND
not work_exists()`) -- es ist also BEWIESEN, dass weder ein residenter
Decode-Bundle noch ein Prefill irgendwo geschuldet ist. Die Regel flippte
trotzdem, um sich in der Ruhe-Schicht zu POSITIONIEREN.
Diese Praemisse ist fuer eine KALTE Ankunft verkehrt herum, und eine andere
bekommt eine leere Kiste nicht: ein neuer Request braucht ZUERST einen
Prefill-Pass, und Prefill laeuft unter strict purity nicht in TP. In TP zu
ruhen heisst, die naechste Ankunft zahlt tp_to_pp zum Prefillen UND pp_to_tp
zum Dekodieren. In PP zu ruhen ist fuer genau diese Ankunft strikt besser.
KEINE Dwell-Erhoehung: ein laengerer Dwell macht die Schleife langsamer, nicht
abwesend, und bei NULL Arbeit ist kein Timer lang genug, um den Handel positiv
zu machen (sgl-project#819-Preisfrage, die ein Timer per Konstruktion nicht beantwortet).

== FEHLERKLASSEN-PASSENDER CHECK (Direktaufruf von decide(), 3 Faelle) ==
Klasse a) Format-Spec auf einem Conditional im f-String: beide Zweige
  ausgefuehrt -> "idle 0.0s" / "idle 11.5s". AST + Import gruen.
Klasse b) falscher Zweig / Verhungern:
  CASE1 idle+leer in PP  -> direction=None, Reason traegt sgl-project#1011      PASS
  CASE2 Prefill geschuldet -> "prefilling in pp (50000 tok pending)" PASS
        (nimmt den idle-Zweig NICHT)
  CASE3 Decode-Arbeit da  -> direction=pp_to_tp via DRAINED          PASS
        <- das ist der sgl-project#858/sgl-project#1006-Verhungerungsbeweis: mit echter Arbeit
           feuert der Flip weiterhin. Belegt, nicht argumentiert.

== ZWEISEITIGE ABNAHME AUF METALL (boot_855_1011idle) ==
(i) LEERLAUF, 11 min 39 s, Deadman aktiv, 7 health_generate-Proben bedient:
      Flips 0   |   PHASE-POLICY armings 0   |   sgl-project#1011-Refusals 77   |  health 200
    Vorher auf vergleichbarem Leerlauf: 42 Flips. JETZT NULL.
(ii) LAST, conc=4 x 200 tok: 4/4 fertig, 0 Fehler,
      TTFT min 0,30 / med 0,31 / MAX 0,31 s  -- keine Verhungerung
      Completion 11,38-11,85 s
      Flips: GENAU 1, armiert via DRAINED "N req decoding" -- der Flip feuert,
      wenn echte Arbeit wartet.

== WAS DIESER SCHNITT NICHT TUT -- und meine eigene frueher zu grosse Behauptung ==
Ich hatte A als groessten Hebel gegen die 68-%-Flip-Steuer benannt. GEMESSEN
FALSCH, und die Korrektur gehoert hierher:
  conc=4, 600 tok:  88,64 tok/s  (vorher 90,47)  -- unveraendert in der Streuung
  bs1,    600 tok:  25,09 tok/s  (vorher 25,37)  -- unveraendert
Unter DAUERLAST sind die Flips nachfrage-getrieben (bs1 zahlt weiter ~2 Flips je
Request: 12 Flips auf 6 Requests), und genau das ist die 68-%-Steuer. Der
Leerlauf-Befund bleibt gueltig und der Schnitt beseitigt reine Verschwendung
ohne Preis -- aber er kauft die Last-Steuer NICHT zurueck.

BELEG-STUFE: BOOT-BEWIESEN fuer beide Abnahmehaelften (Zahlen und n oben).
Der Drain-and-Flip-Kontrakt (sgl-project#925) ist unberuehrt; nur der Leerlauf-Zweig mit
`rest_phase == PHASE_TP` aendert sein Verdikt.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants