12 Benefits of Cloud Computing

 

  1. Cost Savings
  2. Security
  3. Flexibility
  4. Mobility
  5. Insight
  6. Increased Collaboration
  7. Quality Control
  8. Disaster Recovery
  9. Loss Prevention
  10. Automatic Software Updates
  11. Competitive Edge
  12. Sustainability

Disadvantages of Cloud Computing

 Downtime:

Downtime is often cited as one of the biggest cloud computing disadvantages. Since cloud computing systems are internet-based, service outages are always an unfortunate possibility and can occur for any reason.

Security and privacy:

Although cloud service providers implement the best security standards and industry certifications, storing data and important files on external service providers always opens up risks. Any discussion involving data must address security and privacy, especially when it comes to managing sensitive data. We must not forget what happened at Code Space and the hacking of their AWS EC2 console, which led to data deletion and the eventual shutdown of the company. Their dependence on remote cloud-based infrastructure meant taking on the risks of outsourcing everything.
Vulnerability to attack :

Going on with the drawbacks of cloud computing, another one concerns vulnerability: in cloud computing, every component is online, which exposes potential vulnerabilities. Even the best teams suffer severe attacks and security breaches from time to time. Since cloud computing is built as a public service, it’s easy to run before you learn to walk. After all, no one at a cloud vendor checks your administration skills before granting you an account: all it takes to get started is generally a valid credit card.

Limited control and flexibility :

Since the cloud infrastructure is entirely owned, managed, and monitored by the cloud service provider, it transfers minimal control over to the customer.

Vendor lock-in:

Vendor lock-in is another perceived disadvantage of cloud computing. Easy switching between cloud services is a service that hasn’t yet completely evolved, and organizations may find it difficult to migrate their services from one vendor to another. Differences between vendor platforms may create difficulties in migrating from one cloud platform to another, which could equate to additional costs and configuration complexities. Gaps or compromises made during migration could also expose your data to additional security and privacy vulnerabilities.

Cost concerns:

The last one of the disadvantages of cloud computing concerns cost. Adopting cloud solutions on a small scale and for short-term projects can be perceived as being expensive. However, the most significant cloud computing benefit is in terms of IT cost savings. Pay-as-you-go cloud services can provide more flexibility and lower hardware costs, but the overall price tag could end up being higher than you expected. Until you are sure of what will work best for you, it’s a good idea to experiment with a variety of offerings. You might also make use of the cost calculators made available by providers like Amazon Web Services and Google Cloud Platform.

How to Generate Random Passwords with Alphanumeric and special characters ?

     char charset[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()_+";

  //  int passwordLength = 10; // Change this value to set the desired length of the password
    char generatedPassword[10 + 1];
    int i;

    lr_save_string("""GeneratedPassword"); // Clear any previous values

    // Generate random characters for the password
    for (i = 0; i < 10; i++) {
        int index = rand() % (sizeof(charset) - 1);
        generatedPassword[i] = charset[index];
    }

    generatedPassword[10] = '\0'// Null-terminate the string

    lr_save_string(generatedPassword, "GeneratedPassword"); // Save the generated password as a parameter

    lr_output_message("Random password: %s", generatedPassword);

Modify Common Parameters in Multiple Scripts Using Additional Attributes

 Problem statement: Your performance regression scenario contains 20 different Loadrunner scripts. You run this scenario a number of times in a given release.For simplicity, let’s assume that all scripts are developed using web services protocol. There may or may not be any changes to the scripts but version of the service endpoint changes a lot of times. For example, from version R200 to version R300

From http://ServerName:Port/R200/CustomerDataManagement.svc
To http://ServerName:Port/R300/CustomerDataManagement.svc

How to modify all the endpoints to have latest version, possibly without opening the scripts?

Solution 1: One trivial solution which would come to everyone’s mind is to create a parameter, say pEndpointVersion, and use that in the URL as shown below

http://ServerName:Port/{pEndpointVersion}/CustomerDataManagement.svc

Drawback: You will have to update the parameter value every time the endpoint version changes. Thus, you will have to download, open and update the parameter in all the scripts. This activity is very time consuming especially when it comes to VUGEN 11.52 as we all know how slow it is for opening scripts. Have a look a solution 2.

Solution 2 (preferred): In your script, go to RunTime Settings(RTS) under ‘Additional Attributes’, add a new argument name and a argument value. For example: argument name ‘EndpointVersion’ with argument value ‘R300’.

RTS-Additional Attributes Option

Then use the statement lr_get_attrib_string(“<Argument Name>“) to retrieve the argument value. In our example, use lr_get_attrib_string(“EndpointVersion“) to retrieve the value ‘R300’.

You can output the value like this

lr_output_message("*******version: %s"lr_eval_string(lr_get_attrib_string("EndpointVersion")));

OR save it into a parameter via lr_save_string() and access it anywhere in the script using the parameter name. For example,

lr_save_string(lr_get_attrib_string(("EndpointVersion")),"rVersion");

The endpoint will look like http://ServerName:Port/{rVersion}/CustomerDataManagement.svc
Example:

lr_output_message("*******version: %s"lr_eval_string(lr_get_attrib_string("EndpointVersion")));
lr_save_string(lr_get_attrib_string(("EndpointVersion")),"rVersion");

Output
Action.c(25): *******version: R300
Action.c(27): Notify: Saving Parameter “rVersion = R300”.

Benefit: If the endpoint version changes, you can modify the RunTime Settings (RTS) for all the scripts in the scenario in Performance Center itself. You don’t need to open and update it in individual scripts. If all the scripts use same RTS, then it’s even easier. Just modify RTS of one script and duplicate the RTS to rest of the scripts. Following screenshot shows the location of ‘Duplicate Runtime Settings’ option in Performance Center.

Duplicate RTS

In Truclient protocol script, the function is LR.getLRAttr(“<attrib_name>”);

Refer for details: VUGEN help > VuGen > Protocols > Ajax TruClient Protocol > Enhancing Ajax TruClient Scripts > Ajax TruClient Functions

Hope it helps to someone!

LoadRunner checks Previous HTTP request i.e. (HTTP 200

 Whenever server responds to the clients request then with the response code it sends HTTP 200 i.e.

The request was fulfilled.

Suppose we want to check the status of the returncode from  the server

int web_get_int_property ( const int HttpInfoType );

The above syntax returns specific information about previous HTTP request.

1. The meaning of the return value depends on the HttpInfoType argument.

2.HttpInfoType can be of any options like Returncode,Download Size,Download time.

How to use this function ::

Action()
{
int HttpRetCode;
lr_start_transaction(“Load_File”);

web_reg_find(“Text=My Workplace”,
LAST);

web_url(“LoadFile.jsp”,
“URL=http://servername/Workplace/LoadFile.jsp”,
“Resource=0”,
“RecContentType=text/html”,
“Referer=”,
“Snapshot=t1.inf”,
“Mode=HTML”,
LAST);

HttpRetCode = web_get_int_property(HTTP_INFO_RETURN_CODE);

if (HttpRetCode == 200)

lr_log_message(“The script successfully accessed the Load page”);

else

lr_log_message(“The script failed to access the Load page “);

lr_end_transaction(“Load_File”,LR_AUTO);

return 0;
}

output :: You will find the desired output at the Replay log pane on the vugen

Modify Common Parameters in Multiple Scripts Using Additional Attributes

 Problem statement: Your performance regression scenario contains 20 different Loadrunner scripts. You run this scenario a number of times in a given release. For simplicity, let’s assume that all scripts are developed using web services protocol. There may or may not be any changes to the scripts but version of the service endpoint changes a lot of times. For example, from version R200 to version R300

From http://ServerName:Port/R200/CustomerDataManagement.svc
To http://ServerName:Port/R300/CustomerDataManagement.svc

How to modify all the endpoints to have latest version, possibly without opening the scripts?

Solution 1: One trivial solution which would come to everyone’s mind is to create a parameter, say pEndpointVersion, and use that in the URL as shown below

http://ServerName:Port/{pEndpointVersion}/CustomerDataManagement.svc

Drawback: You will have to update the parameter value every time the endpoint version changes. Thus, you will have to download, open and update the parameter in all the scripts. This activity is very time consuming especially when it comes to VUGEN 11.52 as we all know how slow it is for opening scripts. Have a look a solution 2.

Solution 2 (preferred): In your script, go to RunTime Settings(RTS) under ‘Additional Attributes’, add a new argument name and a argument value. For example: argument name ‘EndpointVersion’ with argument value ‘R300’.

RTS-Additional Attributes Option


Then use the statement lr_get_attrib_string(“<Argument Name>“) to retrieve the argument value. In our example, use lr_get_attrib_string(“EndpointVersion“) to retrieve the value ‘R300’.

You can output the value like this

lr_output_message("*******version: %s"lr_eval_string(lr_get_attrib_string("EndpointVersion")));

OR save it into a parameter via lr_save_string() and access it anywhere in the script using the parameter name. For example,

lr_save_string(lr_get_attrib_string(("EndpointVersion")),"rVersion");

The endpoint will look like http://ServerName:Port/{rVersion}/CustomerDataManagement.svc
Example:

lr_output_message("*******version: %s"lr_eval_string(lr_get_attrib_string("EndpointVersion")));
lr_save_string(lr_get_attrib_string(("EndpointVersion")),"rVersion");

Output
Action.c(25): *******version: R300
Action.c(27): Notify: Saving Parameter “rVersion = R300”.

Benefit: If the endpoint version changes, you can modify the RunTime Settings (RTS) for all the scripts in the scenario in Performance Center itself. You don’t need to open and update it in individual scripts. If all the scripts use same RTS, then it’s even easier. Just modify RTS of one script and duplicate the RTS to rest of the scripts. Following screenshot shows the location of ‘Duplicate Runtime Settings’ option in Performance Center.


Duplicate RTS












In Truclient protocol script, the function is LR.getLRAttr(“<attrib_name>”);

Refer for details: VUGEN help > VuGen > Protocols > Ajax TruClient Protocol > Enhancing Ajax TruClient Scripts > Ajax TruClient Functions

Hope it helps to someone!

Base64 Encode/Decode for LoadRunner

 #include "base64.h"

vuser_init()
{
 int res;
 // ENCODE
 lr_save_string("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789","plain");
 b64_encode_string( lr_eval_string("{plain}"), "b64str" );
 lr_output_message("Encoded: %s", lr_eval_string("{b64str}") );
 
 // DECODE
 b64_decode_string( lr_eval_string("{b64str}"), "plain2" );
 lr_output_message("Decoded: %s", lr_eval_string("{plain2}") );
 
 // Verify decoded matches original plain text
 res = strcmp( lr_eval_string("{plain}"), lr_eval_string("{plain2}") );
 if (res==0) lr_output_message("Decoded matches original plain text");
 
 return 0;
}


And here’s the actual base64.h include file

/*

Base 64 Encode and Decode functions for LoadRunner

==================================================

This include file provides functions to Encode and Decode

LoadRunner variables. It's based on source codes found on the

internet and has been modified to work in LoadRunner.

 

Created by Kim Sandell / Celarius - www.celarius.com

*/

// Encoding lookup table

char base64encode_lut[] = {

'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q',

'R','S','T','U','V','W','X','Y','Z','a','b','c','d','e','f','g','h',

'i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y',

'z','0','1','2','3','4','5','6','7','8','9','+','/','='};

 

// Decode lookup table

char base64decode_lut[] = {

0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

0, 0, 0,62, 0, 0, 0,63,52,53,54,55,56,57,58,59,60,61, 0, 0,

0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,

15,16,17,18,19,20,21,22,23,24,25, 0, 0, 0, 0, 0, 0,26,27,28,

29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,

49,50,51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, };

 

void base64encode(char *src, char *dest, int len)

// Encodes a buffer to base64

{

 int i=0, slen=strlen(src);

 for(i=0;i<slen && i<len;i+=3,src+=3)

 { // Enc next 4 characters

 *(dest++)=base64encode_lut[(*src&0xFC)>>0x2];

 *(dest++)=base64encode_lut[(*src&0x3)<<0x4|(*(src+1)&0xF0)>>0x4];

 *(dest++)=((i+1)<slen)?base64encode_lut[(*(src+1)&0xF)<<0x2|(*(src+2)&0xC0)>>0x6]:'=';

 *(dest++)=((i+2)<slen)?base64encode_lut[*(src+2)&0x3F]:'=';

 }

 *dest='\0'; // Append terminator

}

 

void base64decode(char *src, char *dest, int len)

// Encodes a buffer to base64

{

 int i=0, slen=strlen(src);

 for(i=0;i<slen&&i<len;i+=4,src+=4)

 { // Store next 4 chars in vars for faster access

 char c1=base64decode_lut[*src], c2=base64decode_lut[*(src+1)], c3=base64decode_lut[*(src+2)], c4=base64decode_lut[*(src+3)];

 // Decode to 3 chars

 *(dest++)=(c1&0x3F)<<0x2|(c2&0x30)>>0x4;

 *(dest++)=(c3!=64)?((c2&0xF)<<0x4|(c3&0x3C)>>0x2):'\0';

 *(dest++)=(c4!=64)?((c3&0x3)<<0x6|c4&0x3F):'\0';

 }

 *dest='\0'; // Append terminator

}

 

int b64_encode_string( char *source, char *lrvar )

// ----------------------------------------------------------------------------

// Encodes a string to base64 format

//

// Parameters:

//        source    Pointer to source string to encode

//        lrvar     LR variable where base64 encoded string is stored

//

// Example:

//

//        b64_encode_string( "Encode Me!", "b64" )

// ----------------------------------------------------------------------------

{

 int dest_size;

 int res;

 char *dest;

 // Allocate dest buffer

 dest_size = 1 + ((strlen(source)+2)/3*4);

 dest = (char *)malloc(dest_size);

 memset(dest,0,dest_size);

 // Encode & Save

 base64encode(source, dest, dest_size);

 lr_save_string( dest, lrvar );

 // Free dest buffer

 res = strlen(dest);

 free(dest);

 // Return length of dest string

 return res;

}

 

int b64_decode_string( char *source, char *lrvar )

// ----------------------------------------------------------------------------

// Decodes a base64 string to plaintext

//

// Parameters:

//        source    Pointer to source base64 encoded string

//        lrvar     LR variable where decoded string is stored

//

// Example:

//

//        b64_decode_string( lr_eval_string("{b64}"), "Plain" )

// ----------------------------------------------------------------------------

{

 int dest_size;

 int res;

 char *dest;

 // Allocate dest buffer

 dest_size = strlen(source);

 dest = (char *)malloc(dest_size);

 memset(dest,0,dest_size);

 // Encode & Save

 base64decode(source, dest, dest_size);

 lr_save_string( dest, lrvar );

 // Free dest buffer

 res = strlen(dest);

 free(dest);

 // Return length of dest string

 return res;

}