EXPLAIN THE SUB-GENRES OF PERFORMANCE TESTING?

Explain The Sub-genres Of Performance Testing?

Load Testing: It is conducted to examine the performance of application for a specific expected load. Load can be increased by increasing the number of user performing a specific task on the application in a specific time period.

Stress Testing: Is conducted to evaluate a system performance by increasing the number of user more than the limits of its specified requirements. It is performed to understand at which level application crash.

Volume Testing: Test an application in order to determine how much amount of data it can handle efficiently and effectively.

Spike Testing: What changes happens on the application when suddenly large number of user increased or decreased.

Soak Testing: Is performed to understand the application behavior when we apply load for a long period of time what happens on the stability and response time of application.

HOW IS AN ARRAY DIFFERENT FROM LINKED LIST?

How is an Array different from Linked List?

The size of the arrays is fixed, linked lists are dynamic in size.

Inserting and deleting a new element in an array of elements is expensive, whereas both insertion and deletion can easily be done in Linked Lists.

Random access is not allowed in linked list.

Extra memory space for a pointer is required with each element of the linked list.

Arrays have better cache locality that can make a pretty big difference in performance.

 
 
 
 
 
 
 
 
 
 

WHAT’S THE DIFFERENCE BETWEEN SYMMETRIC AND ASYMMETRIC ENCRYPTION?

What’s the difference between Symmetric and Asymmetric encryption?

To boil down an extremely complicated topic into a few short words, Symmetric encryption uses the same key to encrypt and decrypt, while Asymmetric uses different keys for encryption and decryption. Symmetric is usually much faster, but is difficult to implement most times due to the fact that you would have to transfer the key over an unencrypted channel. Therefore many times an Asymmetric connection will be established first, then send creates the Symmetric connection.

WHAT IS SCRIPTED PIPELINE IN JENKINS?

What is Scripted Pipeline in Jenkins?

Scripted Pipeline, like Declarative Pipeline, is built on top of the underlying Pipeline sub-system. Unlike Declarative, Scripted Pipeline is effectively a general-purpose DSL [2] built with Groovy. Most functionality provided by the Groovy language is made available to users of Scripted Pipeline, which means it can be a very expressive and flexible tool with which one can author continuous delivery pipelines.

 
 
 
 
 
 
 
 
 
 

LIFT AND SHIFT MIGRATION TO THE CLOUD

Lift and Shift Migration to the Cloud

Lift and Shift Migration to the Cloud

Lift and shift is an approach, one among many, for migrating the apps to the cloud. It means moving an application and its related data to a cloud platform without restructuring the app.

There is no one-size-fits-all transition for moving an application from users on-premises data center to the cloud. But there are known core migration paths; many consider lift and shift is one of them. It is a way for organizations to safeguard their investments in business workflow, logic, and data trapped in on-premises hardware.

The lift-and-shift approach opens pathways to IT modernization by moving to an open and more extensible architecture in the cloud. Organizations consider lift and shift for solid business reasons, including minimized costs and improved performance and resiliency.

WHEN IS THE LIFT AND SHIFT CLOUD-MIGRATION MODEL A GOOD FIT??

With the lift-and-shift approach, on-premises applications can move to the cloud without redesigning. But they cannot always take complete advantage of native-cloud features, so this may not be the most cost-effective migration path. According to the survey, Gartner estimates that by 2020, organizations lacking cost-optimization processes will average 40% overspend in the public cloud.

STRATAGEMS TO CONSIDER

Rehost : This is infrastructure as a service (IaaS), or lift and shift. The user rehost his/her application in another hardware environment without changing the applications architecture. Migration is fast and comparatively low-priced, but ongoing operation can be costly because the user is not leveraging cloud efficiencies.

Refactor : Refactor is also known as platform as a service (PaaS), the user run his/her applications on a cloud provider’s infrastructure. Developers can reuse languages, frameworks, and containers leveraging code that’s strategic to the company.

Revise : Firstly, the user support legacy-modernization requirements by modifying or extending the existing code; then take the rehost or refactor route to the cloud. This means the user can leverage the cloud characteristics of their provider’s infrastructure but not without upfront development cost.

Rebuild : The user throws out the code for an existing app and re-architect it. The benefit is access to inventive features in the provider’s platform that improve developer’s productivity. The price the user pay is either lock-in or abandoning the application assets if the situation becomes unacceptable.

Replace : Discard the existing application set and adopt commercial software as a service (SaaS). When requirements for a business function change rapidly, this approach eludes the time and investment of mobilizing a development team. But there might be some issues such as inconsistent data semantics, difficult data-access, and vendor lock-in.

COMPONENT INTERACTION IN REACT

Component Interaction in React

Component Interaction in React

In React JS, there is often a need to pass data from one component to another. If you are passing data from somewhere in a component, to somewhere else inside the same component, this can be done through the state. So, let’s dive deep in and know more about component interaction in React.

WHAT IS THE STATE?

The heart of every React component is its “state”, an object that defines how that component renders and performs. In other words, “state” is what allows the user to create components that are dynamic and interactive.

Assume of the state as the difference between water, ice, and vapor. It is the same object, but subject on conditions, it can behave differently. That’s the same way to use state within components. The user can change the way objects appear, or interact by changing the state of those objects within a component.

HOW TO CHANGE STATE IN A COMPONENT?
Generally, the user would need to declare the state after setting the constructor.
class component_A extends Component {
constructor() {
super();
this.state = {
data: [],
};
}

In this case, we are outlining the state of data. We have defined it here as an empty array. We have to use an empty object, or empty quotes, depending on the data type we wanted to change the state of. Then when we are ready to change the state, we would simply use “this.setState.” With our instance above, it might look like this:

this.setState({data: data});

Here the user has two components, and the user needs to pass the data from one component to an other. The user would not be able to use state. The state can only be transferred within the component where it was created. Instead, the user can use props or properties.

Let’s say, the user has component_A, with files nested inside of it, and then it’s child components, component_B, and component_C. It is very probable that component_A would have data that the user would need to access in component_C. How can the user access that, or pass the data from component_A to component_C? Ultimately, what the user has to do, is;

If the user wants to pass the property of color from the parent component to one of the child components. The user can pass prop using “this” the same way set the state in a component earlier. In that instance, the state could then be used and passed throughout the component.

Passing data from parent to child components is little trickier, in that, the user cannot pass data in an unbroken chain to other components. In the above instance, the user actually needs to pass the data, in this case, {this.props.color} from component_A to component_B and then to component_C.

PROTOTYPE INHERITANCE IN JAVASCRIPT

Prototype Inheritance in JavaScript

INHERITANCE

Inheritance refers to an object’s capability to access methods and other properties from another object. Objects can inherit things from other objects. Inheritance in JavaScript works through prototypes and this form of inheritance is often called prototypal inheritance.

Prototype Inheritance in JavaScript

In this article, we will be covering a detailed note on prototypal inheritance and implementing inheritance.

PROTOTYPE

Almost all objects in JavaScript have the prototype property. The prototype is a reference to another object and it is used whenever JS cannot find the property the user is looking for in the current object. In simple, whenever the user wants to call a property on an object and it does not exist, JavaScript will go to the prototype object and look for it there. If it finds it will use it, if not it will go to that object’s property and look there. This can bubble up all the way to Object.prototype before returning undefined. This is the principle of the prototype chain and the behaviour that sits behind JavaScript’s inheritance.

THE PROTOTYPE CHAIN

To understand object prototypes, we need to discuss object lookup behaviour. When we look for a property of an object, the JavaScript engine will first check the object itself for the existence of the property. If not found, it will go to the object’s prototype and check that object. If found, it will use that property.

If not found, it will go to the prototype’s prototype, and on and on until it finds an object with a __proto__ property equal to null. So if the user is going to attempt to lookup the property someProperty on obj object from above, the engine would first check the object itself.

If it wouldn’t find it and would then jump to its __proto__ object which is equal to Object.prototype. It wouldn’t find it there either and upon seeing that the next __proto__ is null, it would return undefined.

This is called the prototype chain. It is normally described as a chain going downwards, with null at the very top and the object which the user is using at the bottom.

While performing a lookup, the engine will pass through up the chain looking for the property and return the first one it finds, or undefined if it is not present in the prototype chain.

__proto__ === null
|
|
__proto__ === Object.prototype
|
|
{ object literal }
FUNCTION PROTOTYPES

Functions all have a prototype property distinct from their __proto__ property. It is an object. A function’s sprototype’s __proto__ property is equal to Object.prototype.

function fn() {}
console.log(fn.prototype.__proto__ === Object.prototype);
// -> true

EXECUTING INHERITANCE

The user can work with a function’s prototype property directly and safely. By placing methods and other properties on a function’s prototype, and can allow all objects created by that function to access those properties through inheritance.

function Fn() {}
Fn.prototype.print = function() {
console.log(“Calling Fn.prototype’s print method”);
};
var obj = new Fn();
obj.print(); // -> Calling Fn.prototype’s print method

This works in a different way because, each object created by calling new Fn() will have its own version of print placed directly on the object. There will be different functions in memory. The difficulty with this is performance and memory usage.

PERFORMANCE

There may be times the user might need thousands of new objects created from a constructor function. Using this second way of attaching print, we now have thousands of copies of print, each one attached to one of the objects.

Using the prototype chain, no matter how many objects the user creates out of a Fn, the user will have one print sitting on Fn.prototype.

Big programs, however, often have tens of methods that objects need. If an object needs access to 20 methods and we create 100,000 objects, the JavaScript engine has created 2,000,000 new functions. If this needs to happen multiple times, this will cause visible speed and memory issues.

Using console.time and console.timeEnd, the user can directly show the difference in how long it takes.

THE VERDICT

Prototypes are more of a delegation tool and they do not really behave like classes. Now with the latest approach the user can create normal class hierarchies and use understandable syntax for them, but be cautious of possible problems that may occur. This syntax is only a beautiful facade for what’s going on inside.

CREATING SCHEMAS IN MONGODB USING MONGOOSE

Creating Schemas in MongoDB Using Mongoose

MONGOOSE
Mongoose is an “elegant MongoDB object modelling for Node.js “. If you have used MongoDB before and tried basic database operations, then you might have noticed that MongoDB is “schema-less”. When you are looking to implement a more structured database and want to leverage the power of MongoDB, Mongoose is one of the Object Data Mapping (ODM) solutions.

To quickly determine, run an insert command into a collection named users like the following:

Creating Schemas in MongoDB Using Mongoose

1db.users.insert({ name : ‘Arvind’, gender : ‘male’});

And right after that, you can run:

1db.users.insert({ name : ‘Arvind’, gender : ‘male’, password : ‘!@#$’});

MongoDB will never complain about the variation in the number of columns (key-value pairs). But when the user wants to keep the data more organized and controlled, the user would need to maintain that in server code, writing validation, making sure nothing unrelated is stored in a collection. This is where Mongoose makes task easy.

Mongoose provides a straight-forward, schema-based solution to modelling the application data and includes built-in typecasting, validation, query building, business logic hooks, and much more, out of the box.

In this article, we are going to show you how to use Mongoose for your MongoDB deployments to create a more straight-forward, schema-based solution to modelling your application data.

START DEVELOPING

After installing Node.js, create a new folder named “myMongooseApp” and open terminal/prompt and run:
1
npm init

This will help the user in setting a new node project. Fill it up as required. Next, install Mongoose as a dependency to the project and run;
npm install mongoose –save-dev
Then, start the MongoDB service by running:

Mongod

Then, create a new file named index.js at the root and then open it up in favorite editor. Add the below code:

var mongoose = require(‘mongoose’);
mongoose.connect(‘mongodb://localhost/myTestDB’);

var db = mongoose.connection;
db.on(‘error’, function (err) {
console.log(‘connection error’, err);
});
db.once(‘open’, function () {
console.log(‘connected.’);
});
Here, the user requires the Mongoose package to connect to the database and initialize the connection. The name of our database is myTestDB.
Then, run:
node index.js
The user should now see the connected message. The user can also use a node package named nodemon for automatically restarting the node server on changes.

MONGOOSE SCHEMA

Schemas are like skeletons of how the user data collection will look. If the user is dealing with a collection of customers, then the schema would look something like this:

Name – String
Age – Number
Gender – String
Date of Birth – Date

If the user is dealing with collection of products, then the schema would look like this:

SKU – String
Name – String
Price – Number
InStock – Boolean
Quantity – Number

The user can observe the drift. When the data is guarded with a schema, the probability of storing garbage data decreases drastically.

Now that we have got an understanding of schemas, let us try and build a user schema using Mongoose.

var Schema = mongoose.Schema;
var userSchema = new Schema({
name : String,
age : Number,
DOB : Date,
isAlive : Boolean
});

Then, create a model from the schema and add;
var User = mongoose.model(‘User’, userSchema);
The model is ready and now can use this as base schema to insert users into the database. This way, we know that every document in a user collection will have the fields listed on the schema. Now, let us create a new user instance and save it to DB.
var arvind = new User({
name : ‘Arvind’,
age : 99,
DOB : ’01/01/1915′,
isAlive : true
});

arvind.save(function (err, data) {
if (err) console.log(err);
else console.log(‘Saved : ‘, data );
});
The user should will find something like below:
Saved : { __v: 0,
name: ‘Arvind’,
age: 99,
DOB: Fri Jan 01 1915 00:00:00 GMT+0530 (IST),
isAlive: true,
_id: 536a4866dba434390d728216 }