我的 Django 项目正在运行gunicorn。有时加载页面(以及相关的 oracle 过程调用)需要很长时间。这种情况在服务器保持不活跃对于一些分钟。
我该如何解决这个问题?
wsgi.py
import os
import site
import sys
from whitenoise.django import DjangoWhiteNoise
# Add the site-packages of the chosen virtualenv to work with
site.addsitedir('/new_esmart/esmart_env/lib/python2.7/site-packages')
# Add the app's directory to the PYTHONPATH
sys.path.append('/new_esmart/esmart2')
sys.path.append('/new_esmart/esmart2/esmart2')
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "esmart2.settings")
# Activate your virtual env
activate_env = os.path.expanduser("/new_esmart/esmart_env/bin/activate_this.py")
execfile(activate_env, dict(__file__=activate_env))
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
application = DjangoWhiteNoise(application)
统计数据
total used free shared buffers cached
Mem: 3962 3727 234 0 394 2268
-/+ buffers/cache: 1064 2897
Swap: 4095 0 4095
机器
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 2
On-line CPU(s) list: 0,1
Thread(s) per core: 1
Core(s) per socket: 2
Socket(s): 1
NUMA node(s): 1
Vendor ID: GenuineIntel
CPU family: 6
Model: 45
Stepping: 7
CPU MHz: 1995.000
BogoMIPS: 3990.00
Hypervisor vendor: VMware
Virtualization type: full
L1d cache: 32K
L1i cache: 32K
L2 cache: 256K
L3 cache: 15360K
NUMA node0 CPU(s): 0,1