Posted on November 21, 2008 in Java, Software Development by Rob Di Marco1 Comment »

Recently, I’ve been working a bunch with Grinder to do some load testing.  I’ve had great success with it in the past, and wanted to punish an app.  My test needs to make HTTP and HTTPS requests which I never anticipated would be a problem.  Unfortunately, my server has a self-signed certificate which the Java processes refused to recognize.  I tried adding the certificates through the Java Console but that led to these weird no peer exceptions (shudder).

I figured that I would have to use keytool to load the certificates.  What I did not realize is that you cannot load a self-signed key where you already have a certificate using keytool directly!  So I had to follow the following steps

  1. Convert my certs from PEM format into DER format
> openssl pkcs8 -topk8 -nocrypt -in server.key \
-inform PEM -out key.der -outform DER > openssl x509 -in server.csr -inform PEM \
-out cert.der -outform DER
  1. Use the Java code from this AgentBob post to create a keystore

> java -Dkeystore=mycerts ImportKey key.der cert.der

  1. Now when running the TCPProxy, I had to add the following:

java -Djavax.net.debug=all -classpath $GRINDER_JAR \

net.grinder.TCPProxy -console -http \

-keystore mycerts -keyStorePassword importkey

  1. To use the certs from my Agent process


from java.lang import Systemgrinder.SSLControl.setKeyStoreFile(System.getProperty("keystore"),System.getProperty("keypass"))
  1. Finally, I needed to add this to the properties file for my Grinder agent process

grinder.jvm.arguments=-Dkeystore=mycerts -Dkeypass=importkey

And tada it works! One other tidbit: using -Djavax.net.debug=ssl was invaluable in debugging. You can use -Djavax.net.debug=help to find out all of the debug options.

Posted on November 12, 2008 in Software Development by Rob Di MarcoNo Comments »

As some of you may know, it has been a tough time for my wife and I.  This anecdote from her graduate school adviser really cheered me up.

My student Guoqing who is from China is always full of stories and proverbs and good advice. When he was young he dreamed of being a writer and from what I can tell, he writes like crazy still, not just science but about many topics.  Then he became a dancer. But at some stage his father told him that it wasn’t good for him to be a dancer, because he is a boy and also, because he has to make a living.  So his father told him he should become a scientist.  At that stage, that very year, it was possible to take the national exam and switch fields between high school and college.  He did well on the exam, in composite, and had the opportunity to go to the top science school, USTC.  Of course, with little background and training, that was no easy task to try to catch up, fit in, and manage. At first, he said he failed quite miserably and got very bad grades and he had to study like crazy.  Some people would be bitter and angry about this I guess, but he said that his father has always given him good advice and so there was no reason not to listen to him then too. Of course, now Guoqing is a truly outstanding scientist, a natural in terms of creativity, drive and insight….But the reason I am telling you this story is this.  He said that at one stage, when things were trully horrible, in that adjustment process, he told his father…that it was horrible, he was depressed and things couldn’t be worse.  His father told him that was great news because then that meant it could only get better from there.  I was talking to Guoqing about difficulty today too, and he said to tell you about sine and the derivative cosine.  I said, what?!  He went to the board and drew it out, the waves, pointing out that when things are at their peak, in fact the change or derivative is zero. However when things are very low or at zero, then the potential for change is greatest.  I think he was trying to say that it’s not just about the highs and lows, but also the potential for change and also, there can be bigger meaning beyond…difficulty sometimes.  There was more to it when he explained this today, and I am not doing it justice.

I like the idea of life as the sine curve.  When things are good, stay grounded as you may be losing momentum.  When things are low, know that there is more potential now for growth than ever.