Saturday 8 September 2018

Benefits of Multi threading

  • Maximum Throughput: Maximum throughput can be achieved using multiple threads fueling application performance which can be achieved using multi-threaded application and CPU multiple cores.


  • Parallel Processing: In multi-threading environment task gets processed in parallel mode which improves application capacity to process more requests volume.


  • Better User Experience: Multi-threading undoubtedly provides better user experience by enhancing application performance capability.

Creating index in oracle database | Database Performance tuning

Indexes are used to quickly locate data without having to search every row in the database table each time a database table is accessed.
Indexes can be created using one or more columns of a database table, providing the basis for both rapid or random lookup and efficient access of ordered records.
Index is a data structure that improves the speed of data retrieval operations on a database table.

How to create index:
  create index <index_name> on <table_name> (<col1>,<col2>,...);

So, if you want to create index on color column on your paint table and call it paint_color_i, SQL would look like below:
  create index paint_color_i on paint (color);

You can also include more column to index like below:
  create index paint_color_i on paint (color,type);

How to configure SSH Server on Ubuntu

1. Installing SSH Server:
  • openssh-server package can be found in linux software center. Alternatively open terminal and run below command.
          sudo apt-get install openssh-server

2. Enabling SSH on Ubuntu:
  • Once ssh installed on the machine create backup of sshd_config file with sshd_config.defaults filename to restore in case configuration is messed up.
       sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.defaults
    
    Change permission of defaults backup file using chmod command given             below.
    sudo chmod a-w /etc/ssh/sshd_config.defaults

3. Restart/Reboot SSH Server
  • For Ubuntu 14.04 and below version
    sudo restart ssh
  • For Ubuntu 15.04 and above version
    sudo systemctl restart ssh

Now you will be able to connect to ubuntu using any ssh client application like PuTTY, Bitvise, winscp etc. Just follow below steps.
  • Check ip details using ifconfig command.
  • Use inet addr address and login to ssh client using user and password.







Monday 29 January 2018

How to handle JSON request in LoadRunner(LR 12.53)

JSON request can be handled using lr_eval_json function in LR 12.53.
lr_eval_json parses a JSON string, creates a JSON object, and stores the handle of the object in a parameter.
This function is not recorded. You can insert it manually into your script.

Step1: Capture JSON request from the response body using web_reg_save_param.

Step2: Input captured parameter of json parameter and save it in a string using below lr_save_sting function.
        lr_save_string(json_input, "JSON_Input_Param");
Step3: Create a Json object using above json string.
 //Create a Json object from a string.
 lr_eval_json("Buffer={JSON_Input_Param}",
              "JsonObject=json_obj_1", LAST);
 //Create a Json object from a file.
 lr_eval_json("Buffer/File=store.json", 
              "JsonObject=json_obj_2", LAST);

Step4: Using below function values can be fetched from json object and used in the scritps.
      lr_json_get_values("JsonObject=json_obj", 
                         "ValueParam=val", 
                         "QueryString=$.val", 
                         "SelectAll=Yes", 
                         LAST);
Values will be stored in parameter like val_1, val_2, val_3.........

Alternate way:
Using web_reg_save_param_json function.
The web_reg_save_param_json function supports array type parameters. When you specify SelectAll=Yes, all the occurrences of the match are saved in an array. 
Each element of the array is represented by the ParamName_index.
In the following example, the parameter name is A:
web_reg_save_param_json("ParamName= A", "QueryString=$..arguments.additional_context[0].name", "SelectAll=Yes", LAST );
The first match is saved as A_1, the second match is saved as A_2, and so forth. You can retrieve the total number of matches by using the following term: ParamName_count.
For example, to retrieve the total number of matches saved to the parameter array,
use: TotalNumberOfMatches=atoi(lr_eval_string("{A_count}"));
web_reg_save_param_json is not recorded. You can add it manually to a script.
Argument Description
ParamName The name of the parameter to store the returned value. If the parameter does not exist, it is created.
QueryString The path of the value to save. For the syntax of the query string, see Json Path on GitHub.
SelectAll Optional: If SelectAll=Yes, all the occurrences of the match are saved in an array. See Saving Multiple Matches below in this topic.
List of Attributes For details of each attribute, see Attributes for Save Parameter Registration Functions. Attribute value strings (e.g., "Search=body") are not case-sensitive. See the Restrictions.
SEARCH FILTERS Specifies the sections of the buffer to search for the string in. See Search Filters for Save Parameter Registration Functions. See the Restrictions.
LAST A marker that indicates the end of the argument list.

Thursday 11 January 2018

Enable/Disable iptables firewall in linux

Enable/Disable iptables firewall in linux:
# /etc/init.d/iptables save
# /etc/init.d/iptables stop
# /etc/init.d/iptables start

On Boot:
# chkconfig iptables off

# chkconfig iptables on