Wednesday, June 30, 2010
Recently I have been looking more into the mobile platform (mainly Android) and have discovered a whole new set of conferences which all of a sudden seem really interesting. These are
Tuesday, June 29, 2010
Using Java VisualVM with JBoss AS 5.1
Java VisualVM is a nice little tool for monitoring any Java application. I used it for monitoring a JBoss AS 5.1 server and had to add some system properties to the run.sh/run.bat file before it would let me connect. The system properties are
# Enabling JMX for remote monitoring using port 1234 JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.port=1234" JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.authenticate=false" JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.ssl=false"Start the server, start VisualVM and connect to the server either by clicking on the JBoss server (by PID) if VisualVM and the server is running on the same machine or by specifying the server as a remote host (by JMX).
While deploying a pretty simple web application on JBoss AS 5.1 (using the default profile) I noticed some weird cyclic CPU spikes even without ANY load on the server. It would start right after the server was started and the spikes would use ~40% of the CPU. Not exactly satisfying. I did the usual trip around the good, old web and quickly found out that the administration console in JBoss AS 5.x would create these hiccups. I deleted the administration console and saw CPU utilization drop to ~10%. That is what I call improvement.
While searching the web I found this little piece on how to optimize JBoss AS 5.x. And yes, it does include removal of the administration console as well.
Friday, June 25, 2010
Eclipse and JBoss AS 5.1 with minimal configuration
As I explained yesterday I managed to improve startup times of my JBoss AS 5.1 server dramatically by fiddling a little with the web profile provided by Red Hat. It did however give me some problems when I wanted to start/stop/deploy my web project from Eclipse since this all of a sudden did not work anymore. I decided to fix this and this is what I did.
Use the JRMP invoker proxy
Either copy the jmx-invoker-service.xml from the default profile into your deploy directory of your profile or apply these changes to your jmx-invoker-service.xml file.
Enable the listening port for the JNP service
Edit the MBean NamingService in the jboss-service.xml file found in the conf directory.
Voila! You should now be able to start, stop and deploy your web apps in Eclipse.
Thursday, June 24, 2010
Minimal JBoss AS 5.1 configuration
When I deploy applications on the JBoss AS platform I normally just use the default profile provided by Red Hat. JBoss AS 5.1 is however horrendously slow when starting up so I decided to look into the other (lesser) profiles to see if this would speed things up a bit. I am running a standard web application (packaged as a .war file) based on JSF 1.2 (Sun RI) and Hibernate which accesses an Oracle database.
JBoss AS 5.1 comes with 5 profiles; all, default, minimal, standard and web. I decided to use the web profile since this one (supposedly) supports jdbc and web applications out of the box. As you might guess this was not my experience at first hand since the profile would not recognize my datasource. It came up short with this error message:
16:03:47,718 ERROR [ProfileServiceBootstrap] Failed to load profile: Summary of incomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS):
DEPLOYMENTS MISSING DEPENDENCIES:
Deployment "jboss.jca:name=jdbc/mydatasource,service=DataSourceBinding" is missing the following dependencies:
Dependency "jboss:service=invoker,type=jrmp" (should be in state "Create", but is actually in state "** NOT FOUND Depends on 'jboss:service=invoker,type=jrmp' **")
DEPLOYMENTS IN ERROR:
Deployment "jboss:service=invoker,type=jrmp" is in error due to the following reason(s): ** NOT FOUND Depends on 'jboss:service=invoker,type=jrmp' **
The solution to this was to copy the legacy-invokers-service.xml file from the default profile directory into the web profile directory and everything deployed nicely and worked as expected. The end result? Before startup would take 54 seconds, now it is down to 12 seconds. And this could probably be optimized more by removing additional unused elements (like support for Hypersonic databases).
Thursday, June 10, 2010
I recently did a little writeup on some NAS products in the budget price range. I finally decided to buy a ReadyNAS RND2000 with 2 1 TB Seagate harddrives but bailed out in the last minute only to reconsider why I needed a NAS. I basically just wanted to have a common fileserver for all my computers at home and I wanted it to be really power efficient. I believe the ReadyNAS server is pretty power efficient but I have an old Mac Mini G4 in the basement which does not do anything at the moment. I remember I was pretty excited about the power consumption of the Mac when I first got it (20W work, close to nothing when idle) so I have decided to turn the Mac into my NAS/fileserver. I do not need RAID just a proper backup plan.
So now I am in the process of upgrading the hardware of the Mac. I am upgrading the memory from 512Mb to 1Gb and upgrading the harddrive from 80Gb to 320 Gb. A sideeffect to all this is that I can get rid of my old noisy Ubuntu box in the basement as well which I use as a regular desktop computer. The Mini will handle that from now on. I really do not know why I never thought of this before.
The only concern I have with the Mac Mini now is that I want it to go to sleep when it is not in use and wake up when someone tries to access data stored on it. My first experience with this was that when it first went into sleep mode I had to press a key on the keyboard of the Mac itself, which is not very convenient when it is in the basement. I could just configure it to not to go into sleep mode at all but that kind of defies the purpose of using it as a (power-efficient) NAS.
I stumbled across this little tip on the net. If you execute this Python script on any computer trying to access the Mac it should wake up from its sleep mode. The MAC address of the Mac (no pun intended) needs to be specified in the scripts (in this case it is set to 00 24 36 f0 c4 69).
The only problem with this is that you have to run the script when you want to access something on the Mac. I am planning to put all my music on the Mac and then access it from devices which may not be able to execute such a script (like the Logitech Squeezebox Duet). I have not quite figured out how to solve this yet but since it is not a problem right now (I do not own a Squeezebox) I will take care of this later. The good thing with this script is that you can run it on any platform supporting Python. I have successfully tested it with both Linux (Ubuntu 8.04) and Windows XP.Newer Posts Older Posts
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM);
s.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1);
s.sendto('\xff'*6+'\x00\x24\x36\xf0\xc4\x69'*16, ('192.168.0.255', 9));