S
S
Stan_12014-05-18 15:32:08
linux
Stan_1, 2014-05-18 15:32:08

How dangerous is caching by means of the Linux operating system?

In a new project, I want to reuse one of my experiences, but I was once frightened by one expertise. Therefore, I would like to clarify the opinion of the public.
So, at one time I encountered the slow work of PostgresSQL, namely, with a table that was rarely accessed. In this case, the PG "warms up", and the first requests can be answered in tens of seconds. I know that on large projects, some people practice special scripts for "warming up" the database in the morning, but I don't really like this option.
I had experience when I "collected" samples from the database, and just put them on the server as a file. After that, when the user requested data, I simply took the finished file from the file system and gave it away. The speed was phenomenal, measured in tens, not hundreds of milliseconds.
But one day I was told that this is not the way to do it, because this approach kills the hard drive due to multiple accesses to the file system. It sunk into my brain, and hence the question is - is it really so?
Engineering it seems to me that no:
1. The file system caches files, and they should not be re-requested from the database every time.
2. Many control scripts (such as cat, grep, ps) are used by many in bash scripts, and no one thinks about the risks to the file system.
3. HTML caching in Ruby works much the same way - storing files in the file system.
But maybe I'm missing something?
I will be glad for answers!

Answer the question

In order to leave comments, you need to log in

3 answer(s)
V
Vlad Zhivotnev, 2014-05-18
@inkvizitor68sl

About disks - it's all nonsense. Disks have been dying for a long time for reasons much more prosaic (marriage, shock, temperature) than wear.
And even modern ssds, contrary to popular belief, die very rarely from recording (it takes a lot of effort to kill ssd with recordings).
But still, it is more correct to warm caches with scripts if your data in the database changes.

S
Sergey, 2014-05-18
Protko @Fesor

ssd, frequent overwriting will kill, but as I understand it, it is not so frequent with you. And in order to kill hdd like that, you need to try.
On the other hand, in postgress itself there are a lot of options for caching the selection, especially critical selections can generally be stored in memory. You can set up the file system cache to keep files in memory for some time and reduce access to it.
Weight options.
ps It's a bit unclear what you mean about the cat/grep/ps utilities... They just work with text streams, and they don't really care whether they access the file system or the stream comes to them from memory.

P
Puma Thailand, 2014-05-19
@opium

some kind of nonsense
to argue any call from the phone kills him, let's not call
anyway, your access to the file is much simpler and more careful than accessing the database

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question