Cutton Eye
Cutton Eye

Reputation: 3569

tmp file exists for some ms, will it be written to SSD?

Is a file stored to disc, when only present for a fraction of a second? I'm running with python 3.7 on ubuntu 18.04.

I make use of a python script. This script extracts json-files from a zip-package. Resulting files will be processed. Afterwards the resulting files well be deleted.

As I'm running on an SSD. I want to spare write cycles to it.

Does linux buffer such write cycles to the RAM, or do I need to assume, that I'm forcing my poor SSD into sever thousend write cycles per second?

Upvotes: 0

Views: 42

Answers (1)

John Bollinger
John Bollinger

Reputation: 181859

Linux may cache file operations under some circumstances, but you're looking for it to optimize by avoiding ever committing a whole sequence of operations to storage at all, based on there being no net effect. I do not think you can expect that.

It sounds like you might be better served by using a different filesystem in the first place. Linux has memory-backed file systems (served by the tmpfs filesystem driver, for example), so perhaps you want to set up such a filesystem for your application to use for these scratch files.1 Do note, however, that these are backed by virtual memory, so, although this approach should reduce the number of write cycles on your SSD, it might not eliminate all writes.


1 For example, see https://unix.stackexchange.com/a/66331/289373

Upvotes: 1

Related Questions