How to filter out identical double requests on server

I've noticed that my Django application from time to time makes double database queries, instead of just one. The log file shows two similar requests at (almost) the exact same time.

Example:

[pid: 749|app: 0|req: 892/2837] x.x.x.x () {44 vars in 896 bytes} [Fri Sep  9 12:00:55 2016] GET /clinic_profile/61 => generated 0 bytes in 1 msecs (HTTP/1.1 301) 3 headers in 134 bytes (1 switches on core 0)
[pid: 750|app: 0|req: 659/2838] x.x.x.x () {44 vars in 898 bytes} [Fri Sep  9 12:00:55 2016] GET /clinic_profile/61/ => generated 84989 bytes in 374 msecs (HTTP/1.1 200) 3 headers in 102 bytes (1 switches on core 0)

This is a critical flaw in my system and I need to fix it asap.

Question: How can I filter out double requests?

Im using Django, Nginx and Ubuntu 14.04

-1
задан 9 September 2016 в 16:02
2 ответа

Это не похоже на двойной запрос к базе данных , но 301 редирект с / clinic_profile / 61 на / clinic_profile / 61 / (добавляет косую черту в конце)

1
ответ дан 5 December 2019 в 19:46

Для трафика чтения используйте кеш перед база данных защищает базу данных от выполнения повторяющихся запросов. У Django есть структура кеширования:

https://docs.djangoproject.com/en/1.10/topics/cache/

0
ответ дан 5 December 2019 в 19:46

Теги

Похожие вопросы