Wednesday, August 22, 2012

Throughput and response time

"Throughput vs Responsiveness" is best described in following article.
http://www.markj.net/throughput-and-response-time/

I am coping the same to here if in case the above site is not accessible..


What does ‘performance’ mean? Software performance is mostly about how fast the software goes and how much work it can handle. To discuss performance we need more accurate terms than ‘speed’. The two most important concepts are:
  • Response time – how quickly the system responds to request
  • Throughput – how much work can it do in some period of time
Response time is a measure of how quickly the system responds to a request for it to do something. Put another way, response time is how long it takes before it finishes what you told it to do. Response time is really important for any software that has real people sitting there interacting with it, eg a web application like Ebay. Users want the next page to come back quickly when they click on stuff. Response time for interactive software is often measured in seconds.
Throughput is a measure of how much work the system can do in a given period of time – eg if in one minute my mp3 software can encode 6 songs from a CD, then its throughput is 6 songs per minute. Throughput is really important to software that has to process a lot of data in some way, eg the electric company generating all the electricity bills for its millions of customers. Throughput is also critical for interactive software that has many users, eg how many web pages can Ebay serve up every second.
Response time and throughput are usually not independent of each other. If you are developing software you often have to trade one for the other in your architecture choices. Often times you can make a choice that will increase throughput by a large %, but it makes your response times increase a little (typically when you use request queues in your system). In that case, should you say that the software is faster because it does more work, or slower because it doesn’t react as fast? Both are true, so when you talk about performance it is confusing to talk about ‘speed’, you have to talk about response time and/or throughput.
Another side of throughput vs response time is who cares. If you are using ebay.com to buy a stuffed cat, you don’t care how many millions of pages ebay severed up while you were on the site (throughput), you only care about how fast your pages came back (response time). On the other hand, ebay management really care if their system can generate 1,000 or 10,000 page views a second (throughput), because they have tons of stuff they want everyone to keep everyone bidding on and they want to use the fewest servers possible to keep costs under control.

Wednesday, July 11, 2012

Drop Database Script: For Reference

EXEC msdb.dbo.sp_delete_database_backuphistory @database_name = N'DBName' GO USE [master] GO ALTER DATABASE [DBName] SET SINGLE_USER WITH ROLLBACK IMMEDIATE GO USE [master] GO DROP DATABASE [DBName] GO

Monday, July 2, 2012

Alphanumeric Algorithm

Please check the following url that describes best about Alphanumeric algorithm. The best part of this article is, author Dave Koelle has created this algorithm in various languages.


http://www.davekoelle.com/alphanum.html

For the future reference i have copied the c# code to my site. 
/*
 * The Alphanum Algorithm is an improved sorting algorithm for strings
 * containing numbers.  Instead of sorting numbers in ASCII order like
 * a standard sort, this algorithm sorts numbers in numeric order.
 *
 * The Alphanum Algorithm is discussed at http://www.DaveKoelle.com
 *
 * Based on the Java implementation of Dave Koelle's Alphanum algorithm.
 * Contributed by Jonathan Ruckwood 
 * 
 * Adapted by Dominik Hurnaus  to 
 *   - correctly sort words where one word starts with another word
 *   - have slightly better performance
 * 
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 *
 */
using System;
using System.Collections;
using System.Text;

/* 
 * Please compare against the latest Java version at http://www.DaveKoelle.com
 * to see the most recent modifications 
 */
namespace AlphanumComparator
{
    public class AlphanumComparator : IComparer
    {
        private enum ChunkType {Alphanumeric, Numeric};
        private bool InChunk(char ch, char otherCh)
        {
            ChunkType type = ChunkType.Alphanumeric;

            if (char.IsDigit(otherCh))
            {
                type = ChunkType.Numeric;
            }

            if ((type == ChunkType.Alphanumeric && char.IsDigit(ch))
                || (type == ChunkType.Numeric && !char.IsDigit(ch)))
            {
                return false;
            }

            return true;
        }

        public int Compare(object x, object y)
        {
            String s1 = x as string;
            String s2 = y as string;
            if (s1 == null || s2 == null)
            {
                return 0;
            }

            int thisMarker = 0, thisNumericChunk = 0;
            int thatMarker = 0, thatNumericChunk = 0;

            while ((thisMarker < s1.Length) || (thatMarker < s2.Length))
            {
                if (thisMarker >= s1.Length)
                {
                    return -1;
                }
                else if (thatMarker >= s2.Length)
                {
                    return 1;
                }
                char thisCh = s1[thisMarker];
                char thatCh = s2[thatMarker];

                StringBuilder thisChunk = new StringBuilder();
                StringBuilder thatChunk = new StringBuilder();

                while ((thisMarker < s1.Length) && (thisChunk.Length==0 ||InChunk(thisCh, thisChunk[0])))
                {
                    thisChunk.Append(thisCh);
                    thisMarker++;

                    if (thisMarker < s1.Length)
                    {
                        thisCh = s1[thisMarker];
                    }
                }

                while ((thatMarker < s2.Length) && (thatChunk.Length==0 ||InChunk(thatCh, thatChunk[0])))
                {
                    thatChunk.Append(thatCh);
                    thatMarker++;

                    if (thatMarker < s2.Length)
                    {
                        thatCh = s2[thatMarker];
                    }
                }

                int result = 0;
                // If both chunks contain numeric characters, sort them numerically
                if (char.IsDigit(thisChunk[0]) && char.IsDigit(thatChunk[0]))
                {
                    thisNumericChunk = Convert.ToInt32(thisChunk.ToString());
                    thatNumericChunk = Convert.ToInt32(thatChunk.ToString());

                    if (thisNumericChunk < thatNumericChunk)
                    {
                        result = -1;
                    }

                    if (thisNumericChunk > thatNumericChunk)
                    {
                        result = 1;
                    }
                }
                else
                {
                    result = thisChunk.ToString().CompareTo(thatChunk.ToString());
                }

                if (result != 0)
                {
                    return result;
                }
            }

            return 0;
        }
    }
}

Thursday, October 20, 2011

Enbale FileStream in Sql Server 2008 from Sql Server Management Studio

Use following command to enable filestream in Sql Server.

Use Master
Go
/*0 = FILESTREAM disabled
1 = FILESTREAM for TSQL enabled
2 = FILESTREAM for TSQL and WIN32 streaming enabled*/
EXEC sp_configure 'filestream access level', 2
Go
RECONFIGURE
Go

Monday, August 29, 2011

Resolved Creating Database Diagram In Sql Server 2008 Express

While creating database diagram in Sql Server 2008, we may get the following error.

Database diagram support objects cannot be installed because this database does not have a valid owner. To continue, first use the Files page of the Database Properties dialog box or the ALTER AUTHORIZATION statement to set the database owner to a valid login, then add the database diagram support objects.

We need to following steps to resolve this issue.

In SQL Server Management Studio do the following:

1. Right Click on your database, go to properties
2. Goto the Options Page
3. In the Dropdown at right labeled "Compatibility Level" choose "SQL Server 2005(90)"
4. Goto the Files Page
5. Enter "sa" in the owner textbox.
6. press OK

Steps 2 and 3 are optional. With out these steps also I was able to create DB diagram in Sql Server 2008.

Saturday, June 25, 2011

A stupid bug in IE, that killed our 10 hours.

A stupid bug in IE that killed our 10hours. I told our, that is 5 developers each 2 hours we spent to resolve a issue.

A stylesheet class, because of which IE 8, was automatically redirecting to compatibility mode.

The class is


#BKWords { margin-top: 8px; max-height: 75px; overflow:scroll; }

Above css will not work in IE 8 and will redirect/reload to compatibility mode.

This is an issue in IE8. If you give the style as max-height and overflow scroll, IE8 will redirect automatically to compatibility view. For this we have to give overflow as auto.

Reference:
http://stackoverflow.com/questions/7707/ie8-overflowauto-with-max-height