April 14, 2014

IIS 7 performance improvements

Running load test with higher load, its been observed that web server (IIS 7 ) performance degrade significantly. Not much clue has been provided by support.

On further analysis, following setting have been identified as booster to IIS 7 performance :

Updating Default Application Pool Settings

To update default application pool settings:

1.     Go to Start > Administrative Tools > Internet Information Services (IIS) Manager.
2.     In the Internet Information Services (IIS) Manager window, browse to Server_Name > Application Pools.
3.     In the Application Pools section, Right-click DefaultAppPool and from the menu select, Advanced Settings.
4.     In the Advanced Settings window, set the following:
        a.     In the Process Model section, set:
                l     Maximum Worker Processes to 20
                2     Ping Enabled set to False (default value is False)
        b.     In the Rapid-Fail Protection section, set:
                Enabled to False (default value is False)
        c.     In the Recycling section, set: 

                Request Limit to 0 (default value is 0)

        Click OK to close the window.


Updating ASP Settings

To update ASP settings:
1.     Go to Start > Administrative Tools > Internet Information Services (IIS) Manager.
2.     In the Internet Information Services (IIS) Manager window, browse to Server_Name.
3.     In the IIS section, right-click ASP and from the menu select, Open Features.
4.     In the properties screen that opens, go to the Limit Properties section and for the Thread Per Processor Limit setting, set the value to 100.


Updating Registry Settings

To update registry settings:
1.     Go to Run and type regedit to launch the Registry Editor.
2.     In the Registry Editor, browse to HKEY_LOCAL_MACHINE > SYSTEM > CurrentControlSet > services > InetInfo > Parameters.
3.     From the parameters list, right-click MaxPoolThread and from the menu select Modify.
4.     In the Edit DWORD (32-bit) Value window, set the Value data to 400.            
5.     In the Registry Editor, browse to HKEY_LOCAL_MACHINE > Software > Microsoft > ASP.NET > 2.0.50727.0.
6.     In the list section, right-click and from the Menu select New > DWORD (32-bit) Value.
7.     Name the new DWORD as MaxConcurrentRequestsPerCPU.
8.     Right-click MaxConcurrentRequestsPerCPU and from the menu select Modify.
9.     In the Edit DWORD (32-bit) Value window, set the Value data to 5000.
       

May 24, 2012

Error -- memory violation : Exception ACCESS_VIOLATION received

Loadrunner error,

One of the very common issue observed during load testing for large number of users on a single load generator.

  • Default value for Multithreading in Run-time Settings (Virtual User Generator -> General -> Miscellaneous), is set to ‘Run Vuser as a process’.This means that each process of mdrv.exe process will execute a set number of thread (defined in C:\Windows\wlrun5.ini (old versions) or C:\Program Files\HP\LoadRunner\config\wlrun7.ini ), default value is 50.

  • If we have enough memory on load generator machine then we can change setting to ‘Run Vuser as a thread’, which means each mdrv.exe will have single thread instead of default 50.This could be useful in cases where we have heavy transaction (in bytes) on each threads, and in most cases resolve memory violation issue.

  • If we don't have large memory then we can reduce the number of threads running under each mdrv.exe process by reducing value of AgentMaxThreadsPerDriver=50 to lower number.This also helps in getting rid of memory violation, by increasing the number of process of mdrv.exe and reducing load on each process.

  • web_set_max_html_param_len(X000); is set too high to capture maximum data using web_reg_save_param function, try to calculate the max limit of strings per page and add around 30% to it.

  • We also see this during NULL pointer exception while dealing with C functions, best solution is that whenever we expect a NULL value place an If else condition to tackle it


  • You will receive this error if you have defined an array in C and the string length is exceeding the max limit of array.

  • You will receive this error if you are not closing file properly while doing file operations using C functions

  • Size of the string to be updated in single cell of vts is reduced to minimum, try to use flags only, and also keep column name as small as possible.Also increase Think time  between different request to VTS. Lots of write processes will generate this error instead of read.

  • Observed this issue on when load generator machines are on VM (Virtual Machines) instead of Physical box. Moving them to physical box has resolved this if all above mentioned issues are resolved. The best symptom for this is that you observe Memory Violation while running load in controller and after few successful iterations with complete load.


There can be lots of reason for this error share your experiences of this issue and your solution to it.

April 11, 2012

Garbage First (G1) garbage collector (GC)

This new collector has been introduced in Java HotSpot VM in JDK1.7

Difference between current CMS and G1

1. G1 uses all CPUs, which reduces time in "stop-the-world" or GC pauses
2. In G1 Young and Old are not physically separated, and resources can move between two as needed.
3. G1 performs heap compaction over time, which eliminates potential fragmentation problems.

Enable G1 using following options:

      -XX:+UnlockExperimentalVMOptions -XX:+UseG1GC

Set the max GC pause time in milliseconds (max time in GC):

      -XX:MaxGCPauseMillis=50

Set the time interval over which GC pauses for totaling up (wait time before GC):

      -XX:GCPauseIntervalMillis=200

Set the size of the young generation (its depreciated in jdk1.7)
       http://hg.openjdk.java.net/jdk7/jdk7/hotspot/rev/a1c410de27e4

      -XX:+G1YoungGenSize=512m

Set the survivor ratio size

      -XX:SurvivorRatio=6

February 16, 2012

Understanding Concurrent Mark Sweep Garbage Collector Logs


SET JVM_OPTION_X=-verbose:gc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintHeapAtGC -XX:+PrintTenuringDistribution -Xloggc:"%INSTALL_DIR%\logs\printgc_name.log"

verbose:gc log file using different switches.

338.075: [GC 338.079: [ParNew
Desired survivor size 49152000 bytes, new threshold 15 (max 15)
- age   1:    3739224 bytes,    3739224 total
- age   2:    1542896 bytes,    5282120 total
- age   3:   27780808 bytes,   33062928 total
: 612848K->47430K(672000K), 0.0259963 secs] 732630K->167112K(2001152K), 0.0299831 secs] [Times: user=0.13 sys=0.00, real=0.03 secs]

  • Time is in milisecond relative to start of application
  • "[GC" represents a stop-the-world Gargbage Collection triggered by the JVM
  • "[ParNew" represent Young Generation collection.
  • It explains that 672000K is the capacity of Young Generation, and after garbage collection its size drop from 612848K to 47430K in 0.0259963 secs
  • Outside [GC it explains stats of total heap usage dropping from 732630K to 167212K (2001152K) after Young Generation collection.
  • This gives a interesting data,
               732630K - 167212K = 565418K is the amount of data garbage collected in the young generation.
                612848K - 47430K - 565418K = 100K is the amount of data moved into old generation.
  • Describes the "aging distribution" of  objects allocated by application in young generation at the end of young Garbage Collection cycle.
  • This Garbage Collection cycle set the new threshold= 15 meaning that objects will age up to 15 before the next GC cycle takes place.
  • "[Times:" explains the time spend in Young GC collection, user time, system time and real time.


11318.945: [Full GC 11318.946: [CMS11319.283: [CMS-concurrent-sweep: 0.388/0.425 secs] [Times: user=0.66 sys=0.00, real=0.43 secs]
 (concurrent mode failure): 1329151K->1329151K(1329152K), 3.2141208 secs] 2001151K->1395840K(2001152K), [CMS Perm : 90303K->90303K(150656K)], 3.2155193 secs] [Times: user=3.22 sys=0.02, real=3.22 secs]
  • Time is in milisecond relative to start of application
  • "[Full GC" represents a stop-the-world Gargbage Collection triggered by the JVM
  • "[CMS" represent Concurrent Mark and Sweep collection.
  • It explains no change has happenned which doing Full GC which took 3.2
  • Overall heap usage of system come down from 2001151k to 1395840K.

Reasons for (concurrent mode failure):

1. Not enough space in Old generation for larger objects, so young generation is not happening because promotion of objects is not guaranteed. Fragmentation could be the issue here, one option is to increase RAM.
  
2. Objects are getting created at faster rate and CMS is not able to clean them at that rate.  Solution to this problem could be, to reduce CMSInitiatingOccupancyFraction and trigger CMS collection early. By default its value is around 66%

February 10, 2012

February 09, 2012

Beginning with Ruby on Rails

Download Ruby and RubyGems.
Install Ruby
extract RubyGems, then run "ruby setup.rb"
run gem install rails
rails new applicationname
-- For MYSQL with ROR --- rails new applicationname --database=mysql
cd applicationname
rails server(or s)
http://localhost:3000

Download and install RaidRails editor.
Installtion is completed.


Lets create our application:

rails generate controller home index
edit app/views/home/index.html.erb to have

Hi this is my first rails page


type rails s to start the server
You will see welcome abroad if you type http://localhost:3000

Ctrl + C
del public\index.html
http://localhost:3000

Now install Mysql latest version.
-----------------------------------------------------------------------------------

rails new firstwebsite --database=mysql
cd firstwebsite
gem install mysql

Please update your PATH to include build tools or download the DevKit
from 'http://rubyinstaller.org/downloads' and follow the instructions
at 'http://github.com/oneclick/rubyinstaller/wiki/Development-Kit'


find LIBMYSQL.DLL from your mysql/bin folder in your mysql folder not ruby folder., if you don't get it then download it.
copy & paste that file to ruby/bin


gem install mysql2 -- '--with-mysql-lib="C:\Program Files\MySQL\MySQL Server 5.5\lib" --with-mysql-include="C:\Program Files\MySQL\MySQL Server 5.5\include"

--- Using (MYSQL 32bit) on Windows7(64 bit)--- gem install mysql2 -- '--with-mysql-lib="C:\Program Files (x86)\MySQL\MySQL Server 5.5\lib" --with-mysql-include="C:\Program Files (x86)\MySQL\MySQL Server 5.5\include"'

bundle update

Update Rakefile
    require File.expand_path('../config/application', __FILE__)
    require 'rake/dsl_definition'
    require 'rake'
    #Use correct application name that matches for you
    module ::Web
      class Application
        include Rake::DSL
      end
    end
    module ::RakeFileUtils
      extend Rake::FileUtilsExt
    end
    Web::Application.load_tasks


rake db:create RAILS_ENV='development' (or if it still fails then bundle exec rake db:create RAILS_ENV='development')
rake db:create:all (this will create all 3 databases on MYSQL DB)
rails generate scaffold tablename id:integer  anchorStore:string
rake db:migrate

rails s
http://localhost:3000

-------------------------------------------------------------------------------------------------------------------------------

Now download a template, and merged it to current CURD system,

Rename current index.html.erb file in view folder and put HTML code in index.html.erb file
Now put images in public\images folder and css file in public\stylesheets
and also

Ruby on Rails is not about CURD, its just a way to get you basic infrastructure.



Experiences while writing Ruby On Rails:
-------------------------------------------------------------------------------------------------------


Basic Ruby on Rails Code:

View:
-----
<%= link_to "Link", {:action => "AjaxView",:col => "colname"}, :update => "Ajaxcall", :remote => true %>

In view I put Ajax call to server, were AjaxView is the action name in Controller file.
remote => true defines that its a Ajax call

The values defined in bracelet { } is a HTML content trasfered from webpage to server

Controller:
-----------
def AjaxView
  @vars= Var.find(:all,:conditions => { :varName=> "one" },:select=>(params[:col]))
 respond_to do |format|
   format.js { render :layout=>false }
end
end

By default @var values will be transfered to AjaxView.js.erb and _var.html.erb

Above statement means select col from Var where varName = one

AjaxView.js.erb
----------------
$("#3").text("<%= escape_javascript(render(:partial => "var")) %>");

We are rendering partial to execute Ruby code for us, that output data is placed in HTMl page uisng JS

_var.html.erb
--------------
<% @vars[2].col1 %>

Partial code will render  an array of data from the table column, we are taking 3rd value out of that array.

July 19, 2011

DB backup and restore process for MSSQL

This is one of the common Activity during load testing.

Take Backup of all DB's using following query:
backup database DBSetupLoad
to disk ='C:\DBSetupLoad.bkp'

Restore DB:
restore filelistonly from disk ='C:\DBSetupLoad.bkp'

This will list down different files for a particular DB.
Now create following query in this format, depending upon the number of files:

restore database DBSetupLoad
from disk ='C:\DBSetupLoad.bkp'
with move 'DBSetupLoad_DATA_DEVICE' to 'C:\Load_Data\DBSetupLoad_DATA.mdf',
move 'DBSetupLoad_LOG_DEVICE' to 'C:\Load_Data\DBSetupLoad_LOG.ldf'

Now delete all existing users from each DB and create new one withh same configuration as in old installation.
DBName--> Security --:Users
Also delete it from Security --: Logins

Create only in Security --: Logins ( it will automatically create in DB's)