Tuesday, December 7, 2010

HTTP vs HTTPS Protocals

Abstract

Data security plays an essential role in today’s web service. Secure HTTP (HTTPS) is one of the popular protocols to transfer sensitive data over the Internet. This paper shows how the security affects performance compared to HTTP. Based on our preliminary measurements, the average response time ranges from 0.1 to 5 seconds, and from 6 to 8 seconds, for HTTP and HTTPS, respectively. Our experiments also show that the HTTPS overhead mainly comes from clients other than servers.

1 Introduction

With the phenomenal growth of popularity of the Internet, security is more and more important to the E-commerce business. For some sites such as finance and online payment system, it’s more important than performance. Much research has been sparked to improve data security . Some mechanisms are proposed to improve security of network attached storage systems. Freeman and Miller gave an architecture file system to
guarantee user data security using end-to-end encryption. A secure scheme to protect network-attached storage systems against different types of attacks using strong cryptography is proposed in . HTTP  is the most popular protocol to transfer document over the Internet and Secure HTTP (HTTPS) is a protocol to transfer sensitive HTTP data over SSL (Secure Socket Layer) .

To understand how and to what extent the security mechanism of HTTPS affects the performance, we have been performing extensive measurements on the web servers environment. Our results show that HTTPS has different behaviors compared with HTTP and it costs more system resources on client side.


2 Preliminary Performance Analysis

We configured a standard http web server and a HTTPS server which is powered by a Verisign trial ID. Under HTTPS, all contents are encrypted through SSL (Secure Socket Layer). The system configurations are described in table l, and all machines are connected through a 100Mbps switch to form an isolated LAN.
The benchmark tool we are using is Micmsqj? Web Capacity Analysis Tool (WCAT).

WCAT runs simulated workloads on client-server configurations. WCAT measures how Internet Information Services and network configuration respond to a variety of different client requests for content, data, or html pages. The results of these tests can be used to determine the optimal server and network configuration. WCAT is specially designed to evaluate how Internet servers running Windows 2000 (or Windows NT) and Internet Information Services respond to various client workload simulations.

The server provides contents to the clients, and the controller collects the test data. The test suite we are using is Webstone, which is a standard benchmark and the size of the requested page ranges from lk to 200k. Each client runs 2 threads simultaneously. We started our experiments with measurement of system performance for HTTP and HTTPS under Webstone workload.  Throughput get saturated under HTTP much faster that HTTPS. For HTTP, the server gets saturated at throughput being 600 connections/second with 5 clients. While for HTTPS, the throughput is steadily increasing and gets saturated at 400 connections/second with over 45 clients. That’s around 33% performance reduction compared to HTTP. The response times for HTTP (less than 5 seconds) are also significantly lower than that of HTTPS which ranges from
6 to 8 seconds.


For HTTP, the server processor gets saturated very quickly,while for HTTPS, the server processor has much idle time before it is saturated with over45 clients. This implies that some computation such as verification, SSL encryption is handled on the client side before a request is send to the server, which dramatically
reduces the overall system performance. Even the server is saturated, the total processor time spend on web server process are still less than 80% for both HTTP and HTTPS. Another 20% CPU time are used to operating system itself.

Our further investigations on internal system counters such as context switch  and
system calls . For HTTP, with much more contexts witch and systems calls than HTTPS, the server provides much better system performance, that is, higher throughput and lower response time.

3 Conclusions

In this article, we have studied the security cost of HTTPS under Webstone workloads. Compared to standard HTTP, HTTPS costs more system resources on clients. Some computation such as verification, SSL encryption is handled on the client side before a request is send to the server, so much more clients are needed to saturate the server than that of HTTP. Once the server is saturated, the system performance of` HTTPS achieves around 67% of HTTP in terms of throughput.

The Gift

Decision Points

Monday, December 6, 2010

QTP-MS Word Scripts

1) create a word document and write some data

dim mw
set mw=CreateObject("Word.Application")
mw.Documents.Add
mw.selection.typetext "hello"
mw.ActiveDocument.SaveAs "e:\gcreddy.doc"
mw.quit
set mw=nothing


2) Create word, Create table and write all the services names

Set mw = CreateObject("Word.Application")
mw.Visible = True
Set dc = mw.Documents.Add()
Set objRange = dc.Range()
dc.Tables.Add
objRange,1,3
Set objTable = dc.Tables(1)
x=1
strComputer = "."
Set wms=GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = wms.ExecQuery("Select * from Win32_Service")
For Each s in colItems
If x > 1 Then
objTable.Rows.Add()
End If
objTable.Cell(x, 1).Range.Font.Bold = True
objTable.Cell(x, 1).Range.Text = s.Name
objTable.Cell(x, 2).Range.text = s.DisplayName
objTable.Cell(x, 3).Range.text = s.State
x = x + 1
Next


3) script to display all the doc files in all the drives in the system
Dim mw
Set mw=CreateObject("Word.Application")
Set fs=createobject("Scripting.FileSystemObject")
Set d=fs.Drives
mw.FileSearch.FileName="*.doc"
For each dr in d
msgbox dr
mw.FileSearch.LookIn=dr
mw.FileSearch.SearchSubFolders=True
mw.FileSearch.Execute
For each i in mw.FileSearch.FoundFiles
print i
Set f=fs.GetFile(i)
print f.Name&" "&f.Size&" "&f.DateCreated
print "-------------------------------------------------------------------"
Next
Next
mw.Quit 

4) Counting the number of times a word appears in a word document
Set objWord=CreateObject("Word.Application")
Set myfile=objWord.Documents.Open ("C:\Documents and Settings\gcr.GCRC-9A12FBD3D9\Desktop\xyz.doc")
strText="gcreddy"
strRead=myfile.Content
Set RegExp=new regexp
regexp.ignorecase=True
regexp.global=True
regexp.pattern=strText
Set matches=regexp.execute(strRead)
matchesFound=matches.count
msgbox matchesfound
myfile.close
set objFso=Nothing

QTP-System Administration Scripts

1) GettingLocalComputerInformation


Set
objComputer=CreateObject("Shell.LocalMachine")

Wscript.Echo
"Computername:"&objComputer.MachineName
Wscript.Echo
"Shutdownallowed:"&objComputer.IsShutdownAllowed
Wscript.Echo
"FriendlyUIenabled:"&objComputer.IsFriendlyUIEnabled
Wscript.Echo
"Guestaccessmode:"&objComputer.IsGuestAccessMode
Wscript.Echo
"Guestaccountenabled:"&_
    objComputer.IsGuestEnabled(0)
Wscript.Echo
"Multipleusersenabled:"&_
    objComputer.IsMultipleUsersEnabled
Wscript.Echo
"Offlinefilesenabled:"&_
    objComputer.IsOfflineFilesEnabled
Wscript.Echo
"Remoteconnectionsenabled:"&_
    objComputer.IsRemoteConnectionsEnabled
Wscript.Echo
"Undockenabled:"&objComputer.IsUndockEnabled


2) RestartaComputer

strComputer
="atl-dc-01"
Set
objWMIService=GetObject("winmgmts:"_
    &"{impersonationLevel=impersonate,(Shutdown)}!\\"&_
        strComputer&"\root\cimv2")

Set
colOperatingSystems=objWMIService.ExecQuery_
    ("Select*fromWin32_OperatingSystem")

For
EachobjOperatingSystemincolOperatingSystems
    objOperatingSystem.Reboot()
Next

3) ShutDownaComputer

strComputer
="."
Set
objWMIService=GetObject_
    ("winmgmts:{impersonationLevel=impersonate,(Shutdown)}\\"&_
        strComputer&"\root\cimv2")

Set
colOperatingSystems=objWMIService.ExecQuery_
    ("Select*fromWin32_OperatingSystem")

For
EachobjOperatingSystemincolOperatingSystems
    objOperatingSystem.Win32Shutdown(1)
Next
 
4) ModifySystemStartupDelay

strComputer
="."
Set
objWMIService=GetObject("winmgmts:"_
    &"{impersonationLevel=impersonate}!\\"&strComputer&"\root\cimv2")

Set
colStartupCommands=objWMIService.ExecQuery_
    ("Select*fromWin32_ComputerSystem")

For
EachobjStartupCommandincolStartupCommands
    objStartupCommand.SystemStartupDelay=10
    objStartupCommand.Put_
Next

QTP-Web Scripts-II


1) Script to get the list of links in Google and do spell check
 
Dim d
set mw=CreateObject("Word.Application")
set d=Description.Create
d("micclass").value="Link"
set a=Browser("Google").page("Google").childobjects(d)
for i=0 to a.count-1 
mw.WordBasic.filenew 
s=a(i).getROProperty("innertext")
mw.WordBasic.insert s 
if mw.ActiveDocument.Spellingerrors.count>0 then 
Reporter.ReportEvent 1,"Spelling","spelling error :"&s 
end if
mw.ActiveDocument.Close(False)
next
mw.quit
set mw=nothing

2) Script to check ON the checkboxes in yahoo mail inbox


Dim d
Set d=Description.Create
d("micclass").value="WebCheckBox"
Set c=Browser("Inbox (17) - Yahoo! Mail").Page("Inbox (17) - Yahoo! Mail").ChildObjects(d)
For i=1 to 10
c(i).set "ON"
Next



3) script to select a mail having subject 'hi' or 'HI'
 

n=Browser("yahoo").Page("yahoo").WebTable("Inbox").RowCount
For i=2 to n
s=Browser("yahoo").Page("yahoo").WebTable("Inbox").GetCellData(i,7)
If lcase(trim(s))="hi" Then
Browser("yahoo").Page("yahoo").WebCheckBox("index:="&i-1).set "ON"
End If
Next
 


4) Function to send a mail
 

Function SendMail(SendTo, Subject, Body, Attachment) 
Set otl=CreateObject("Outlook.Application")
Set m=otl.CreateItem(0) 
m.to=SendTo 
m.Subject=Subject 
m.Body=Body 
If (Attachment <> "") Then 
Mail.Attachments.Add(Attachment)
End If
m.Send 
otl.Quit 
Set m = Nothing 
Set otl = Nothing
End Function
Call SendMail("nagesh.rao46@gmail.com","hi","This is test mail for tsting","")
Adv VBScripts



5) Open Internet Explorer and navigate to yahoo mail
 

Dim ie
Set ie=CreateObject("InternetExplorer.Application")
ie.Visible=True
ie.Navigate "www.yahoomail.com"
x=Browser("CreationTime:=0").GetROProperty("title")
msgbox x

QTP-Web Scripts I


1) Count all opened Browsers on desktop and close them all?


Set oDesc = Description.Create()
oDesc("micclass").Value = "Browser"
Set Browsers =Desktop.ChildObjects (oDesc)
NumberofBrowsers = Browsers.Count()
Reporter.ReportEvent 2,"Res","Number of Browsers are: "&NumberOfBrowsers
For Counter=0 to NumberofBrowsers-1
Browsers(Counter).Close
Next



2) Count, how many links available in Mercury Tours Home Page.


Set oDesc = Description.Create()
oDesc("micclass").Value = "Link"
Set Lists = Browser("Welcome: Mercury").Page("Welcome: Mercury").ChildObjects (oDesc)
NumberOfLinks = Lists.Count()
Reporter.ReportEvent 2,"Res","Number of Links are: "&NumberOfLinks



3) Verify  whether the 'Gmail'  link available or not on Google Homepage 


Option explicit
Dim oLink, Links, TotLinks, i, myLink
Set oLink = description.Create
oLink("micclass").value = "Link"
SystemUtil.Run "D:\Program Files\Internet Explorer\IEXPLORE.EXE"
set Links = Browser("name:=Google").page("title:=Google").ChildObjects(oLink)
TotLinks = Links.count
For i =0 to TotLinks-1
myLink = Links(i).getroproperty("innertext")
If mylink = "Gmail" Then
     reporter.ReportEvent 0,"res","Link Gmail available"
End If
Next



4) Count number of Links, Edit Boxes available on Google Homepage?


Dim oLink
Set oLink=description.Create
Set oEdit=description.Create
oLink("micclass").value="Link"
oEdit("micclass").value="WebEdit"
Set Links=browser("name:=Google").page("title:=Google").ChildObjects(oLink)
Set EditBoxes=browser("name:=Google").page("title:=Google").ChildObjects(oEdit)
TotLinks= Links.count
TotEditBoxes=EditBoxes.count
msgbox TotLinks
msgbox TotEditBoxes
Reporter.ReportEvent 0,"Result","Total Links are: "&TotLinks&"Total edit Boxes are: "&TotEditBoxes


5) Count how many links available in a Web Page(any web page, using Regular Expressions)


Dim oLink,Links, TotLinks
Set oLink=Description.Create
oLink("micclass").value="Link"
Set Links=Browser("title:=.*").page("title:=.*").ChildObjects(oLink)
TotLinks=Links.count
msgbox TotLinks
Reporter.ReportEvent 2,"Res","Total Links are: "&TotLinks



Function To Create HTML Report


Dim StartTime,stTime, enTime
Dim fso, ts,intCnt, intPass,intFail
intPass=0
intFail=0
Const ForWriting = 2
Function OpenFile (strFileName)
StartTime = Timer
stTime = Time
Set fso = CreateObject("Scripting.FileSystemObject")
Set ts = fso.OpenTextFile(strFileName,2)
'OpenFile = strFileURL
CreateHeader
End Function



Function To Close File

Dim objIE,strFileURL
Function CloseFile ( strFileURL,strEnv )
Footer(strEnv)
ts.close()
Set objIE = CreateObject("InternetExplorer.Application")
objIE.visible = True
objIE.Navigate strFileURL
wait(5)

Set objIE=nothing
End Function



Function to Clear Cookies()

Function ClearCookies()
SystemUtil.Run "iexplore.exe"
WebUtil.DeleteCookies
Set objBrowser=Description.Create
objBrowser("micclass").value="Browser"
Set objBCount = Desktop.ChildObjects(objBrowser)
intBrowserCount = objBCount.Count
strHwnd=Browser("creationtime:=" & intBrowserCount).GetROProperty("hwnd")
SystemUtil.CloseProcessByHwnd(strHwnd)
End Function





Function to send Email



Function SendMail()

If k=0 Then
'Nothing
Else
msgsub = " Geo_PostalCode pattern searchTest Results:" &vbcrLf &"One or more of the Test Cases Failed." &vbcrLf &"See attachment for details."
End If
Set objConf = CreateObject("CDO.Configuration")
cdoSendUsingPort=2
sMailServerName="smtp.phx.move.com"
cdoAnonymous=cdoNONE
objConf.fields.item("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPort
objConf.fields.item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = sMailServerName
objConf.fields.item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoAnonymous 'cdoBasic
objConf.fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False
objConf.fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
'objConf.fields.item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "corp\ NRaoJ "
'objConf.fields.item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "123K!r45"
objConf.fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
objConf.fields.Update
Set objMsg = CreateObject("CDO.Message")
objMsg.Configuration = objConf

objMsg.to = "gcreddy@gmail.com"
objMsg.From = "gcreddy@gmail.com"
objMsg.Subject = "~Geo_PostalCode pattern search"
objMsg.TextBody =msgsub
doc=strFilepath
objMsg.AddAttachment(doc)
objMsg.Send
Set objMsg = Nothing
NewMail = True
End Function



Function to create append excel

Function LogFile

Set objExcel=CreateObject("Excel.Application")
objExcel.visible=False
objExcel.workbooks.open(strFilePath)
r=1
Do Until len(objExcel.cells(r,1))=0
r=r+1
Loop

objExcel.cells(r,1).value="Step Name"
objExcel.cells(r,2).value="Step Description"
objExcel.cells(r,3).value="Test Results"
objExcel.DisplayAlerts = False
objExcel.Save
objExcel.Quit
Set objExcel = Nothing
End Function




Function to get the Application Environment on which the script is running

Function GetEnv()

Set fso=Createobject("Scripting.FileSystemObject")
sFile="C:\WINDOWS\system32\drivers\etc\hosts"
Set MyFile=fso.OpenTextFile(sFile,1, True)
Do
sEnv=MyFile.ReadLine
If instr(sEnv,"PRODUCTION")>0 Then
GetEnv="Production"
Exit do
Elseif instr(sEnv,"Staging")>0 Then
GetEnv="Staging"
Exit do
Elseif instr(sEnv,"QA MAINTENANCE")>0 Then
GetEnv="QAM"
Exit do
Elseif instr(sEnv,"qap.")>0 Then
GetEnv="qap"
Exit do
End If
Loop While MyFile.AtEndOfStream=False
End Function


Function To Create HTML Report

Dim StartTime,stTime, enTime

Dim fso, ts,intCnt, intPass,intFail
intPass=0
intFail=0
Const ForWriting = 2
Function OpenFile (strFileName)
StartTime = Timer
stTime = Time
Set fso = CreateObject("Scripting.FileSystemObject")
Set ts = fso.OpenTextFile(strFileName,2)
'OpenFile = strFileURL
CreateHeader
End Function