DCSIMG

 Subscribe in a reader

July 2007 - Posts - Guy kolbis

July 2007 - Posts

Are you tired of those events where instead of actually talking about technologies and such, they end up brain washing you with advertisements and marketing?

I am!!!

The "Performance day" ended up to be a marketing day where Sela group, RadView and etc, complemented each other and their ego. This is surely not what and why I came for.

I was deeply disappointed. I think that this is a kind of manipulation that is spreading, so for future cases I would love to insure that non marking events will take a true technical form and minimum marketing.

I am looking for suggestions on how would you fight this issue and insure we will get what we came for. What would you do?

What are Connection pools should be by now a common knowledge. If by any case you still need a definition, read the following lines, otherwise jump to the next paragraph. Opening a database connection is a resource intensive and time consuming operation. Connection pooling increases the performance of Web applications by reusing active database connections instead of creating a new connection with every request. Connection pool manager maintains a pool of open database connections. When a new connection requests come in, the pool manager checks if the pool contains any unused connections and returns one if available. If all connections currently in the pool are busy and the maximum pool size has not been reached, the new connection is created and added to the pool. When the pool reaches its maximum size all new connection requests are being queued up until a connection in the pool becomes available or the connection attempt times out.

So, connection pools in ADO.NET is created per connection string. So far so good, but lets say that you have two applications that uses the same connection string to the same provider (e.g. MSSQL). What is going on then? Will the two application share the same connection pool?

The answer to this is NO!

According to Microsoft:

Connections are pooled per process, per application domain, per connection string and when using integrated security, per Windows identity.”…

This is surely bad news, because I wished that I could share the pool between two applications per provider and by doing so utilize my connection resources in a better way. Now I will have to implement a service layer that will behave the way I wished it would to begin with :(

Radview has organized a Performance day and to be absolutely honest I think that this is going to be a marketing kind of event. 

So, how is it so far? you got lots of Radview people running around trying to  talk to everyone about their tools and how good they are and etc. There are nice food standings, however this early in the morning it is hard for me to put something in my mouth. Surprisingly (or not), everyone else is eating (well it is free and we are from Israel :) ). We have good music and atmosphere. Soon enough we will enter the conference room. Ohhh, did I mentioned that they said that we will be on time? well it is way past 8:00 and we still waiting.

Generally, there is not much bad things I can say so far rather to note that I hope that technically the level will be high at least as the organization and the atmosphere.  

I feel bad, due to the fact that several testing companies and educational companies such as TestPro, QualiTest, John Bryce and etc. All those companies offer courses for general testing and performance testing issues using several products. The one product that I feel dearly about was not on that list. This is the Microsoft VS for Testers. This could have been a good promotion to that product. So, why do I feel bad? Being one of the expert in Israel to MS VS Tester product, I could have contribute to promote it and extend the market and the acknowledgement to the product in Israel testing community and companies. Just like any of those companies I mentioned earlier, I could represent MS product.

Later on I will let you all know how it went and what are my impressions.

The first step for each performance test is to decide on the accepted results. Lets say that for your web application you found out that there are 100 concurrent users at normal time and an accepted response time for the home page is 2 seconds.

Now, you must insure that your web application stands in the expectations in term of performances (e.g. under load, the home page response time should be under 2 seconds). To do so you will create and run a load test and analyze the results. Next you will verify that the results corresponds your expectations. If it doesn't, you will have to go through the tuning stage where you will try to tune up your application and improve its performance to stand in your expectations.

You can tune the application on several levels:

  • The application level by improving the code.
  • The database level by tuning the related queries, indexes and so forth.
  • The system level by scaling out the CPU and so forth.
  • The network level by increasing the bandwidth and so forth.

The cycle:

  1. Execute a load test.
  2. Measure the performance.
  3. Tune the application.

is repeated until the application under test achieves the expected levels of performance.

When you reach the expected results, you have a baseline for how the application behaves under normal conditions. This baseline can then be used in regression tests to gauge how well a new version of the application performs.

kolbis כתב בתאריך Sunday, July 22, 2007 5:51 PM
תגים:

Let me explain what I mean. The problem arose when I developed a web based application. I needed to choose whether I will use a web site or a web application. After doing a little reading, I selected to go with the web site because of the new dynamic compilation and etc. Soon enough my application grew and my web site had about 100 pages, my App_Code folder had about 50 classes and my images folder weighed somewhere around 25 MB.

The thing that I noticed during the application development stages is that each week the compilation process is taking longer and longer. At the beginning it only took couple of seconds and now for each compilation I am taking five long minutes and go drinking coffee. This has become a regular scenario and a solution had to be found.

After investigating I found out that the thing is, that this is actually a known issue. Compilation can take quite some time to complete when choosing a web site application. So how can we improve it? I gathered some strategies that can improve performance for the compilation in a web site application.

1. Try to avoid adding code to the App_Code folder and instead use an external assembly that will hold the code.

2. Remove all unneeded assemblies, references and images.

3. Remove batch build if exists.

4. Use an "on demand compilation".

5. Hide all static folders in the project.

Once I implemented all of the above, my coffee breaks gotten shorter smile_teeth

Exception handling is not an exact science, however there are some guidelines that one should follow. I have constructed a list of rules that in my opinion is common to all applications in terms of exception handling.

  1. As a rule, all exceptions in the application must be handled at the business layer level.
  2. Custom exceptions will be created to handle any application exceptions.
  3. Exceptions that may require special handling, a handler should be created.
  4. When Exception is handled an ID should be generated for that exception.
  5. Exceptions that may surface to the presentation layer must be user friendly and should not contain information about the inner exception; however the exception ID should be displayed to the user so that the support team can locate the specific exception and review it faster and easier.
  6. Never do a 'catch exception and do nothing'. If you hide an exception, you will never know if the exception happened or not. Lot of developers uses this handy method to ignore non significant errors.
  7. You should always try to avoid exceptions by checking all the error conditions programmatically. In any case, catching an exception and doing nothing is not allowed. In the worst case, you should log the exception and proceed.
  8. In case of exceptions, give a friendly message to the user, but log the actual error with all possible details about the error, including the time it occurred, method and class name etc.
  9. Always catch only the specific exception, not generic exception.

So, based on those rules, we can expand and think about other related exception handling.

In one of my previous posts I  introduced Radview.

Radview, company that develops testing tools, is gathering an event that will include Performance Driven Development (e.g. PDD) and Load Testing Web 2.0 and SOA.

It is free and everyone can register to the event however the number of seats is limit.

It is just like a grocery shop...everything yo want (well almost everything) you can find there, from ASP.NET to Team System.

You can view or download all videos here.

Great job!

You can use unit tests in Visual C# and Visual Basic, but can you use it in C++?

The answer is YES!

When You are thinking about the ways it is possible to use Visual C++ with unit tests, there are three options that very according to the role that Visual C++ plays in your solution. Here are the possible cases:

  1. You are using unit tests to test code that is written in Visual C++.
  2. Your test project contains unit tests that are written in Visual C++.
  3. You plan to automatically generate unit tests from code that is written in Visual C++.

Let us delve into those options.

Code that is written in Visual C++

This is the case where your production code is written in Visual C++. In that case you may have managed code, unmanaged code or both(mixed).

  • Managed. If your production code is safe or pure, any callable assembly method can be called and tested, in an executable file or in a DLL.

  • Unmanaged. If your production code is unmanaged, it needs to be callable from a static library, an .obj file, or a DLL entry point. Class methods that are embedded inside an executable file or a DLL will not work because unmanaged Visual C++ does not offer the runtime discovery mechanism, reflection. Therefore, only the traditional native binding mechanisms will work.

  • Mixed. A mixed project is a project that uses the /clr compiler option. If your production code is mixed, and not an executable file, any callable method in your code can be called and tested.

Unit Tests is written in Visual C++

Your test project has different capabilities depending on the compiler options you have set for the project. The following sections describe the capabilities available for various compiler option settings.

  • Unmanaged.You cannot use unmanaged, or native, Visual C++ as the programming language for a test project.
  • Mixed. A mixed project is a project that uses the /clr compiler option. This kind of a test project provides the ability to test the following production code:
    • Static native libraries
    • Native DLL entry points
    • Standalone .obj files
    • Mixed-mode DLL assemblies with methods that are callable. This does not include executable files because they contain unmanaged code, and unmanaged executable code is generally not re-base address enabled.
    • Any managed method that is callable. This is code that is compiled with the /clr:pure or /clr:safe compiler option.
  • Managed. If you are using either the /clr:pure or the /clr:safe compiler option with your test project, it provides the ability to test any managed method that is callable. This means production code that is compiled with the /clr, /clr:pure, or /clr:safe compiler option.

Generate Unit Tests from a code that was written in Visual C++

You can generate unit tests into a Visual C++ test project. You can generate these tests from a Visual C++ production code project.

  • Production code project. If your production code is written in Visual C++, you can generate unit tests only if your product uses the /clr:safe compiler option. 

  • Test project. Code generation can produce unit tests in any of the Visual C++ test project types: mixed, safe, and pure. The default project type produced is a /clr:safe project.

Last week Microsoft and NESS organized a three days extreme learning. I was one of the lecturers and I talked about Unit testing, TDD, Load testing, Performance testing, Web testing in VSTS for Developers and Testers.

For all of you who missed it or just want to take a look at it, you can download it from here.

If you have any feedback about the lectures, let me know :-)