3
我已經在Django中編寫了一個服務器應用程序,並向Tastypie的移動應用程序提供API,並使用本地MySQL服務器爲該數據庫提供服務。Django,nginx和uWSGI緩存結果直到uWSGI/MySQL重新啓動
似乎查詢被緩存直到進程被終止或終止。如果我在後端創建一個新用戶,它將首先出現在列表中,如果我重新啓動uWSGI或MySQL,或者如果我從另一個瀏覽器登錄到後端。
MySQL進程列表
41 example localhost:58747 example 13 Sleep
42 example localhost:58748 example 16 Sleep
另外,如果我殺了這些Sleep'ed它也將觸發數據的刷新過程。
uWSGI配置
[uwsgi]
vhost = true
plugins = python
socket = /tmp/example.com.sock
master = true
enable-threads = true
processes = 2
wsgi-file = /var/sites/example-server/example/example/wsgi.py
virtualenv = /var/sites/example-server/PYTHON_ENV
chdir = /var/sites/example-server/example
touch-reload = /var/sites/example-server/example/reload
nginx的配置
server {
client_max_body_size 20M;
listen 80;
server_name example.com;
access_log /var/log/nginx/example.com_access.log;
error_log /var/log/nginx/example.com_error.log;
location/{
uwsgi_pass unix:///tmp/example.com.sock;
include uwsgi_params;
}
location /media/ {
alias /var/sites/example-server/example/example/media/;
}
location /static/ {
alias /var/sites/example-server/example/example/static/;
}
}
的my.cnf
[client]
port = 3306
socket = /var/run/mysqld/mysqld.sock
[mysqld_safe]
socket = /var/run/mysqld/mysqld.sock
nice = 0
[mysqld]
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking
bind-address = 127.0.0.1
key_buffer = 16M
max_allowed_packet = 16M
thread_stack = 192K
thread_cache_size = 8
myisam-recover = BACKUP
query_cache_limit = 1M
query_cache_size = 16M
log_error = /var/log/mysql/error.log
expire_logs_days = 10
max_binlog_size = 100M
mysqldump]
quick
quote-names
max_allowed_packet = 16M
[mysql]
[isamchk]
key_buffer = 16M
transaction-isolation = READ-COMMITTED
!includedir /etc/mysql/conf.d/
我能做些什麼,使這個問題消失?
乾杯 莫滕