0

In order to speed up JBoss startup and use, I copied the contents of my <jboss-home> dir to a big enough tmpfs 'disk'. With this, I was expecting significant speedup.

However, to my surprise, I saw not one bit improvement - neither in startup time, nor in subsequent application use.

How I created tmpfs?

$ mkdir /usr/local/tmpfs-disk
$ mount -t tmpfs -o size=2048m tmpfs /usr/local/tmpfs-disk
$
$ cd /usr/local
$ ln -s tmpfs-disk foo
$ ls -ld foo
lrwxrwxrwx 1 root root 9 Jul 21 00:09 foo -> tmpfs-disk
$
$ cp -a <jboss-home>/* foo/

Verification

$ mount
   ...
tmpfs on /usr/local/tmpfs-disk type tmpfs (rw,size=2048m)
$ df -h
Filesystem            Size  Used Avail Use% Mounted on
   ...
tmpfs                 2.0G  1.3G  785M  62% /usr/local/tmpfs-disk

I'm using Fedora 12.

What am I missing here?

TIA...

Harry
  • 403
  • 1
  • 5
  • 12
  • Did you verify that JBoss is actually using it? – Ignacio Vazquez-Abrams Jul 21 '11 at 06:27
  • 1
    Is your JBoss startup really disk I/O bound? Typical Java Enterprise Applications (...) tend to be like an elephant lying on the ground. If it suddenly needs to run, the startup can be monsterously slow, but after that it may get faster. Or then not. – Janne Pikkarainen Jul 21 '11 at 08:44

3 Answers3

4

Either you're not actually using the tmpfs (probably because you're not actually running the copy of your app that you copied to the ramdisk, but there are other possibilities I'll let you explore), or your performance bottleneck wasn't disk in the first place.

womble
  • 96,255
  • 29
  • 175
  • 230
3

Modern OSes are actually pretty good about caching stuff in RAM. The best way to make sure is to force clear the cache (from another stack overflow: sync && echo 1 > /proc/sys/vm/drop_caches) and then the startup (and really only the startup) will be faster.

David
  • 501
  • 4
  • 2
  • 2
    The kernel tends to be much smarter than your average sysadmin on determining what should be cached and what shouldn't. There's a whole lotta caching going on of stuff you don't really get to see from user's perspective. I tend to clear caches only for testing. For actual production, I'd leave it alone in 99% of cases. Or to quote Agent Smith: Never send a human to do a machine's job. ;) – Marcin Jul 21 '11 at 12:52
  • @David Why should clearing the cache make startup faster, shouldn't startup be slower after a cache clearing...? because the disk has to be read again to populate the cache? – Harry Jul 24 '11 at 04:44
0

Try and check with vmstat is your memory is being swap out to disk.

If it is, then you can try to tune your fedora kernel vm.swappiness value. By default on RHEL is 60. Try change it to zero.

That kernel parameter decide how aggressively memory pages are swap to disk.

Muhammad
  • 699
  • 10
  • 20