Tuesday, October 9, 2012

Linux commands: Cygwin


+ pwd : show current home path
+ cd /cygdrive/c : to access c drive outside Cygwin home
+ ls : list all files or folders
+ grep "Response Time" MyTest*>test.txt : extract all lines which has text “Response Time” in all files AppmntSched and output to test.txt
+ grep "Response Time" MyTest.log>test.txt : extract all lines which has text “Response Time” in AppmntSched.log and output to test.txt

Working with VSTS 2010 for performance test


+ Make sure time on controller, agents, and server where it runs test are in sync. If not you may get
Results from agent 'Server1,Server2' were not received in time to be included in the overall results for a sampling interval. To avoid this error, increase the sample rate, or decrease the load on this agent

+ After run a big load, you should try to delete all temporary files in controller and agents. You can do that in Visual Studio 2010. And usually you need to log in agent server to restart agent server “Visual Studio Test Agent” in windows services to make sure they are reset.

+ If I don’t restart agent services, my requests’ response time goes up. And it is not accurate. May be because we use FluorineFx in serialize/deserialize our AMF requests that are why it uses a lot of agents’ memory.

+ After record 1 long test
Ex: Login, select location, double-clicks to see all appointments in that location, logout.
We should try to break it out into small tests like
  • Login
  • Select location
  • Go to see all appointments in selected location
  • Logout.

With this break out, we will have more flexibility to create scenarios in load test.

Monday, October 8, 2012

Using Spring AOP to profile application


  1. Create java class:


import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.aspectj.lang.ProceedingJoinPoint;

public class MyProfiler
{
  Log
logger = LogFactory.getLog(getClass());
 
  public
MyProfiler () {
    this
.logger.info("Initialized");
  }
 
  public
Object methodResponseTime(ProceedingJoinPoint call) throws Throwable
  {
    Long startime = Long.valueOf(System.currentTimeMillis());
    try
{ Long responseTime;
      return
call.proceed();
    }
finally {
      Long responseTime = Long.valueOf(System.currentTimeMillis() - startime.longValue());
      this
.logger.info(String.valueOf(call.getSignature().toLongString()) + "::Response Time::" + responseTime);
    }
  }
}

 2. Spring context: create and configure spring to profile all methods in specified class

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
       xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">

       <bean id="schedulerProfiler" class="X.X.MyProfiler" />

       <aop:config>
              <aop:aspect ref=" MyProfiler ">
             
                    
                     <!-- Business Layer -->   
                    
                     <aop:pointcut id="myBusinessResponseTimeLogger"
                           expression="execution(* com.X.business.myBusiness.*(..))" />
                          
                     <aop:around pointcut-ref="appointmentAdminBusinessResponseTimeLogger"
                           method="methodResponseTime" />

</aop:aspect>
       </aop:config>

</beans>

Saturday, October 6, 2012

My MSSQL experiences

So far I have always hesitated to take any SQL task. But currently I have no choice but have to take up task to optimize the most complicate store procedure in our project. I think this is a chance for me because I have  a chance to work with a DBA and learned so much from him. I optimized the store procedure which takes about 6s to run, now it only takes 0.67s. Here is what I have changes

+ Remove all temporary tables. Because every time when it accesses temporary tables it needs go to the disk. So this will increase IO cost.
+ Use table in memory instead.
+ Remove recursive views and put in physical tables: because every time it calls those view, the view will be recalculated for its data.
+ Dont have function around index columns in query then it will break the index and scan all tables again.
+ Remove 2 loops which recursive into each row of two tables by a range query

My son's Rosco

Garrett loves playing with cars. My mother in law said my husband was the same when he was a kid. And she saved all his cars for her grandson. So she pass about 100 small cars to me. It has all kinds of small cars.

He loves Rosco car since he has watched "The dudes of hazzard" movie. He holds it every where he goes, to daycare, to eat, to sleep, .. Every where. This morning I told my husband Garrett lost his rosco car. My husband said "Oh no, we cant lose his rosco car, that is his favorite car". He got right up and went every where in the house to look for his car. At that time Garrett was still sleeping and had not waken up. Luckily my husband found it under the train and he put next to Garrett. He wanted to give Garrett a surprise as he wakes up :)

Thursday, October 4, 2012

Thrusday - Oct 4


Today I don’t have to cook. Yesterday my husband said he will make something. So I am waiting to see what we will have tonight for dinner.

I also need to talk to my husband tonight about his vacation. Yesterday he told me he wants to go to Maine. But I already told him we can’t drive to Maine because it is a 30 hours’ drive and we can’t do that with Noah who is one year old and four years old Garrett.

Not sure if he plan to go by himself. If that is the case, I am going to get upset because he just thinks for himself. When I have vacation time, then what I am going to do. I can go Vietnam by myself but I have to take both kids with me and I cannot handle that.

By the way, last night we had hot pot for dinner. That was pretty good. I did not know celery is good when using in hot pot. I am going to buy some Tom yum paste so I can make “Lau Thai” next time.

My three years old son


It is so funny the way he talks at this age.

1.       My husband told him his belt is a “snake”, they play with it like it is a snake.  When I am in bathroom to brush my teeth, they like to push snake under the door and says “Mommy, snake is going to bite you”. So my son named it a snake. One day my husband hurried to work and forgot his belt. My son run after him and said “ Daddy, you forgot your snake” J

2.       Every time he does not want dinner, I will say “Garrett: if you don’t eat my food, I am going to get nasty” J and he knows it because I put him in his room or timeout few times when he did not eat. So every day after I prepared dinner, I will say out loud to living room “Food ready”, my son knows will try to get my husband “Daddy, go have food. Food ready” J . And if he slows in getting up from his couch, my son will say “Daddy, if you don’t eat mommy food, mommy is going to get nasty.” J


      Every Saturday when my husband works, we usually go to our back yard and stay out for at least one hour. I will give Garrett a yogurt and an avocado smoothie for myself. We eat in our patio set. One time I saw a bug flying around the table. I said “Garrett, eat fast, if not the bug will eat your yogurt.” And he said “Mommy, the bug can’t eat my yogurt, because he does not have a spoon.” J . That is funny.

d   For those nights when my husband is not home, we have dinner and baby Noah cried sometimes. Garrett told me " I think he missed daddy mom". I said "Yea". Then he told Noah. "Daddy has to go to work to make money". :) Just the same as I told him every time. Funny.

     Garrett has just asked me again. "Mom, can I go pee?". it makes me funny because every time he needs to go "wie wie" or go "pooh" he would ask like that instead of just go. Poor guy, because that is what he has learned at daycare.