Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clean-temp on deleting too much? #86

Closed
igorescobar opened this issue May 27, 2020 · 9 comments
Closed

clean-temp on deleting too much? #86

igorescobar opened this issue May 27, 2020 · 9 comments

Comments

@igorescobar
Copy link

Yesterday I decided to give a go on a flag called clean-temp on. My cache was around 50+ GiB and everything was going fine.

This morning the cache was half of it (!) and the number of cache MISS increased a lot. Before only like 10% of the request was actually a MISS and now only ~60-65% is a MISS.

I'm using the latest stable docker image.

@jiangwenyuan
Copy link
Owner

jiangwenyuan commented May 27, 2020

@igorescobar If you have multiple instances pointing to same directory, you should avoid use clean-temp.

If one instance is creating cache(writing to temp dir), and if another instance starts, it will delete all temp files if clean-temp is on. So the creating by previous instance will fail.

But it has nothing to do with real cache files and requests, as it only happens on start and will stop before receive requests.

Previous versions delete temp files on start, I just add an option to disable that. As I did not expect the use cases like yours: multiple instances pointing to same disk directory.

@igorescobar
Copy link
Author

Is there a way to disable the usage of these temp files?

Nginx has this use_temp_path=on|off that basically work around temp file issue but I'm not sure how they implemented it.

I hope I'm not annoying you by mentioning Nginx all the time. I'm just using it as a reference so you can compare it with some other tool that does something similar. 😅

@jiangwenyuan
Copy link
Owner

Not at all:)

Nginx uses temp files also, use_temp_path on|off just controls where nginx puts the temp files, the one defined by proxy_temp_path or the default one.

@igorescobar
Copy link
Author

igorescobar commented May 27, 2020

NGINX first writes files that are destined for the cache to a temporary storage area, and the use_temp_path=off directive instructs NGINX to write them to the same directories where they will be cached. We recommend that you set this parameter to off to avoid unnecessary copying of data between file systems. use_temp_path was introduced in NGINX version 1.7.10 and NGINX Plus R6.

@igorescobar
Copy link
Author

So, If I got it right... what this does is... instead of saving a temp file somewhere and then move it afterwards to the actual cache directory it will save the temp file directly on the actual official destination.

Would this avoid the creation of temp files that would be there forever if no one cleans it?

@jiangwenyuan
Copy link
Owner

No, nginx creates temp files anyway. If it's in same directory, the move is cheap. If the temp directory is on a different file system, the move is expensive(copy).

@igorescobar
Copy link
Author

So, how do I get rid of these temp files running multiple containers? 🤔

@jiangwenyuan
Copy link
Owner

jiangwenyuan commented May 27, 2020

No need. If nuster quits normally, there's no temp file left. And if there are too many temp files, just delete that. And the temp files are harmless, you can leave them there as long as the disk space is not your concern. Besides, even if the temp files which are used by some instance are deleted, there's no harm. Next request will create that again.

So as of now, there's no need to worry about that.

@igorescobar
Copy link
Author

Ok, So the recommendation is to live is off if you have this 1+ containers/instances pointing to the same volume. 👍

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants