1

i've made a ramdisk this way:

mkdir -p /media/ramdisk
mount -t tmpfs -o size=512M tmpfs /media/ramdisk/

The reason for this is because i run a lot of node.js scripts and their execution time is very small, but i suspect that the time overhead is because it reloads the node.js executable from disk and destroys it on each subsecuent run. So i think this might be the solution to gain a bit, if not much, performance. How can i move a program like node to the ramdisk and run it from there? The idea is to have a startup script that creates the ramdisk and puts the node files inside of it. Note that i'm currently using fedora 16 for what's it's worth. Thanks in advance.

alfa64
  • 127
  • 2
  • The file contents are probably already cached in RAM if they're accessed frequently, as ErikA explained. But node.js probably still has to *parse* the JavaScript code each time. That's a matter of CPU time, not disk access. – Wyzard Jun 19 '12 at 00:46

1 Answers1

5

If the scripts are being read frequently, they will reside in the kernel's read cache, and thus are already being read from memory.

EEAA
  • 109,363
  • 18
  • 175
  • 245
  • The scripts are not written into disk, they exist as the input to node.js – alfa64 Jun 19 '12 at 02:13
  • Regardless, if they are accessed by *anything* on the system, they will be in the kernel's read cache. – EEAA Jun 19 '12 at 02:45