perf: 优化 host api 和 gunicorn 参数

pull/10989/head
ibuler 2023-07-17 14:32:34 +08:00 committed by Bryan
parent 7b9c4b300d
commit daef154622
2 changed files with 7 additions and 3 deletions

View File

@ -122,8 +122,12 @@ class AssetViewSet(SuggestionMixin, NodeFilterMixin, OrgBulkModelViewSet):
]
def get_queryset(self):
return super().get_queryset().prefetch_related('nodes', 'protocols')\
queryset = super().get_queryset() \
.prefetch_related('nodes', 'protocols') \
.select_related('platform', 'domain')
if queryset.model is not Asset:
queryset = queryset.select_related('asset_ptr')
return queryset
def get_serializer_class(self):
cls = super().get_serializer_class()

View File

@ -1,5 +1,5 @@
from ..hands import *
from .base import BaseService
from ..hands import *
__all__ = ['GunicornService']
@ -22,7 +22,7 @@ class GunicornService(BaseService):
'-b', bind,
'-k', 'uvicorn.workers.UvicornWorker',
'-w', str(self.worker),
'--max-requests', '4096',
'--max-requests', '40960',
'--access-logformat', log_format,
'--access-logfile', '-'
]