Friday, 28 June 2013

DYNAMIC PIVOT Table in Sql server

This is fine only when you know how many columns you need. But when columns vary according to the query then how could you apply them on your scripts. The only way is to store them in a string variable at runtime and apply them in a dynamic SQL query, shown below.


USE [tempdb]
GO
 
-- Create test tables
create table table1 (number int, desc varchar(20),
location int, numberatlocation int)
create table table2 (code int, name varchar(20))
 
-- Insert test data
insert into table1 values (12345,'test',1000,5)
insert into table1 values (12345,'test',1001,2)
insert into table1 values (12345,'test',1002,4)
insert into table1 values (12345,'test',1003,9)
insert into table1 values (12345,'test',1004,7)
 
insert into table2 values (1000,'loc1')
insert into table2 values (1001,'loc2')
insert into table2 values (1002,'loc3')
insert into table2 values (1003,'loc4')
insert into table2 values (1004,'loc5')
 
-- Static PIVOT
select number, description, [loc1], [loc2], [loc3], [loc4], [loc5]
from (select number, desc, numberatlocation, name
from table1 join table2 on table1.location=table2.code)p
PIVOT(MAX (numberatlocation) FOR Name IN ( [loc1], [loc2], [loc3], [loc4], [loc5] )
) AS pvt
ORDER BY number
 
 
Output of Static query:
number desc loc1 loc2 loc3 loc4 loc5
12345 test    5       2       4       9       7
 
-- Dynamic PIVOT
 
-- Lets add one more record on both the tables to check the results
insert into table1 values (12345,'test',1005,3)
insert into table2 values (1005,'loc6')
 
declare @col varchar(1000)
declare @sql varchar(2000)
 
select @col = COALESCE(@col + ', ','') + QUOTENAME(name)
from table2
 
select @col -- This gives: [loc1], [loc2], [loc3], [loc4], [loc5], [loc6]
 
-- Now setting this @col variable in the Dynamic SQL.
set @sql = '
select number, desc, ' + @col + '
from (select number, desc, numberatlocation, name
from table1 join table2 on table1.location=table2.code)p
PIVOT(MAX (numberatlocation) FOR Name IN ( ' + @col + ' )
) AS pvt
ORDER BY number'
 
print @sql
 
exec (@sql)
 
Output of Dynamic query:
number desc loc1 loc2 loc3 loc4 loc5    loc6
12345 test    5       2       4       9       7       3
 
 
-- Final Cleanup
drop table table1
drop table table2
 
 
 
 

Thursday, 20 June 2013

SQL Server Database Design Practices and Checklist

Talking with customers and solving their real world problems is something I love doing. This is my day job and I never get tired of this. As we meet customers almost every single day we also have our own feel good factors of suggestions. I am not calling these as best practices explicitly because these are general guidelines and there can be exception to these in your environment for the data set and project that you are working. So read this blog post keeping them in mind. Don’t use them something written on stone but as a mini-checklist used to meet your needs.

This will be Part I of many more parts to come in the future as I gather my thoughts on various suggestions I give customers. Do feel free to drop me a line if you want something covered here.

* These are my perspectives of various DO’s and DONT’s. These can be different and you might have your very own standards. These are *general* tips and can be overridden based on the application under question.
Database Design Tips
This is a high level summary of a number of tips discussed later in this blog.
  1. Do create tables with a primary key.
  2. Do Not create tables without clustered index (typically we will have clustered primary keys).
  3. Do Not enforce foreign key relationships in the database with code. Always use Referential Integrity and foreign key declarations.
  4. Do Not develop a system by writing any code before the database schema is modeled and approved by design team.
  5. Do Not reverse-engineer the database schema after the system is built.
  6. Do have consistent data types between columns that are in a primary/foreign key relationship.
  7. Do make database objects descriptive.
Physical DB Model
A physical data model graphically represents the implementation of a database. It is constrained both by the logical data model it represents and the features of the underlying DB. The process of translating a logical model into a physical model includes the following tasks:
  1. Do create “legal” DB names for entities and attributes.
  2. Do assign appropriate data types and null-ability for each attribute.
  3. Do define primary keys, foreign keys and indexes.
  4. Do define rules and defaults.
  5. Do de-normalize if necessary for performance (typically in a Datamart or data Wharehouse database).
Design for Performance
As mentioned earlier, know what is the type of application we are designing. Is it an OLTP, OLAP or Reporting application. Based on this, designs can vary by miles.
  1. Do define the Primary Key on a single integer column which is typically implemented with an identity property. This keeps the dependent tables with a narrower row width and therefore, more rows per page which results in fewer scans.
  2. Do define the Primary Key as clustered. This keeps the secondary indexes much smaller.
  3. Do create non-clustered indexes on Foreign Key columns.
  4. Do make sure the tables have statistics. Keeping “Auto Update Statistics” and “Auto Create Statistics” options ON in the database is the default. For read only databases, it may be necessary to manually create statistics.
  5. Do select the correct “Recovery Model” for a database.
  6. Do use 100% Fill Factor on read-only or seldom updated tables.
  7. Do Not over-index, make sure you know which indexes will be used.
Naming Conventions
A database consists of a collection of tables that contain data and other objects, such as views, indexes, stored procedures, and triggers, defined to support activities performed with the data. The data stored in a database is usually related to a particular subject or process.
Database objects should be named clearly and unambiguously. The name should provide as much information as possible about the object. A name is used to uniquely identifies the object. Make sure this naming is consistent wherever the object is used throughout the database. Saving keystrokes should never be used as a criterion in selecting a name.
The following rules should be followed for all database object names:
  1. Do Not abbreviate unless absolutely necessary due to length restrictions.  If abbreviations are used, it should remain consistent throughout a project and be documented.
  2. Do Not use special characters when creating database objects.
  3. Do restrict names to alphanumeric characters.
  4. Do make the database objects descriptive.
  5. Do use Pascal Naming by forming names by capitalizing the first letter of each word without embedded spaces (e.g., InvoiceDetail).
Abbreviation Standards
  1. Do avoid using abbreviations.
  2. Do Not use a different letter to start an abbreviation then the first letter of the word being abbreviated (i.e., XFER is not an acceptable abbreviation for Transfer).
  3. Do eliminate vowels first, followed by the least significant consonants of the word.
  4. Double letters can be eliminated unless they are required for clarity.
  5. Do Not use an abbreviation that strongly suggests another word. (Example: the word “parent” could be abbreviated PRNT but this would strongly suggest the word “print.”. A better abbreviation for parent is PARNT.)
  6. Do use consistent abbreviations of similar words. If Charge is CHRG then Change should be CHNG.
  7. Do Not use acronyms if the acronym is not generally known or is subject to multiple interpretations.
  8. Do use abbreviations consistently in the system.
  9. Do Not try to deviate from consistency. I have seen systems mark as _dt for some date field while the datatype is of Varchar. These are great confusions and a recipe for disaster.
I have seen a number of database designs and some of the abbreviations are pathetic and an eye sore. Sometimes when I read them and turn towards the developer – they carry a smile with a look that says: “I didn’t design or name the system :)”.
**** Below are a bunch of naming conventions I have seen. You are free to use them or even ignore them if they don’t fit the bill of your organization / project conventions. ****
Database Names
Database names should use the same convention as described above for database objects: no special characters, alphanumeric characters only and initial capitals for delimiters between words.
  1. Do Not use DB as a suffix for Database name.
  2. Do Not make the database name plural, Example: Use LegalPartner not LegalPartners.
  3. Do use qualifier suffixes for database names like ODS, DataMart, Factory, Staging, Extract and Archive for special type of databases.
  4. Do make the database name mnemonic and/or descriptive.
  5. Do use Pascal Naming by forming names by capitalizing the first letter of each word without embedded spaces or underscores (e.g., LegalPartner).
Table Names
  1. Do Not make the table name plural, Example: Use Organization not Organizations.
  2. Do make the table name mnemonic and/or descriptive.
  3. Do use Pascal Naming by forming names by capitalizing the first letter of each word without embedded spaces or underscores (e.g., BillingDetail).
  4. Do name Associative tables, tables created to resolve a one to many or many to many cardinality, a concatenation of the two referenced table names.
  5. Example: PersonAddress resolves many to many between the Person and Address tables.
Personally I am not a big fan of prefix of tbl to all the tables as it can be easily got from meta data of sys.tables in one shot easily.
The same principle applies to Views. But it is worthwhile to prefix the view based on where it is being used. This can be standard view (vw), Reporting View (rv), ETL view (etl) etc. So feel free to use them appropriately.
Column Names
This can get little complicated and specific to how people design systems. I like a three part name: [Primary][Qualifier][Classifier]. As the names suggests the Primary describes the column a bit more like in EnglishProductName or AlternateProductID. The qualifier can be the descriptive word like in: InventoryInHandQty. The final classifier can give me an idea of what datatype we might be using Qty = Quantity = Integer, ID = Identifier = BigInt, Dt = Data datatype etc.
  1. Do Not use spaces or special characters in column names.
  2. Do use underscores ONLY when making Foreign Key columns that require a Modifier to make the column name more understandable.
  3. Do Not abbreviate the column name.
  4. Do use the table name primary word when creating a primary key.
  5. Do use “ID” as a column name suffix, if it is an INTEGER identifier. If it’s a VARCHAR column it should end with “Code”.
The following attributes can be used where tracking when/who changed a row of data is required.
CreatedDateTime
CreatedBy_AccountID
UpdatedDateTime
UpdatedBy_AccountID
RowStatus_OptionID – (Optional) Used to mark row as Active/InActive.
RowVersion
Other General recommendation
  1. Do Not use spaces or special characters, underscores are the exception for stored procedures.
  2. Do Not name stored procedure with numbers (e.g. spc_myProc666).
  3. Do spell out the whole column name when defining Indexes.
  4. Do Not number the indexes.
  5. Do use the word “All” for an index that covers all columns in the table.
  6. Do use underscores between the column names help readability.
  7. Do name Primary Keys with PK_ followed by the table name, only.
  8. Do name Foreign Keys with FK_ followed by the child table name, then the column name.
  9. Do Not name Foreign Keys with number suffixes, as in FK_Table_Column01.
  10. Do Not use Double Underscores.
  11. Do name Check Constraints with CK_ followed by the table name, then a colum name.
Final Words
I know this is just a subset of what is available in your development checklist. These are just design list that I have made. The next will be add a security list, development list, deployment list, high-availability practices list etc. I think those will follow in the future.

Wednesday, 19 June 2013

SQL Data Types

Data types and ranges for Microsoft Access, MySQL and SQL Server.

Microsoft Access Data Types

Data type Description Storage
Text Use for text or combinations of text and numbers. 255 characters maximum  
Memo Memo is used for larger amounts of text. Stores up to 65,536 characters. Note: You cannot sort a memo field. However, they are searchable  
Byte Allows whole numbers from 0 to 255 1 byte
Integer Allows whole numbers between -32,768 and 32,767 2 bytes
Long Allows whole numbers between -2,147,483,648 and 2,147,483,647 4 bytes
Single Single precision floating-point. Will handle most decimals 4 bytes
Double Double precision floating-point. Will handle most decimals 8 bytes
Currency Use for currency. Holds up to 15 digits of whole dollars, plus 4 decimal places. Tip: You can choose which country's currency to use 8 bytes
AutoNumber AutoNumber fields automatically give each record its own number, usually starting at 1 4 bytes
Date/Time Use for dates and times 8 bytes
Yes/No A logical field can be displayed as Yes/No, True/False, or On/Off. In code, use the constants True and False (equivalent to -1 and 0). Note: Null values are not allowed in Yes/No fields 1 bit
Ole Object Can store pictures, audio, video, or other BLOBs (Binary Large OBjects) up to 1GB
Hyperlink Contain links to other files, including web pages  
Lookup Wizard Let you type a list of options, which can then be chosen from a drop-down list 4 bytes


MySQL Data Types

In MySQL there are three main types : text, number, and Date/Time types.
Text types:
Data type Description
CHAR(size) Holds a fixed length string (can contain letters, numbers, and special characters). The fixed size is specified in parenthesis. Can store up to 255 characters
VARCHAR(size) Holds a variable length string (can contain letters, numbers, and special characters). The maximum size is specified in parenthesis. Can store up to 255 characters. Note: If you put a greater value than 255 it will be converted to a TEXT type
TINYTEXT Holds a string with a maximum length of 255 characters
TEXT Holds a string with a maximum length of 65,535 characters
BLOB For BLOBs (Binary Large OBjects). Holds up to 65,535 bytes of data
MEDIUMTEXT Holds a string with a maximum length of 16,777,215 characters
MEDIUMBLOB For BLOBs (Binary Large OBjects). Holds up to 16,777,215 bytes of data
LONGTEXT Holds a string with a maximum length of 4,294,967,295 characters
LONGBLOB For BLOBs (Binary Large OBjects). Holds up to 4,294,967,295 bytes of data
ENUM(x,y,z,etc.) Let you enter a list of possible values. You can list up to 65535 values in an ENUM list. If a value is inserted that is not in the list, a blank value will be inserted. Note: The values are sorted in the order you enter them.
You enter the possible values in this format: ENUM('X','Y','Z')
SET Similar to ENUM except that SET may contain up to 64 list items and can store more than one choice
Number types:
Data type Description
TINYINT(size) -128 to 127 normal. 0 to 255 UNSIGNED*. The maximum number of digits may be specified in parenthesis
SMALLINT(size) -32768 to 32767 normal. 0 to 65535 UNSIGNED*. The maximum number of digits may be specified in parenthesis
MEDIUMINT(size) -8388608 to 8388607 normal. 0 to 16777215 UNSIGNED*. The maximum number of digits may be specified in parenthesis
INT(size) -2147483648 to 2147483647 normal. 0 to 4294967295 UNSIGNED*. The maximum number of digits may be specified in parenthesis
BIGINT(size) -9223372036854775808 to 9223372036854775807 normal. 0 to 18446744073709551615 UNSIGNED*. The maximum number of digits may be specified in parenthesis
FLOAT(size,d) A small number with a floating decimal point. The maximum number of digits may be specified in the size parameter. The maximum number of digits to the right of the decimal point is specified in the d parameter
DOUBLE(size,d) A large number with a floating decimal point. The maximum number of digits may be specified in the size parameter. The maximum number of digits to the right of the decimal point is specified in the d parameter
DECIMAL(size,d) A DOUBLE stored as a string , allowing for a fixed decimal point. The maximum number of digits may be specified in the size parameter. The maximum number of digits to the right of the decimal point is specified in the d parameter
*The integer types have an extra option called UNSIGNED. Normally, the integer goes from an negative to positive value. Adding the UNSIGNED attribute will move that range up so it starts at zero instead of a negative number.
Date types:
Data type Description
DATE() A date. Format: YYYY-MM-DDNote: The supported range is from '1000-01-01' to '9999-12-31'
DATETIME() *A date and time combination. Format: YYYY-MM-DD HH:MM:SSNote: The supported range is from '1000-01-01 00:00:00' to '9999-12-31 23:59:59'
TIMESTAMP() *A timestamp. TIMESTAMP values are stored as the number of seconds since the Unix epoch ('1970-01-01 00:00:00' UTC). Format: YYYY-MM-DD HH:MM:SSNote: The supported range is from '1970-01-01 00:00:01' UTC to '2038-01-09 03:14:07' UTC
TIME() A time. Format: HH:MM:SSNote: The supported range is from '-838:59:59' to '838:59:59'
YEAR() A year in two-digit or four-digit format. Note: Values allowed in four-digit format: 1901 to 2155. Values allowed in two-digit format: 70 to 69, representing years from 1970 to 2069
*Even if DATETIME and TIMESTAMP return the same format, they work very differently. In an INSERT or UPDATE query, the TIMESTAMP automatically set itself to the current date and time. TIMESTAMP also accepts various formats, like YYYYMMDDHHMMSS, YYMMDDHHMMSS, YYYYMMDD, or YYMMDD.

SQL Server Data Types

Character strings:
Data type Description Storage
char(n) Fixed-length character string. Maximum 8,000 characters n
varchar(n) Variable-length character string. Maximum 8,000 characters  
varchar(max) Variable-length character string. Maximum 1,073,741,824 characters  
text Variable-length character string. Maximum 2GB of text data  
Unicode strings:
Data type Description Storage
nchar(n) Fixed-length Unicode data. Maximum 4,000 characters  
nvarchar(n) Variable-length Unicode data. Maximum 4,000 characters  
nvarchar(max) Variable-length Unicode data. Maximum 536,870,912 characters  
ntext Variable-length Unicode data. Maximum 2GB of text data  
Binary types:
Data type Description Storage
bit Allows 0, 1, or NULL  
binary(n) Fixed-length binary data. Maximum 8,000 bytes  
varbinary(n) Variable-length binary data. Maximum 8,000 bytes  
varbinary(max) Variable-length binary data. Maximum 2GB  
image Variable-length binary data. Maximum 2GB  
Number types:
Data type Description Storage
tinyint Allows whole numbers from 0 to 255 1 byte
smallint Allows whole numbers between -32,768 and 32,767 2 bytes
int Allows whole numbers between -2,147,483,648 and 2,147,483,647 4 bytes
bigint Allows whole numbers between -9,223,372,036,854,775,808 and 9,223,372,036,854,775,807 8 bytes
decimal(p,s) Fixed precision and scale numbers. Allows numbers from -10^38 +1 to 10^38 –1.
The p parameter indicates the maximum total number of digits that can be stored (both to the left and to the right of the decimal point). p must be a value from 1 to 38. Default is 18.
The s parameter indicates the maximum number of digits stored to the right of the decimal point. s must be a value from 0 to p. Default value is 0
5-17 bytes
numeric(p,s) Fixed precision and scale numbers. Allows numbers from -10^38 +1 to 10^38 –1.
The p parameter indicates the maximum total number of digits that can be stored (both to the left and to the right of the decimal point). p must be a value from 1 to 38. Default is 18.
The s parameter indicates the maximum number of digits stored to the right of the decimal point. s must be a value from 0 to p. Default value is 0
5-17 bytes
smallmoney Monetary data from -214,748.3648 to 214,748.3647 4 bytes
money Monetary data from -922,337,203,685,477.5808 to 922,337,203,685,477.5807 8 bytes
float(n) Floating precision number data from -1.79E + 308 to 1.79E + 308.The n parameter indicates whether the field should hold 4 or 8 bytes. float(24) holds a 4-byte field and float(53) holds an 8-byte field. Default value of n is 53. 4 or 8 bytes
real Floating precision number data from -3.40E + 38 to 3.40E + 38 4 bytes
Date types:
Data type Description Storage
datetime From January 1, 1753 to December 31, 9999 with an accuracy of 3.33 milliseconds 8 bytes
datetime2 From January 1, 0001 to December 31, 9999 with an accuracy of 100 nanoseconds 6-8 bytes
smalldatetime From January 1, 1900 to June 6, 2079 with an accuracy of 1 minute 4 bytes
date Store a date only. From January 1, 0001 to December 31, 9999 3 bytes
time Store a time only to an accuracy of 100 nanoseconds 3-5 bytes
datetimeoffset The same as datetime2 with the addition of a time zone offset 8-10 bytes
timestamp Stores a unique number that gets updated every time a row gets created or modified. The timestamp value is based upon an internal clock and does not correspond to real time. Each table may have only one timestamp variable   

Other data types:

Data type Description
sql_variant Stores up to 8,000 bytes of data of various data types, except text, ntext, and timestamp
uniqueidentifier Stores a globally unique identifier (GUID)
xml Stores XML formatted data. Maximum 2GB
cursor Stores a reference to a cursor used for database operations
table Stores a result-set for later processing

Tuesday, 11 June 2013

open a new browser window using Java Script

Response.Redirect to open a new browser window

 

Response.Redirect to open a new browser window

response redirect open in new window using script manager add RegisterStartupScript
on the page.


protected void Button1_Click(object sender, EventArgs e)
{
   ScriptManager.RegisterStartupScript(Page, typeof(Page), "OpenWindow", "window.open('YourPage.aspx?Param=" + ParamX.ToString() + "');",true);
}

Disable Right Click webpage by JavaScript, ASP.Net

<script type="text/javascript">
<!--
var message="Disabled";
 
///////////////////////////////////
function clickIE4(){
if (event.button==2){
alert(message);
return false;
}
}
   
function clickNS4(e){
if (document.layers||document.getElementById&&!document.all){
if (e.which==2||e.which==3){
alert(message);
return false;
}
}
}
   
if (document.layers){
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown=clickNS4;
}
else if (document.all&&!document.getElementById){
document.onmousedown=clickIE4;
}
   
document.oncontextmenu=new Function("alert(message);return false")
   
// -->
</script>
  
<script type="text/javascript">
function disableSelection(target){
if (typeof target.onselectstart!="undefined") //For IE
 target.onselectstart=function(){return false}
else if (typeof target.style.MozUserSelect!="undefined") //For Firefox
 target.style.MozUserSelect="none"
else //All other route (For Opera)
 target.onmousedown=function(){return false}
target.style.cursor = "default"
}
   
</script>

Best Visual Studio 2010 Extensions

Best Visual Studio 2010 Extensions I'm using.

Recommended extensions for Visual Studio 2010.


Snippet Designer
http://visualstudiogallery.msdn.microsoft.com/B08B0375-139E-41D7-AF9B-FAEE50F68392

JScript Editor Extensions
http://visualstudiogallery.msdn.microsoft.com/872d27ee-38c7-4a97-98dc-0d8a431cc2ed

Entity Framework Power Tools Beta 2
http://visualstudiogallery.msdn.microsoft.com/72a60b14-1581-4b9b-89f2-846072eff19d

devColor
http://visualstudiogallery.msdn.microsoft.com/7dbae8b3-5812-490e-913e-7bfe17f47f1d

Image Optimizer
http://visualstudiogallery.msdn.microsoft.com/a56eddd3-d79b-48ac-8c8f-2db06ade77c3/



CodeMaid
http://visualstudiogallery.msdn.microsoft.com/76293c4d-8c16-4f4a-aee6-21f83a571496

PowerCommands for Visual Studio 2010
http://visualstudiogallery.msdn.microsoft.com/e5f41ad9-4edc-4912-bca3-91147db95b99

Spell Checker
http://visualstudiogallery.msdn.microsoft.com/7c8341f1-ebac-40c8-92c2-476db8d523ce

CSS 3 Intellisense Schema
http://visualstudiogallery.msdn.microsoft.com/7211bcac-091b-4a32-be2d-e797be0db210/

LINQ Insight
http://visualstudiogallery.msdn.microsoft.com/269e6da9-7f4d-4650-a327-c70b359dcfe0

Linqer
http://www.sqltolinq.com

Thursday, 6 June 2013

Cloud Computing Basic Interview Question answer

 

Cloud Computing Basic

What is Hypervisor in Cloud Computing and its types?

The hypervisor is a virtual machine monitor (VMM) that manages resources for virtual machines. The name hypervisor is suggested as it is a supervisory tool for the virtual machines. There are mainly two types of hypervisors :
-> Type-1: the guest Vm runs directly over the host hardware, e.g Xen, Hyper-V, VmWare ESXi
-> Type-2: the guest Vm runs over hardware through a host OS, e.g Kvm, Oracle virtualbox

Are Type-1 Hypervisors better in performance than Type-2 Hypervisors and Why?

Yes the Type-1 Hypervisors are better in performance as compared to Type-2 hypervisors because Type-1 hypervisors does not run through a host OS, they utilize all resources directly from Host hardware. In cloud implementation Type-1 hypervisors are used rather than Type-2 because Cloud servers need to run multiple OS images and it should be noted that if OS images are run on host a OS as in case of Type-2, the resources will get wasted.

What are the characteristics on which a Cloud Computing Model should be selected for implementing and managing workload?
Scalability is a characteristic of cloud computing through which increasing workload can be handled by increasing in proportion the amount of resource capacity. It allows the architecture to provide on demand resources if the requirement is being raised by the traffic. Whereas, elasticity is being one of the characteristic provide the concept of commissioning and decommissioning of large amount of resource capacity dynamically. It is measured by the speed by which the resources are coming on demand and the usage of the resources.

What do you understand by CaaS?

CaaS is a terminology given in telecom industry as Communication as a Service. The Voice-over-Ip (VoIP) follows a same delivery model. CaaS can offer the enterprise user features such as desktop call control, presence, unified messaging, and desktop faxing. In addition to the enterprise features, CaaS also has a set of services for contact center automation that includes IVR, ACD, call recording, multimedia routing (e-mail and text chat), and screen pop integration.

What is the minimal requirement to implement an IAAS Cloud?

The minimal requirement to implement are basically three things:
-> OS to support hypervisor or a hypervisor.
- Preferably open-source software like Linux and Xen hypervisor
-> Networking topology and implementation.
- Public Network or Private network with Level 3 Switch
-> Selection of cloud model as per requirement or business.
- SaaS, Software as a Service
- PaaS, Platform as a Service
- CaaS, Communication as a Service

How is the Cloud Computing different from primitive Client-Server Architecture?

The primitive Client-Server architecture is a one-to-one communication between only two physical machines namely Client machine and Server machine (datacenter). Whereas the cloud computing, infrastructure is similar at the client side but varies at server-side. The server-side contains a main Cloud Controller that forwards the request to its worker machines known as Nodes. These nodes are a grid computing machines that dedicate all its resources to process application. These nodes are maintained in clusters. So a cloud computing infrastructure is quite complicated on server side that processes all the requests from clients and send the result back.

Why should one prefer public cloud over private cloud?

The cloud technology is the best example of sustainable technology that utilizes all the computing resources. If a person needs to setup a quick business and wants to host its website, he need not require to setup a full-fledged private cloud. Rather he should go for public cloud hosting that provides different pay-per-use subscriptions, which could actually result in being economical. There are numbers of vendors that provide such services like godaddy.com etc.

Is it cost effective to implement a private cloud rather than a public cloud and why?

It depends on the type of business that demands a cloud setup. Suppose if the subscription on a public cloud for an application that is to be deployed on OS images is proving to be more costly then to buy some new datacenters and maintain them. Then obviously the a private cloud has to be setup instead of a public cloud. This public clouds follow utility billing methodology as electricity bill for example.

Does network topology play an important role in deciding the success of a Cloud Infrastructure?

The network topology plays a vital role in selecting a cloud model and success of that model

Public Cloud
These are the platforms which are public means open to the people for use and deployment. For example, google, amazon etc. They focus on a few layers like cloud application, infrastructure providing and providing platform markets.
Private Cloud
Organizations choose to build their private cloud as to keep the strategic, operation and other reasons to themselves and they feel more secure to do it.
Hybrid Clouds
It is the combination of public and private cloud. It is the most robust approach to implement cloud architecture as it includes the functionalities and features of both the worlds.

Is Cloud Computing an application?

The Cloud Computing is not an application but it is a methodology that deploys application in a custom fashion on a server. It can be also learned as an advance model of client-server architecture that is highly flexible, scalable and configurable. This architecture leverages high performance out of machines with quite an ease of management.
 

Cloud Computing Architecture


What is the use of defining cloud architecture?

Cloud architecture is a software application that uses on demand services and access pool of resources from the cloud. Cloud architecture act as a platform on which the applications are built. It provides the complete computing infrastructure and provides the resources only when it is required. It is used to elastically scale up or down the resources according to the job that is being performed.

How does cloud architecture overcome the difficulties faced by traditional architecture?

Cloud architecture provide large pool of dynamic resources that can be accessed any time whenever there is a requirement, which is not being given by the traditional architecture. In traditional architecture it is not possible to dynamically associate a machine with the rising demand of infrastructure and the services. Cloud architecture provides scalable properties to meet the high demand of infrastructure and provide on-demand access to the user.

What are the three differences that separate out cloud architecture from the tradition one?

The three differences that make cloud architecture in demand are:
1. Cloud architecture provides the hardware requirement according to the demand. It can run the processes when there is a requirement for it.
2. Cloud architecture is capable of scaling the resources on demand. As, the demand rises it can provide infrastructure and the services to the users.
3. Cloud architecture can manage and handle dynamic workloads without failure. It can recover a machine from failure and always keep the load to a particular machine to minimum.

What are the advantages of cloud architecture?

Cloud architecture uses simple APIs to provide easily accessible services to the user through the internet medium. It provides scale on demand feature to increase the industrial strength. It provides the transparency between the machines so that users don't have to worry about their data. Users can just perform the functionality without even knowing the complex logics implemented in cloud architecture. It provides highest optimization and utilization in the cloud platform

What is the business benefits involved in cloud architecture?

1. Zero infrastructure investment: Cloud architecture provide user to build large scale system with full hardware, machines, routers, backup and other components. So, it reduces the startup cost of the business.
2. Just-in-time Infrastructure: It is very important to scale the infrastructure as the demand rises. This can be done by taking cloud architecture and developing the application in the cloud with dynamic capacity management.
3. More efficient resource utilization: Cloud architecture provides users to use their hardware and resource more efficiently and utilize it in a better way. This can be done only by applications request and relinquish resources only when it is needed (on-demand).
What are the examples of cloud architectures on which application can run?
There are lot of examples that uses cloud architecture for their applications like:
1. Processing Pipelines
Uses like document processing pipelines that convert documents of any form into raw searchable text.
- Image processing pipelines: Create thumbnails or low resolution image
- Video transcoding pipelines: Convert video from one form to another online
- Indexing: Create an index of web crawl data
- Data mining: Perform search over millions of records
2. Batch Processing Systems
- Systems that uses log management or generate reports.
- Automated Unit Testing and Deployment Testing
3. Websites
- Instant Websites: websites for conferences or events
- Promotion websites
What are the different components required by cloud architecture?
There are 5 major components of cloud architecture.
1. Cloud Ingress:
Provides a mean to communicate with the outside world. This can be done with the help of communication methods such as:
- Queue based communications
- HTTP communications
- REST/SOAP
- Service Bus
2. Processor Speed:
Processor speed is the major section on which the whole cloud architecture is based. It provides on demand resources that can be dynamically allocated to the user. It saves lots of cost and has many benefits of virtualization.
3. Cloud storage services:
Cloud services provide means to store data to user's applications. It is used to provide services for different types of storages like: table data, files.
4. Cloud provided services:
Additional services are provided by the cloud, like data services, payment processing services, and search or web functionality services.
5. Intra-Cloud communications:
it provides a way to communicate with other systems that are using cloud architecture. Providers usually provide services so that one user can communicate easily with another user by being on cloud.
What are the different phases involves in cloud architecture?
There are four phases that basically gets involved in the cloud architecture:
1. Launch phase: It launches the basic services and makes the system ready for communication and for application building
2. Monitor phase: It monitors the services that is being launched and then manages them so that on demand the user will be able to get what he wants.
3. Shutdown phase: It shutdown the services that are not required first and after all the services gets shutdown, and then it closes the system services.
4. Cleanup phase: It clean up the left out processes and services that is being either broken or didn't get shutdown correctly.
What is the relationship between SOA and cloud architecture?
Service oriented architecture (SOA) is an architectural style that supports service oriented methodology that is being added in the cloud architecture as a mandatory component. Cloud architecture support the use of on-demand access to resources and it provides lots of other facilities that are being found in SOA as well. SOA makes these requirements optional to use. But, to get the full functionality and more performance based efficiency there is a requirement for the mixture of SOA and cloud architecture.
How does the Quality of service is being maintained in the cloud architecture?
Cloud architecture mainly focuses on quality of service. It is a layer that manages and secures the transmission of the resources that is being acquired by on-demand access. Quality of service is being maintained such that it increases the performance, automated management, and support services. Cloud architecture provides easy to use methods and proper ways to ensure the quality of service. It is represented by a common cloud management platform that delivers many cloud services based on the same foundation.
What are the different roles defined by cloud architecture?
Cloud architecture defines three roles:
- Cloud service consumer: it is used to provide different services to the consumer on demand.
- Cloud service provider: here provider provides the services to meet the requirements of the user by monitoring the traffic and demands that are coming.
- Cloud service Creator: here creator is used to create the services and provide the infrastructure to the user to use and give the access to the resources. The roles that are being defined can be performed by one person or it can be performed by many people together. There can be more roles defined depending on the cloud architecture and the complexity with which it will scale.
What are the major building blocks of cloud architecture?
The major building blocks of cloud architecture are:
1. Reference architecture: it is used for documentation, communication, designing and defining various types of models
2. Technical Architecture: defines the structured stack, structure the cloud services and its components, show the relationship that exist between different components, management and security
3. Deployment Operation Architecture: it is used to operate and monitor the processes and the services.
What are the different cloud service models in cloud architecture?
There are 4 types of cloud service models available in cloud architecture:
1. Infrastructure as a service:
It provides the consumer with hardware, storage, network and other resources on rent. Through this consumer can deploy and run software using dedicated software. This includes the operating system and the applications that are associated with it.
2. Platform as a service:
it provides the user to deploy their software and application on the cloud infrastructure using the tools that are available with the operating system.
3. Software as a service: it provides the users the ability to run its application on the cloud infrastructure and can access it from any client device using any interface like web browser.
4. Business Process as a service: it provides any business process that is delivered through cloud service model using the internet and accesses the resources through the web portal.

What is the difference between vertical scale up and Horizontal scale out?

- Vertical scale up provides more resources to a single computational unit, whereas horizontal scale out provides additional computational unit and run them in parallel.
- Vertical scale up provides a provision to move a workload to other system that doesn't have workload, whereas horizontal scale out split the workload among various computational units.
- Vertical scale up doesn't have a database partitioning concept, whereas horizontal scale out provides the database partitioning.

How does cloud architecture provide performance transparency and automation?

There are lots of tools that are being used by the cloud architecture to provide the performance transparency and automation. The tools allow the user to monitor report and manage the cloud architecture. It also allows them to share the applications using the cloud architecture. Automation is the key component of cloud architecture as it provides the services to increase the degree of the quality. It brings the capacity on demand and allows the requirements of the user to be met.