Performancing Metrics

Vamsi Tokala's blog

Friday, May 2, 2014

FTP Performance testing


The below  C# code was developed to place  EDI X12(HIPPA) files directly into the FTP folder for batch testing.
 
  The below script will also help

·         To  Test FTP server by placing larger number of files into FTP server as expected in production

·         To minimize the randomness in the testing process and ensures repeatability



using System;

using Microsoft.VisualStudio.TestTools.UnitTesting;

using System.Net;

using System.Text;

using System.Drawing;

using System.IO;

using System.Threading;

using System.Threading.Tasks;

using System.Collections.Generic;

 

 

namespace FTPScript

{

    [TestClass]

    public  class UnitTest1

    {

      

        [TestMethod]

        public void main()

        {

 

            string sDir="C:\\270";// Directory containing Test data files

            List<FileInfo> files = new List<FileInfo>();

            try {

                           foreach (string f in Directory.GetFiles(sDir)) {

                                  files.Add(new FileInfo(f));

                           }

            }

            catch (System.Exception excpt)

            {

                throw excpt; 

            }

           /* List files = new List();

            files.Add(new FileInfo("C:\\270\\270.txt"));

            files.Add(new FileInfo("C:\\270\\270_DOB.DAT"));*/

 

                   

            Parallel.ForEach(files, objFile =>

                                                                      {

                                                                          UploadFile(objFile);

                                                                      });

 

        }

 

        static bool UploadFile(FileInfo fileInfo)

            {

                FtpWebRequest request = null;

                try

                {

                    string ftpPath = ftp://XXX.XX.XX.XX/CC + fileInfo.Name;

                    request = (FtpWebRequest)WebRequest.Create(ftpPath);

                    request.Credentials = new NetworkCredential("XXXX\\XXX", "XXXXX");  // username , password

                    request.Method = WebRequestMethods.Ftp.UploadFile;

                    request.KeepAlive = false;

                    request.Timeout = 60000; // 1 minute time out

                    request.ServicePoint.ConnectionLimit = 15; // Connection limit 15 with the ftp., By default 2, -1 means infinite.

 

                    byte[] buffer = new byte[1024];

                    using (FileStream fs = new FileStream(fileInfo.FullName, FileMode.Open))

                    {

                        int dataLength = (int)fs.Length;

                        int bytesRead = 0;

                        int bytesDownloaded = 0;

                        using (Stream requestStream = request.GetRequestStream())

                        {

                            while (bytesRead < dataLength)

                            {

                                bytesDownloaded = fs.Read(buffer, 0, buffer.Length);

                                bytesRead = bytesRead + bytesDownloaded;

                                requestStream.Write(buffer, 0, bytesDownloaded);

                            }

                            requestStream.Close();

                        }

                    }

                    return true;

                }

                catch (Exception ex)

                {

                    throw ex;               

                }

                finally

                {

                    request = null;

                }

                //return false;

            }// UploadFile

    }

}



@2011, copyright Vamsidhar Tokala

Tuesday, June 18, 2013

Synthetic monitoring

I have recently published a document on synthetic monitoring. Abstract is given below

Abstract:

Many large organizations have started implementing web content management (WCM) platform to maximize their online presence and improve operational efficiency across web based initiatives.  These platforms have to support a large number of users accessing the application from multiple countries/regions with optimum performance. Platforms also have to achieve high availability for the published websites and its content management platform.

IT operations team responsible for managing the digital platform  has to ensure the performance and availability requirements are met and take corrective actions if required.   It must have the process which can alert the team with a performance issue as and when it is detected, understand the severity and complexity of the issue and diagnosing the issue with the available information.

Synthetic monitoring can help IT operations for managing and optimizing web application availability, performance of applications from the end-user perspective. This paper highlights the approach used to implement synthetic monitoring for a WCM platform and lessons learned from its implementation.

https://docs.google.com/file/d/0BzOftuUbGkRvOUYxWU1iMmVGMmM/edit?usp=sharing

@2013, copyright Vamsidhar Tokala

Friday, September 14, 2012

Akamai Configuration

I have done my first akamai CDN implimentation  for  CQ5 publish in my project.   I have listed the prerequisites and the configuration I have implimented.


DNS Setup

DNS Domain has to be configured to set-up with Akamai and for the domain to work its need to be registered and mapped to below name servers. This will allow Domain configurations to work

Following URL is configured for Akamai testing:

http://XXX-performance-testing.utils-XXX.com:4503/


Note: There is another workaround i.e. to register a temp domain via http://dnsdynamic.org
We can register a doming e.g. XXX-performance-testing.dnsdynamic.com and map it to IP: XXX.XXX.XXX.XXX

Akamai Configuration


Akamai is configured in the following fashion for optimal performance



ORIGIN SERVER CONFIGURATION

DIGITAL PROPERTIES CONFIGURATION SUMMARY

Default Configuration

(All Digital Properties) Origin: origin-nexus-performance-testing.utils-XXX.com

CP Code: Site Accelarator2 (125924)

Forward HOST header: Digital Property

Cache Key: Origin Server (origin-nexus-performance-testing.utils-XXX.com)

Compression: Yes



CACHE KEY: IGNORE CASE

OPTION VALUE

Ignore case in the cache key: Enabled



LAST MILE ACCELERATION

OPTION VALUE

Apply to content with Content-type: text/html*, application/x-javascript*, text/css*, image/png image/jpeg image/gif

Disable for Old Browsers: Yes



HTTP POST

OPTION VALUE

HTTP POST Requests: Enabled

Allow POST Without Content Length: Disabled



ORIGIN DNS OPTIMIZATION

OPTION VALUE

DNS Refresh: Enabled

DNS Refresh Timeout: 2 hours



TIME TO LIVE RULES

# MATCH CRITERIA ACTION

Default Rule TTL: 1 day

Default Error Response Rule 10 seconds

Default Cache Redirect Response Rule Cache Redirect Responses

1 Host: nexus-performance-testing.utils-XXX.com

File Extension: aif aiff au avi bin bmp cab carb cct cdf class css

dcr doc dtd exe flv gcf gff gif grv hdml hqx ico ini

jpeg jpg js mov mp3 nc pct pdf png ppc pws swa swf

txt vbs w32 wav wbmp wml wmlc wmls wmlsc xsd zip

TTL: 1 day



REPORTING

OPTION VALUE

HTTP Headers to Include in Logs: User-Agent

Cookie Values: - None -



SUREROUTE / TIERED DISTRIBUTION OPTIONS

OPTION VALUE

Tiered Distribution: Enabled

Tiered Distribution Map Name: ch2.akamai.net

SureRoute: On

SureRoute Test Object URI: /akamai/sureroute-test-object.html

Race Statistic TTL: 86400 seconds

Force Test Race Protocol to HTTPS: No



SITE ACCELERATOR

OPTION VALUE

Site Accelerator Enabled



GENERATE REDIRECT RULES

# MATCH CRITERIA GENERATE REDIRECT

1 Path: /index.html (Ignore Case On)

Redirect Name: Redirect_geometrixx

Redirect Option: Relative - Change URI

Response Code: 301 - Permanent Redirect

URL: /content/geometrixx/en.html



BROWSER CACHE CONTROL HEADERS

# MATCH CRITERIA CACHE CONTROL HEADERS

Default Rule Pass through the origin's Cache-Control

headers to the browser.

@2011, copyright Vamsidhar Tokala

Wednesday, March 7, 2012

Performance testing IPAD/Mobile applicatins




Recently customers are requesting for performance testing IPAD/Mobile applications and I came across such a requirement recently. The challenge is to simulate the traffic and the typical approach to capture traffic using tools like LoadRunner may not work in this case due to the reasons below.

·         Tools like LoadRunner can’t be installed in IPAD/smart phones to record the flow and capture the communication.

·         Network capturing tools like Wireshark and Fiddler can’t be installed in IPAD.
The approach is to route the traffic from IPAD to a hub/router and capturing the communication using network monitoring tools like wireshark.

1)      Hub takes packets sent from one port and transmits (repeats) them to every other port on the device. For example, if a computer on port 1 of a 4-port hub needs to send data to a computer on port 2, the hub sends those packets to ports 1, 2, 3, and 4.  When computer sends data, all computers connected to the hub receive it.  Connect a computer to the hub which has Wireshark or fiddler installed to capture the communication.

2)      Second approach is to connect to a router and allow traffic to go through the proxy.
The below link has the approach followed by my team to capture communication using wireless router and fiddler
Finally download the BPC toolkit available in my blog to convert fiddler output to LoadRunner script.
 
Note: HP developed some Mobile apps protocol to test Mobile applications which takes Wireshark network trace as an input to create a script. Purchasing license for this protocol is not required if the above approach is followed

@2011, copyright Vamsidhar Tokala

Wednesday, February 1, 2012

Identifying Memory leaks in .Net using winDBG

Identifying Memory Leaks due to object references in Finalize queue


Load the SOS debugger extension for a CLR 4.0 application

.loadby sos clr

1) Identify the objects in finalizeQueue which survived Garbage collection

!fq

SyncBlocks to be cleaned up: 0

MTA Interfaces to be released: 0

STA Interfaces to be released: 0

----------------------------------

generation 0 has 1 finalizable objects (000000008ba63058->000000008ba63060)

generation 1 has 15 finalizable objects (000000008ba62fe0->000000008ba63058)

generation 2 has 14884 finalizable objects (000000008ba45ec0->000000008ba62fe0)

Ready for finalization 0 objects (000000008ba63060->000000008ba63060)



000007ff01d58610 2 1024 System.Data.DataTable

000007ff0164e298 4 1120 System.Diagnostics.Process

000007ff01d82738 8 1728 System.Data.DataColumn

000007ff017235a0 16 1920 System.Threading.OverlappedData

000007ff001f1780 28 2464 System.Threading.Thread

000007ff006764b8 52 3744 System.Reflection.Emit.DynamicResolver

000007ff0026fba8 66 4224 System.Threading.ReaderWriterLock

000007ff01e7bb00 314 10048 System.Data.SqlClient.SNIPacket

000007ff01e717e0 546 21840 System.Data.SqlClient.SNIHandle

000007ff01e49f30 314 32656 System.Data.SqlClient.SqlConnection

000007ff02933bf0 302 45904 System.Data.SqlClient.SqlDataAdapter

000007ff0166d240 398 70048 System.Diagnostics.PerformanceCounter

000007ff01e0d0e8 1510 338240 System.Data.SqlClient.SqlCommand

000007ff0057d8f8 11209 358688 System.WeakReference



2) You can also print the details of the finalizable objects for Gen2 using the above details

dd 000000008ba45ec0 000000008ba62fe0


3) Identify the suspected object having leaks

!dumpheap -type System.Data.SqlClient.SqlCommand

Address MT Size

0000000010c43f40 000007ff01e0d0e8 224

0000000010c44020 000007ff01e0d0e8 224

0000000010c44198 000007ff01e0d0e8 224

0000000010c44278 000007ff01e0d0e8 224

0000000010c444e8 000007ff01e0d0e8 224


4) Identify the GC roots for the objects. It contains the call stack

!gcroot 0000000010c43f40

Scan Thread 15 OSTHread 1bc0

Scan Thread 16 OSTHread 1d74

Scan Thread 19 OSTHread 3200

Scan Thread 17 OSTHread 21f0

Scan Thread 18 OSTHread 3564

Scan Thread 20 OSTHread 322c

Scan Thread 21 OSTHread 2b80

Scan Thread 28 OSTHread 2e5c

Scan Thread 29 OSTHread 35d0

Scan Thread 30 OSTHread 3bc

Scan Thread 31 OSTHread 2770

Scan Thread 33 OSTHread 19b4

Scan Thread 34 OSTHread 534

Scan Thread 35 OSTHread 3280

Scan Thread 36 OSTHread 1908

Scan Thread 37 OSTHread 344c

Scan Thread 38 OSTHread 13d4

Scan Thread 39 OSTHread 21d4

Scan Thread 40 OSTHread 31a4

DOMAIN(0000000001AB88B0):HANDLE(Pinned):1217c0:Root: 000000002070f040(System.Object[])->

00000000108c9ac0(System.Collections.Hashtable+SyncHashtable)->

00000000108c91e8(System.Collections.Hashtable)->

000000001171efc0(System.Collections.Hashtable+bucket[])->

00000000120a3768(System.Collections.Hashtable)->

00000000120a37c0(System.Collections.Hashtable+bucket[])->

00000000120a3820(System.Collections.Hashtable)->

00000000120fa180(System.Collections.Hashtable+bucket[])->

00000000120b7200(System.Collections.Generic.Dictionary`2[[ATOM.AS.CobolBase.CobolProgramName, ATOM.AS.CobolBase],[ATOM.AS.CobolBase.CobolProgram, ATOM.AS.CobolBase]])->

00000000120b7360(System.Collections.Generic.Dictionary`2+Entry[[ATOM.AS.CobolBase.CobolProgramName, ATOM.AS.CobolBase],[ATOM.AS.CobolBase.CobolProgram, ATOM.AS.CobolBase]][])->

00000000120b7258(ATOM.AS.CobolBase.CobolProgram)->

00000000120b7310(System.Collections.Generic.List`1[[ATOM.AS.CobolBase.IProgramEvents, ATOM.AS.CobolBase]])->

0000000019b0f918(System.Object[])->

0000000019b0f590(ATOM.AS.DataAccess.DataAccess)->

0000000019b13c40(ATOM.AS.DataAccess.ProviderSQL)->

0000000019b13d70(System.Data.SqlClient.SqlCommand)->

0000000019b15978(System.Data.SqlClient.SqlCommand+CachedAsyncState)




@2011, copyright Vamsidhar Tokala

Monday, August 29, 2011

Derive Concurent Users using Little's law

The below real time example will help in deriving the concurrent users using Little's law. In the below example

  • Adjusted Hits, Median Think Time derived from production logs for one hour period.
  • Avg RT/Step  is the Target Response SLA required to met under load
  • No of Steps is no of transactions per business flow
  • Concurrent Users is derived using little's law Throughput* (Avg RT+ Think Time)





 


@2011, copyright Vamsidhar Tokala

Friday, June 17, 2011

Performance Tuning Tips using Oracle Indexes


1)   Consider indexing keys that are used frequently in WHERE clauses and join tables and with high selectivity. The selectivity of an index is the percentage of rows in a table with the same value for the indexed key. 
a.   Good Selectivity
A table having 1000 records and one of its indexed column has 800 distinct values, then the selectivity of this index is 800 / 1000 = 0.8
b.   Bad Selectivity
lf an index on a table of 1000 records had only 5 distinct values, then the index's selectivity is 5 / 1000 = 0.005 and in this case a query which uses the limitation of such an index will return 1000 / 5 = 200 records for each distinct value. Full table scan is better than an indexed scan in this scenario

2)   Oracle database does not create an index for foreign key constraint automatically. If foreign key column often used in join conditions then create an index on them to enhance the join process

3)   Consider indexing foreign keys for referential integrity constraints in cases where large number of concurrent inserts updates and delete statements access the parent and client tables. Indexing foreign key columns helps avoid full table scans when searching for the matching rows in the child table when DML is performed on parent table. Without an index in the child table a table level lock may occur

4)   When choosing to index a key, consider whether the performance gain for queries is worth the performance loss of inserts, updates and deletes and use of space required storing the index.

5)   Deleting a row from a table in the oracle database results in the deletion of the index entry.  Updates to the key columns result in a logical deletion and insertion of index.

6)   It is recommended that after periods of high DML activity, you verify index statistics and reorganize indexes
Select used, monitoring,
From v$object_usage where index_name =name of the index