nginx+uwsgi, cache somewhere but I don't know where

78 views
Skip to first unread message

술욱

unread,
Aug 16, 2016, 11:19:22 AM8/16/16
to django...@googlegroups.com
Hello

I'm running (in production) and app that uses raw queries, something like:

query = """
select table1.field1, table2.field3 
from table1 left join table2 
   on test1.field1 = test2.field1 
   and test1.field2 = test2.field2 
where table1.field1 = %(param1)s
"""

cursor = connections['database'].cursor()
cursor.execute(query, {'param1': param1-value})
data = cursor.fetchall()


My problem is, somewhere, Django, uwsgi, or nginx, is caching this query. 

How do I find who's caching?


Thanks,
Norberto

M Hashmi

unread,
Aug 16, 2016, 11:24:38 AM8/16/16
to django...@googlegroups.com
Reload Nginx and see if still its loading cached query.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CADut3oCG%2Bc%3D8CFm5Mf0YiBtK3RMa-0KrZZG6wb0_ihDwkDmqkQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

술욱

unread,
Aug 16, 2016, 11:34:07 AM8/16/16
to django...@googlegroups.com
I forgot to say I reloaded (and restarted) nginx and uwsgi, but the query is still cached


Thanks anyway!




Avraham Serour

unread,
Aug 16, 2016, 11:44:15 AM8/16/16
to django-users

How do you know the query is cached?


Bill Freeman

unread,
Aug 16, 2016, 12:00:53 PM8/16/16
to django-users

술욱

unread,
Aug 16, 2016, 12:08:41 PM8/16/16
to django...@googlegroups.com
Because this particular query runs in about 30 seconds and its result ends up in an excel file, which is generated with openpyxl from a template.

If I change the template, the file returned by django is this new file, but its contents, the query result, doesn't (and it executes immediately).

Avraham Serour

unread,
Aug 16, 2016, 2:59:59 PM8/16/16
to django-users
did you checked if it cached in the browser? does nginx gets the request? if so what does it answers?


On Tue, Aug 16, 2016 at 7:07 PM, 술욱 <nbe...@gmail.com> wrote:
Because this particular query runs in about 30 seconds and its result ends up in an excel file, which is generated with openpyxl from a template.

If I change the template, the file returned by django is this new file, but its contents, the query result, doesn't (and it executes immediately).

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.

술욱

unread,
Aug 16, 2016, 5:02:02 PM8/16/16
to django...@googlegroups.com
I found the problem. 

We run our MySql in master-slave. Somehow, our slave was out of sync. We updated some tables but this app was reading our slave.

Thanks all!!







Reply all
Reply to author
Forward
0 new messages