Archive

Archive for the ‘coding’ Category

Stress Testing the application!

April 13th, 2010

Yesterday I needed to quickly test one of web modules for performance. Easiest way was to do some stress testing, simulate real world environment (100 users hitting url at the same time) and then checking the service response time. It looked simple, I just needed a stress-testing tool, which could take url of my webpage and return me the performance data. But it turned out much more complex than that.

First shock came when I came to know that not many professionals are doing stress testing for their applications. I checked with some of my friends and got the same answer that they were not doing stress testing. How could I blame others when I did stress testing for one of my applications like 4 years ago.

Anyway, I knew that I would have to figure out things from scratch. I was told about Apache Benchmark (ab).  That looked promising to start with and I was able to get some performance data for static sites. But I was not able to look at the output, that ab was bringing back from the site. I tried to figure out how to check it for some time, but it turned out to be complex process, and I wanted to get over with the testing as soon as possible as other pending work was waiting.

So I though of using some UI based tool rather then command based (that’s the disadvantage of getting used to Windows). I googled around and found Jmeter, which looked very promising, and my kind of tool (open source). Again it started off well. And this time I was able to get back the output. The Jmeter could show the output in multiple formats, including HTML. This also helped to see that the output I was getting back from website was actually an error message instead of the correct page. The tool was showing the test case as success, because the error message was actually embedded in the correct HTML page (based on some conditions, it was to be shown or hidden). Now I figured out that this was because the tool was not able to set values in session for multiple test cases. Jmeter looked promising and I was sure that there must be some place where I could set the session settings (it had a lots of settings options for cache/ cookies etc). But too many setting options could only confuse. I again spent a couple of hours on this tool before giving up.

Time was running out, and I needed a tool that could help me testing my application without much complexity. So I thought of trying trial version (14 days or some limited features) of some paid software, when I figured out webserver stress tool’s. That worked like piece of cake. All the required settings were just 3-4 screens. Setting up sessions meant just checking the check-box for cookies. Clear output files with detailed logs, Summary log, and logs for each user simulated, url logs etc made it easier to compare different performance parameters. The paid version is also cheap (less than 250$) for this.

Anyone has better ideas for load/ stress/ performance testing of the application?

kamal Java, Testing, coding

Struts in Seven Minutes!

June 11th, 2009

Ok! The title of the post is because that sounded kool.. but still it could not get easier than this - http://www.allapplabs.com/struts/struts_example.htm

kamal Java, coding

Difference between visibility hidden vs display none

June 5th, 2009

I spent almost an entire day on this, so wanted to share the information in case it might be helpful for others. We at times need to remove a DOM object (textbox/ label/ dropdown etc) from the UI. For which we use two things object.style.visibility=”hidden” and object.style.display=”none”. Though both of them can remove the object from UI, yet there is a significant difference between these two approaches. Whereas visibility hidden will “hide” the object, it will still leave the object on the UI (in hidden format). On the other hand display=”none” will completely remove the object from UI.

The differentiation is more important in a case, where the css being used here does not specify the x and y coordinates for DOM objects, it instead places one object after another. So the trick here is, if I make an object invisible by hiding it (visibility=”hidden”), it will still occupy that one space in the flow, and a blank cell will appear on the screen. Whereas if display is none, then the next object will take place of this object and hence no empty spaces are shown on the screen.

So both the approaches can be used as per ones requirement

kamal AJAX, DOM, Design, JavaScript, coding

Association vs Aggregation

May 26th, 2009

Short and Simple explanation- http://ootips.org/uml-hasa.html

kamal Design, Java, coding

Redundancy Vs. Reuse

May 13th, 2009

We faced a typical software engineer problem recently, that should we have multiple copies of similar code? Obvious answer is “NO”

But Lets say, you are dealing with multi hundred thousand lines of code. There is a pressure of deadline. You know that there are already some module which is providing the similar solution as you want, and just adding one if else, and making some tweaking in that code will save you from writing hundreds of lines of code. Isn’t it tempting to do that.

Ideally, we would like to get that code which is common in both cases to some common util area, where both modules can use it. Moreover, future coders will get help if they face the similar situation. But again, that is ideal solution. Here we are talking about deadlines. We don’t have time to do this activity creation of this common util stuff is a task in itself.

Second best, which I would recommend, is to copy the code to your module and use. Concern- we have two copies of same code. hundreds of lines of code which is duplicated. I would argue, better duplicate then undauntedly dependent. Why to make two mutually exclusive units dependent. What if I want to delete one module completely tomorrow, how and “why” to think that some file somewhere might be used by some other module.

What say?

kamal coding