Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
change
sglang
Commits
fe43e889
Unverified
Commit
fe43e889
authored
Aug 20, 2025
by
fzyzcjy
Committed by
GitHub
Aug 19, 2025
Browse files
Fix mini lb timeout issue (#9369)
parent
5ae5ecaa
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
6 deletions
+18
-6
python/sglang/srt/disaggregation/launch_lb.py
python/sglang/srt/disaggregation/launch_lb.py
+7
-1
python/sglang/srt/disaggregation/mini_lb.py
python/sglang/srt/disaggregation/mini_lb.py
+11
-5
No files found.
python/sglang/srt/disaggregation/launch_lb.py
View file @
fe43e889
...
@@ -118,7 +118,13 @@ def main():
...
@@ -118,7 +118,13 @@ def main():
lb_args
=
LBArgs
.
from_cli_args
(
args
)
lb_args
=
LBArgs
.
from_cli_args
(
args
)
prefill_configs
=
[
PrefillConfig
(
url
,
port
)
for
url
,
port
in
lb_args
.
prefill_infos
]
prefill_configs
=
[
PrefillConfig
(
url
,
port
)
for
url
,
port
in
lb_args
.
prefill_infos
]
run
(
prefill_configs
,
lb_args
.
decode_infos
,
lb_args
.
host
,
lb_args
.
port
)
run
(
prefill_configs
,
lb_args
.
decode_infos
,
lb_args
.
host
,
lb_args
.
port
,
lb_args
.
timeout
,
)
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
...
...
python/sglang/srt/disaggregation/mini_lb.py
View file @
fe43e889
...
@@ -50,10 +50,16 @@ class PrefillConfig:
...
@@ -50,10 +50,16 @@ class PrefillConfig:
class
MiniLoadBalancer
:
class
MiniLoadBalancer
:
def
__init__
(
self
,
prefill_configs
:
List
[
PrefillConfig
],
decode_servers
:
List
[
str
]):
def
__init__
(
self
,
prefill_configs
:
List
[
PrefillConfig
],
decode_servers
:
List
[
str
],
timeout
:
int
,
):
self
.
prefill_configs
=
prefill_configs
self
.
prefill_configs
=
prefill_configs
self
.
prefill_servers
=
[
p
.
url
for
p
in
prefill_configs
]
self
.
prefill_servers
=
[
p
.
url
for
p
in
prefill_configs
]
self
.
decode_servers
=
decode_servers
self
.
decode_servers
=
decode_servers
self
.
timeout
=
timeout
def
add_prefill_server
(
self
,
new_prefill_config
:
PrefillConfig
):
def
add_prefill_server
(
self
,
new_prefill_config
:
PrefillConfig
):
self
.
prefill_configs
.
append
(
new_prefill_config
)
self
.
prefill_configs
.
append
(
new_prefill_config
)
...
@@ -78,7 +84,7 @@ class MiniLoadBalancer:
...
@@ -78,7 +84,7 @@ class MiniLoadBalancer:
async
with
aiohttp
.
ClientSession
(
async
with
aiohttp
.
ClientSession
(
timeout
=
aiohttp
.
ClientTimeout
(
timeout
=
aiohttp
.
ClientTimeout
(
total
=
3600
total
=
self
.
timeout
)
# Add timeout for request reliability
)
# Add timeout for request reliability
)
as
session
:
)
as
session
:
tasks
=
[
tasks
=
[
...
@@ -117,7 +123,7 @@ class MiniLoadBalancer:
...
@@ -117,7 +123,7 @@ class MiniLoadBalancer:
async
def
stream_results
():
async
def
stream_results
():
async
with
aiohttp
.
ClientSession
(
async
with
aiohttp
.
ClientSession
(
timeout
=
aiohttp
.
ClientTimeout
(
timeout
=
aiohttp
.
ClientTimeout
(
total
=
3600
total
=
self
.
timeout
)
# Add timeout for request reliability
)
# Add timeout for request reliability
)
as
session
:
)
as
session
:
# Create the tasks for both prefill and decode requests
# Create the tasks for both prefill and decode requests
...
@@ -401,9 +407,9 @@ async def register(obj: PDRegistryRequest):
...
@@ -401,9 +407,9 @@ async def register(obj: PDRegistryRequest):
return
Response
(
status_code
=
200
)
return
Response
(
status_code
=
200
)
def
run
(
prefill_configs
,
decode_addrs
,
host
,
port
):
def
run
(
prefill_configs
,
decode_addrs
,
host
,
port
,
timeout
):
global
load_balancer
global
load_balancer
load_balancer
=
MiniLoadBalancer
(
prefill_configs
,
decode_addrs
)
load_balancer
=
MiniLoadBalancer
(
prefill_configs
,
decode_addrs
,
timeout
=
timeout
)
uvicorn
.
run
(
app
,
host
=
host
,
port
=
port
)
uvicorn
.
run
(
app
,
host
=
host
,
port
=
port
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment