Usually, while working with web applications, I need to redeploy it several times a day. As we all know, waiting for build (clean-compile-build-deploy) to finish is big pain in the ass ( aka bottleneck ;)) This note is valid for temporary build ( those going by default to JBOSS_HOME/server/default/temp directory and for computers with big amount of RAM. Idea is very simple – use RAM as virtual drive, and put jboss deploy directory on it (only temp, not all jboss!)
0. Is your computer able to handle this?
We need a lot of free ram to put there jboss build directory. During your working day, check amount of your used / free memmory. Do not count allocated memmory (calculated together with page file), but only phisical RAM. When we create ram disk, and it (or something else) mus bu catched on HDD this solution does not make sense! Than, check how much memmory is taken by your deployed applications. In my case ( 4GB ram in total, used max 2.5 Gb for Windows, Eclipse, some tools, running jboss, foobar2000, browsers, etc. ). Jboss build takes maximum 500-600Mb (without precompilation of jsps). In this case, I decided to allocate 1GB of RAM disk, which should be enough ( almost 100% of reserve for jboss, 500Mb left for system).
1. Create RAM disk.
1. Go and grab RAMdisk here. 2. Install the programm, I used 1Gb, media type “Fixed media” (“RAM Drive” causes reboot btw.) and R for drive letter (who will guess why?).
2. Change JBOSS configuration to write /tmp into ram drive.
Edit run.bat ( JBOSS_HOME/bin/run.bat ). Do not use run.config because it”s platform dependent. Find place to add JAVA_OPTS ( after all are defined, but before they are read ). Add following line:
rem RAMDISK set JAVA_OPTS=%JAVA_OPTS% -Djboss.server.temp.dir=R:/temp/jboss
This simply adds JBOSS property jboss.server.temp.dir which points to your RAM disk. According to this programm”s specification, do not use the root of this disk ( always write inside /temp ). Btw, description of other JBOSS properties can be found here. Now restart your server, when it”s up some files should appear in the RAM disk. In my case time decreased from 5:30 to 4:02. Improvements depends on some things ( speed of your HDD, number of files to deploy, etc. ). You must check by yourself, consider how many deploys you”re doing during the day, and decide if it”s worth grabbing your RAM or not. And remember once again, that files will disapear on power failure or BSOD. ( for those who likes modifing files with “hot deploy” ) Good luck!