Thursday, May 14, 2015

Replaying Your [access] log by JMeter


Replaying [apache access] log by JMeter to mimic the real user load..
This is inspired by blazemeter post: Learn How to Replay Your Production Traffic With JMeter, but I made my own optimization and enhancement, check it out if you are interested in it:

https://github.com/joychester/Doraemon

PS: the first row in the formatted log file will be ignored, due to fetch the log started timestamp.

Wednesday, February 11, 2015

Upgrade Ruby version on your Mac OS X

Finally I got a 15'' Mac Pro as my working laptop, it is kind of Chinese new year gift :)
First, the OS embedded a Ruby 2.0 version, which is kind of out of date, so upgrade to the 2.2.0 is my first stuff to do with my Mac.
The main steps i follow is This
However, after doing that, it is not working properly on mine, so i will simplify my steps as following:
  1. Install Homebrew: ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  2. Install rbenv to help you manage ruby versions: brew install rbenv ruby-build
  3. Adding extra Path to ~/.bash_profile : export PATH=/Users/cchi/.rbenv/shims:$PATH
  4. Open Terminal-> preference -> Shell -> Startup : source ~/.bash_profile
  5. Check all existing package you can install : rbenv list -l
  6. Install Ruby 2.2.0: rbenv install 2.2.0
  7. Sets the global version to Ruby 2.2.0: rbenv global 2.2.0
  8. Check the ruby Version: ruby -v
Start to Taste your Ruby and Mac!!


Update: i found this link which is great steps and explanation to install  Ruby by rbenv:
https://cbednarski.com/articles/installing-ruby/

Thursday, January 08, 2015

Scaffold Code on my github based on Structuring Sinatra Web Application



It is Sinatra module based and more structuring(or clean) than our previous one of my indoor project based on classical style code when I wrote it in 2013, so that’s why I rewrite the code and make it as a “framework”

Check it out from my github

A demo app using jquery, highcharts, bootstrap and Sinatra module based code, to show you how to organize the code and the folder structure to use this "framework"

Thanks to Inspired from:
Structuring Sinatra Applications
Structuring Sinatra Apps 

Online Editor c9.io 

 if you are using c9.io services as your IDE, you can easily take my following scripts to grab my code:
 require 'git'  
 require 'fileutils'  
 require 'sys/proctable'  
 $: << File.expand_path(File.dirname(__FILE__))  
 git_repo = 'https://github.com/joychester/Arowana.git'  
 target_dir = './arowana'  
 if ! Dir.exist?(target_dir)  
   g = Git.clone(git_repo, target_dir)  
 else  
   FileUtils.remove_entry(target_dir)  
   g = Git.clone(git_repo, target_dir)  
 end  
 # exec 'bundle install and rackup config.ru'  
 Dir.chdir('./arowana') do  
   `bundle install`  
   # check postgresql service if running  
   pg_service = Sys::ProcTable.ps.select { |process|  
     process.include?('postgres')  
   }  
   if pg_service.empty?  
     p 'please check your postgresql service if it is running, exiting...'  
     exit(1)  
   else  
     p 'ready to start your Arowana App'  
     `rackup config.ru -p $PORT -o $IP`  
   end  
 end