optimze nginx cache purge

Hi everyone,

The script that we currently use to clear the nginx cache is taken from [login to view URL] And it's very slow; it make take more than an hour. We've found out that in nginx cache, the 2nd or 3rd line of each file in the cache folder contains a text-reference to the original file name and path; and so we thought we could use "grep" to make script that performs better. This is what we came up with:

find /var/cache/nginx -type f -print0 | xargs -0 grep -lZ "12345678" < <(head -n 5 $1) | xargs -0 rm

In that line the "12345678" is a part of the original request URL. Here is a sample of what is it looks like when I do "head -n 5 /var/cache/nginx/2/34/a773fbbc414d97a4b59719c93b060222" (that's one of the cache files)


KEY: /vod/12345678/[login to view URL]

HTTP/1.1 200 OK

Date: Wed, 07 Nov 2018 10:42:58 GMT

Server: Player/3.5.3-2

It works, but it's still relatively slow (around 30 minutes if there's a lot in cache). Do you think it's possible to make this fast(er)?

Квалификация: Linux, MySQL, Администрирование сети, Server, Системное администрирование

Показать больше nginx cache, ie6 temporary cache purge swf, nginx cache type, nginx cache 404, nginx cache not working, nginx cdn cache, nginx etag, nginx pragma no-cache, nginx cache tutorial, nginx cache in memory, proxy_cache_bypass $http_upgrade, nginx cache images, nginx cache configuration, nginx cache module, vertex must reach vertices fast possible, nginx cache server, nginx cache configure, составить сНОва иС йукв Đž Đż р с т, nginx cache wordpress, nginx cache dynamic content

О работодателе:
( 100 отзыв(-а, -ов) ) Jhang Sadar, Pakistan

ID проекта: #18922295

4 фрилансеров(-а) в среднем готовы выполнить эту работу за $164


Hi there! I see you are looking for an nginx expert. I would be happy to help you. It takes much time if hdd you serve nginx on is slow. As this cache is directory-based structure, so traversting the path is the most Больше

$155 USD за 3 дней(-я)
(36 отзывов(-а))

Hello Hope you are doing well . I have 6 years of experience in Linux and system administration. I can handle this project. Regards VishnuLal*

$200 USD за 3 дней(-я)
(81 отзывов(-а))

Good day. Can help You with further speed otimization of this sample nginx shell cache purge script. Think can manage more quick result in the end. Tnx and Regards.

$200 USD за 1 день
(28 отзывов(-а))

Hi, I have read your exact requirements and checked the script you are using. I understood the issue and will fix it as per your guidance. I have +7 years of experience as a Linux Administrator. Regards Karuna

$100 USD за 2 дней(-я)
(21 отзывов(-а))