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. 


  

Tuesday, October 2, 2012

Oct 2 - Tuesday


I am very disappointed today about my speaking skill. I attended one meeting at lunch. At the end of the meeting I asked questions and the presenter said he did not understand my question. He wants me to call him back because he could not understand. Then one person in the same meeting translated for him. Not sure if he is rude but I was so embarrass. I think my English is getting a lot better, I can’t believe people still can’t understand me. I need to improve my accent from now on.

In the afternoon, I called one company to complain about my coupon. She said she could not understand me again. She asked me to spell the email and I could not spell it. Darn. Once again, I was so embarrass. I need to learn how to spell all letters.

Found list of Phonetic alphabet here


A – Apple
B- Bag
C-cat
D-dog
E-egg
F-Florida
G-George
H-Hotel
I-India
J-Johnson
K-King
L-Lemon
M-Mike
N-Nancy
O-ocean
P-Peter
Q-Queen
R-Robert
S-Sugar
T-Tree
U-Uncle
V-Victor
W-William
X-X-ray
Y-Yankee
Z-Zebra



Monday, October 1, 2012

Monday Oct 01


Today my company has code-a-thon competition. I know my manager wants everyone to come up with ideas and join the game. I would like to join just I don’t know what to implement. I can see in the US, they push for creative. And in this hard economy, the one who is creative will be a winner.  I was thinking of implementing a tool to import data from CVS file into database.  Hmm. May be I still can use that idea.

I bought a coupon to Flavor of India restaurant last Saturday. I spent only $5 for $30 coupon. It was a good deal, so I am very happy. But we could not find restaurant last Saturday, it made me so mad. We were hungry and could not find restaurant. Eventually we went to Chili’s, we ordered the special food, two for twenty dollars. It was lot of food and good. I am sure my husband loves the place. I was not enjoyed too much because I have to take care of the baby and the big one keeps jumping around. Hmm. I just can’t enjoy much to go with the kids.

I came home and look online. I saw Applebees has the same deal with more food. I am sure we will go there and try it out soon!

Friday, September 28, 2012

My baby's first tooth

It is exited that my baby has his first tooth. It is not one but two teeth at once at his five and a half month old. Yeah. I remembered my older son had his first tooth at four month and roll over at three month.

He roll over at four and a half month.

Wednesday, September 26, 2012

Sep 26


One more day goes by and we don’t have production issue. Yeah. I hope we never do because now my Mom went back to Vietnam and I have to take care of two kids on some nights when my husband has to work. 

I have three pieces of chicken wings left from the night before, a piece of steak and some shrimps which I need to cook because it was un-freeze the night before. It was planned for last night but my husband bought a big pizza home from pizza hut. It was good. I was planned to have pizza on Friday but my husband broke my plan. Now I don’t know what we are going to eat on Friday night. Darn.

My baby is getting better. Last night he just woke up once at 12 pm to drink 4oz of milk, then he slept until morning time. So that was good. It means his body can hold the food and hopefully pretty soon he will sleep through the night.

Today I planned to give both of them bath the same time, they both love it, and it is easier for me too J

Tuesday, September 25, 2012

Sep 25


Now I need to incorporate what I have learned for the day into my writing. This will help me memorize them longer.

Last night I complained my husband about his attitude to the family, I went home from work with two kids and he was still sleeping. That made me not happy but he woke up 20 minutes later and said he was tired because he had been working 12 hours/day for three days. So I just went to cook our dinner – fried chicken wings and macaroni and cheese – dinner was ready at about 7 o’clock and we have our dinner. My oldest son loves macaroni and cheese so he does not want anyone eat it. Every time we tried to get that food, he would say “you get too much, just get a little OK?” it is funny.  After dinner, my husband cleaned up the kitchen, I gave baby a spunk bath then just rest for the night.

I am not sure why our baby just does not sleep throughout the night. He keeps waking up and wants pacifier. I can see my husband really work hard to keep him quiet so I can sleep. I really appreciate that and may be because I complained about him before that. He said if he does not check on baby, I will get mad. It is funny and it made me feel bad so I think I should reconsider my attitude instead of him, refrain complaining and be happy with what I am having.

I had good news from my college friend yesterday said that she is going to get married on 12-30-2012. I am sure she is happy because she is 34, and you know how that goes when you are 34 and still single. Just remind me about my single life when I was 29, I was feeling so lonely. I love my life now compare to that time. I have a small and happy family with two boys. 

Friday, September 21, 2012

Friday Sep 21

Friday night and I stay home by myself with two kids because my husband has to work this weekend. Baby has high fever today and I had to off work early to pick him from daycare. I brought him home and gave him one dose of infant Tylenol, he is OK after that even fever still comes back but I think he is just having a flu. I hope he feels good tomorrow.

I have lost my interest at work since I have found out how much my colleague makes compare to me. I was hoped that I can join Kenaxa with a higher pay but unfortunately I failed the last interview with VP. it is crazy. I was very disappointed. How do people can ask for high pay and I can not? even I do a good job just as them. I think my biggest problem is my communication skills. I cant even tell them what I am responsible for at work. I just know "involved in development, design, coding and testing", while I do a lot more things like on call for production supports. Lead the team in migrate to integrate with core API, lead in implementing performance testing. Anyway, I am working hard everyday now on my English and hope to overcome my issue. And I should think of a positive way, may be God wants me to stay at my current job because it is better for me.    

Thursday, September 20, 2012

Thursday Sep 20



Last night we went to Logan Roast house for dinner. I ordered five pieces of wings because they had promotion for 50 cent/each if you order from 3 – 6 pm, salmon, steamed broccoli and macaroni and cheese. My older son only had some breads and macaroni and cheese. My husband had chicken, salad, and baked potato. We finished dinner and came home around 7pm. So it takes just the same time as if we make food and eat at home. My husband likes that place, so we go from time to time.

Tuesday, September 18, 2012

Tuesday Sep 18



This morning is as regular; my husband came home around 7 in the morning. I told him our little one has low temperature last night. But he was OK in the morning; we thought that he is teething. Poor baby!

 My husband needs to work five days this week, so I have to take care of our two boys three week nights by myself which I am not happy. I feel stress sometime when it comes to week like this. If I don’t have to work overtime, I have no problem. Just I never know when production issues come and I have to work late. Then I don’t know what I am going to tell my boss because I can’t work with two kids like that.

Anyway, the situation was improved compare to before he had to work in North Florida and just came home once a week. I think I should be happy for that instead of complaining. I know things will get better from time to time. I just need to preserve. And I believe God is blessing us.

Idea at work to optimize one store procedure
What is the goal we are trying to optimize here?  Are we expecting the average time to run this store procedure is under 1s? 

I have an idea to optimize this store procedure.Here is the input it needs to calculate availability:
+ Operation hours
+ Calendar hours
+Holidays
+ Scheduled limit days for services, service group
+ Existing appointments

And the way we store our data is that if the branch inherits operation hours/calendar hours/holidays from its parent. We only store data for its parent. That’s why we need lot of recursive queries to get data for specific branch. 

In reality, I think we rarely change operation hours/calendar hours/holidays for a branch, so we can create a separate thread which is run every 15 minutes to calculate all the above data for all the branches and populate into one table. 

So it is time to get availability timeslot, we can query data from that table and merge with existing appointments to get the final timeslots. With this way, we can reduce tremendous amount of calculation we need to do in that store procedure. I believe this approach will speed up the performance.



Monday, September 17, 2012

Monday Sep 17

I dropped my kids at daycare this morning. I saw a women who also has two kids. one few months old and one look like younger than my older son. On the way out, I saw her write check to pay for daycare and the amount only $300 while I am paying #325/week. I wonder how that happens? how can she get that price?

Today is not a bad day, not too busy, so I have some time to learn English and write something here.

Only the daycare called and said that my little one might has ringworm which is contagious. But I explained to them that he had rash on his face since he was born. We told the doctor and they recommend to keep putting lotion on him. It 's gone one week ago but I dont know why it comes back a little spot again. I hope he did not get ringworm.

I called my husband to see if he can get some medicine over the counter for him at CVS but he said he does not have enough time to get it. Oh well, let's hope he is OK.

8:13 PM. Just finished a busy evening and have some time again here.

It made me feel upset when I just got home and saw my messed up house, dishes on the sink, darn. And my little baby was hungry. I had to feed him right away. He ate good today. one jar of pear and two spoons of rice cereal. The I made my older son some pasta left over from yesterday. He loves pasta, so he ate 3 bowls :). I cooked myself a bowl of "Bun mam", that is my favorite food in Vietnam.

Few recruiters contact me today for job. I dont know what I should do. I like my current job, but I am worried they will close this office because less and less people left. Today I heard travel team said they laid off three employees. So that's not good. But what can I do? I just dont like find job while I am working and then I dont like losing job, then have to take whatever job I can get. I can't find job too far from the daycare either because I don't want to change my sons' daycare. May God bless me so I will have my job for long time.

Sunday, September 16, 2012

Why do I want a blog?


I am watching a movie on Vietnamese channel. In that movie, one of the character has been using blog to write all her daily thoughts. I have a terrible writing skills. And I am learning everyday to improve it. So I think opening a blog is a good idea, so I can write my daily activities as a way to practice my writing everyday.