Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

Add time cost when start servers (#12552)

Jin Haia7dd3b7e9e66
diff --git a/admin/server/admin_server.py b/admin/server/admin_server.py
index b8c96a62c4..2fbb4174c0 100644
--- a/admin/server/admin_server.py
+++ b/admin/server/admin_server.py
@@ -14,10 +14,12 @@
# limitations under the License.
#
+import time
+start_ts = time.time()
+
import os
import signal
import logging
-import time
import threading
import traceback
import faulthandler
@@ -66,7 +68,7 @@ if __name__ == '__main__':
SERVICE_CONFIGS.configs = load_configurations(SERVICE_CONF)
try:
- logging.info("RAGFlow Admin service start...")
+ logging.info(f"RAGFlow admin is ready after {time.time() - start_ts}s initialization.")
run_simple(
hostname="0.0.0.0",
port=9381,
diff --git a/api/ragflow_server.py b/api/ragflow_server.py
index 26cd045c4d..193efff3b2 100644
--- a/api/ragflow_server.py
+++ b/api/ragflow_server.py
@@ -18,8 +18,8 @@
# from beartype.claw import beartype_all # <-- you didn't sign up for this
# beartype_all(conf=BeartypeConf(violation_type=UserWarning)) # <-- emit warnings from all code
-from common.log_utils import init_root_logger
-from plugin import GlobalPluginManager
+import time
+start_ts = time.time()
import logging
import os
@@ -40,6 +40,8 @@ from api.db.init_data import init_web_data, init_superuser
from common.versions import get_ragflow_version
from common.config_utils import show_configs
from common.mcp_tool_call_conn import shutdown_all_mcp_sessions
+from common.log_utils import init_root_logger
+from plugin import GlobalPluginManager
from rag.utils.redis_conn import RedisDistributedLock
stop_event = threading.Event()
@@ -145,7 +147,7 @@ if __name__ == '__main__':
# start http server
try:
- logging.info("RAGFlow HTTP server start...")
+ logging.info(f"RAGFlow server is ready after {time.time() - start_ts}s initialization.")
app.run(host=settings.HOST_IP, port=settings.HOST_PORT)
except Exception:
traceback.print_exc()
diff --git a/rag/svr/sync_data_source.py b/rag/svr/sync_data_source.py
index eb4445d8e0..764bee8307 100644
--- a/rag/svr/sync_data_source.py
+++ b/rag/svr/sync_data_source.py
@@ -19,6 +19,9 @@
# beartype_all(conf=BeartypeConf(violation_type=UserWarning)) # <-- emit warnings from all code
+import time
+start_ts = time.time()
+
import asyncio
import copy
import faulthandler
@@ -27,7 +30,6 @@ import os
import signal
import sys
import threading
-import time
import traceback
from datetime import datetime, timezone
from typing import Any
@@ -1266,6 +1268,7 @@ async def main():
signal.signal(signal.SIGINT, signal_handler)
signal.signal(signal.SIGTERM, signal_handler)
+ logging.info(f"RAGFlow data sync is ready after {time.time() - start_ts}s initialization.")
while not stop_event.is_set():
await dispatch_tasks()
logging.error("BUG!!! You should not reach here!!!")
diff --git a/rag/svr/task_executor.py b/rag/svr/task_executor.py
index d397898410..7e2352a9bd 100644
--- a/rag/svr/task_executor.py
+++ b/rag/svr/task_executor.py
@@ -12,6 +12,10 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
+
+import time
+start_ts = time.time()
+
import asyncio
import socket
import concurrent
@@ -21,7 +25,6 @@ import concurrent
import random
import sys
import threading
-import time
from api.db import PIPELINE_SPECIAL_PROGRESS_FREEZE_TASK_TYPES
from api.db.services.knowledgebase_service import KnowledgebaseService
@@ -1322,6 +1325,8 @@ async def main():
report_task = asyncio.create_task(report_status())
tasks = []
+
+ logging.info(f"RAGFlow ingestion is ready after {time.time() - start_ts}s initialization.")
try:
while not stop_event.is_set():
await task_limiter.acquire()