Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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...

share|improve this question
    
Did you verify that JBoss is actually using it? –  Ignacio Vazquez-Abrams Jul 21 '11 at 6: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 8:44

3 Answers 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.

share|improve this answer
1  
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 4:44

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.

share|improve this answer
3  
Java is its own bottleneck. runs –  Ignacio Vazquez-Abrams Jul 21 '11 at 6:48
    
True, but not constructive. –  womble Jul 21 '11 at 7:04
1  
If it was constructive then I wouldn't have had to run. –  Ignacio Vazquez-Abrams Jul 21 '11 at 7:06
    
@womble: Would greatly appreciate if you could list those options/cases where it's possible that tmpfs is failing to actually get used. –  Harry Jul 21 '11 at 8:20
    
I've edited my answer to include the most common option; there are too many possible options to enumerate them all; that's why you (should) have diagnostic skills. Also, appreciation on Server Fault is expressed in terms of upvotes, which I notice you're yet to take advantage of anywhere. –  womble Jul 21 '11 at 8:45

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.