diff --git a/lightllm/server/api_start.py b/lightllm/server/api_start.py index 9cc3d38c2..ba011136c 100644 --- a/lightllm/server/api_start.py +++ b/lightllm/server/api_start.py @@ -10,7 +10,7 @@ from .embed_cache.manager import start_cache_manager from lightllm.utils.log_utils import init_logger from lightllm.utils.envs_utils import set_env_start_args, set_unique_server_name, get_unique_server_name -from lightllm.utils.envs_utils import get_lightllm_gunicorn_time_out_seconds, get_lightllm_gunicorn_keep_alive +from lightllm.utils.envs_utils import get_lightllm_gunicorn_keep_alive from .detokenization.manager import start_detokenization_process from .router.manager import start_router_process from lightllm.utils.process_check import is_process_active @@ -337,13 +337,11 @@ def normal_or_p_d_start(args): ], ) - # 启动 gunicorn + # 启动 Hypercorn command = [ - "gunicorn", + "hypercorn", "--workers", f"{args.httpserver_workers}", - "--worker-class", - "uvicorn.workers.UvicornWorker", "--bind", f"{args.host}:{args.port}", "--log-level", @@ -353,8 +351,6 @@ def normal_or_p_d_start(args): "--error-logfile", "-", "lightllm.server.api_http:app", - "--timeout", - f"{get_lightllm_gunicorn_time_out_seconds()}", "--keep-alive", f"{get_lightllm_gunicorn_keep_alive()}", ] @@ -407,11 +403,9 @@ def pd_master_start(args): ) command = [ - "gunicorn", + "hypercorn", "--workers", "1", - "--worker-class", - "uvicorn.workers.UvicornWorker", "--bind", f"{args.host}:{args.port}", "--log-level", @@ -422,8 +416,6 @@ def pd_master_start(args): "-", "--preload", "lightllm.server.api_http:app", - "--timeout", - f"{get_lightllm_gunicorn_time_out_seconds()}", "--keep-alive", f"{get_lightllm_gunicorn_keep_alive()}", ] @@ -449,11 +441,9 @@ def config_server_start(args): set_env_start_args(args) command = [ - "gunicorn", + "hypercorn", "--workers", "1", - "--worker-class", - "uvicorn.workers.UvicornWorker", "--bind", f"{args.config_server_host}:{args.config_server_port}", "--log-level", @@ -464,8 +454,6 @@ def config_server_start(args): "-", "--preload", "lightllm.server.config_server.api_http:app", - "--timeout", - f"{get_lightllm_gunicorn_time_out_seconds()}", "--keep-alive", f"{get_lightllm_gunicorn_keep_alive()}", ] diff --git a/lightllm/server/req_id_generator.py b/lightllm/server/req_id_generator.py index 9bf9040c3..f7c099c29 100644 --- a/lightllm/server/req_id_generator.py +++ b/lightllm/server/req_id_generator.py @@ -125,10 +125,14 @@ def _find_sibling_processes(): # 查找兄弟进程 sibling_processes = [] - for proc in psutil.process_iter(["pid", "name"]): + for proc in psutil.process_iter(["pid", "name", "cmdline"]): try: # 检查是否是兄弟进程(同一父进程且不是当前进程) if proc.pid != current_pid and proc.ppid() == parent_process.pid: + # 过滤掉 multiprocessing.resource_tracker 进程 + cmdline = proc.cmdline() + if cmdline and "multiprocessing.resource_tracker" in " ".join(cmdline): + continue sibling_processes.append(proc) except (psutil.NoSuchProcess, psutil.AccessDenied): continue diff --git a/lightllm/utils/envs_utils.py b/lightllm/utils/envs_utils.py index 8995afbc5..7e5cc9656 100644 --- a/lightllm/utils/envs_utils.py +++ b/lightllm/utils/envs_utils.py @@ -74,10 +74,6 @@ def get_deepep_num_max_dispatch_tokens_per_rank(): return int(os.getenv("NUM_MAX_DISPATCH_TOKENS_PER_RANK", 256)) -def get_lightllm_gunicorn_time_out_seconds(): - return int(os.getenv("LIGHTLMM_GUNICORN_TIME_OUT", 180)) - - def get_lightllm_gunicorn_keep_alive(): return int(os.getenv("LIGHTLMM_GUNICORN_KEEP_ALIVE", 10)) diff --git a/requirements.txt b/requirements.txt index 23c59b779..cce994379 100644 --- a/requirements.txt +++ b/requirements.txt @@ -79,7 +79,7 @@ ujson==5.10.0 frozendict==2.4.6 atomics==1.0.3 easydict==1.13 -gunicorn==23.0.0 +hypercorn==0.18.0 flashinfer-python==0.2.4 sgl-kernel==0.3.7.post1 httpx==0.28.1