Software architecture - Tips
Testing techniques
Unit testing: Black-box and white-box testing
Black box: Don't actually know what is happening inside the box instead of the user requirement.
White box testing: Test internal functions of the system - Require programming skills
Load testing: Use load testing to verify application behaviour under normal and peak load
conditions. This allows you to capture metrics and verify that your application can meet its
performance objectives.
Stress testing: Use stress testing to evaluate your application's behaviour when it is pushed beyond
its breaking point and to unearth application bugs that surface only under high load conditions.
DotNetNuke
Performance and Scalability
"Your application design must also take into account QoS attributes such as security and
maintainability. Sometimes you must make design tradeoffs because of protocol restrictions,
and network topologies." (J. D. Meier et. al., 2004, P.18)
Use a layered design that includes presentation, business and data access logic. Define the
requirements, such as remote calls, web services, database access, distributed components
and etc,.
Try to reduce round trips and amount of traffic that you send over the network.
Use tried and tested design principles (J. D. Merier et. al., 2004, P.19)
"Xml is verbose and can require considerable parsing effort. Applications that use XML may
pass large amounts of data over the network. Use a DataReader object to render data as
quickly as possible, but do not pass DataReader objects between layers because they require
an open connection." (J. D. Merier et. al., 2004, P.19)
The "DataSet" option provides great flexibility; you can use it to cache data across requests.
DataSet objects are expensive to create and serialize. (J. D. Merier et. al., 2004, P.19)
Enhance your ASP.NET web services with Web Services Enhancements (WSE) if you need the
WSE feature set and if you can accept the support policy.
Use object technology, such as ENterprise Services or .NET remoting, within the
implementation of a service.
Use Enterprise Services inside your service boundaries when the following conditions are
true:
o You need the Enterprise Services feature set. This feature set includes object
pooling, declarative transactions, distributed transactions, role-based security, and
queued components.
o You are communicating between components on a local server, and you have
performance issues with ASP.ENT web service or WSE
Use .NET remoting inside your service boundaries when the following conditions are true:
o You need in-process, crosee-application domain communicatino. Remoting has been
optimized to pass calls between application domains extrememly efficiently.
Page 1
Software architecture - Tips
o You need to support custom wire protocols. understand, however that this
customization will not port cleanly to future Microsoft Implementatinos.
When you work with ASP.NET web service, Enterprise Services, or .NET remoting, you should
consider the following caveats:
o If you use ASP.NET web service, avoid using low-level extensibility features such as
the HTTP Context object. If you do use the HttpContext object, abstract your access
to it.
o If you use .NET remoting, avoid or abstract using low-level extensibility such as .NET
remoting sinks and custom channels.
o if you use Enterprise Services, avoid passing object references inside Enterprise
Services. Also do not use COM+ APIs. Instead, use types from the
System.EnterpriseServices namespace.
Instead of making a remote call to fetch individual data items, you fetch a data object by
value in a single remote call. You then operate locally against the locally cached data.
The server GC is optimized for throughput, memory consumption and multiprocessor
scalability. ASP.NET automatically loads the server GC. If you do not use ASP.NET, you have
to load the server GC programmatically.
Improving Data Access Performance
How to improve data access performance
How to page records
How to serialize DataSets efficiency
How to manipulate BLOBs
o Avoid moving binary large object (BLOB) data repeatedly, and consider storing
pointers in the database to BLOB files that are maintained on the file system. Use
chunking to reduce the load on the server,a nd use chunking particularly where
network bandwidth is limited.
If you use stored procedure, follow these guidelines:
o Try to avoid recompiles
o Use the parameters collection to help prevent SQL injection.
o Avoid building dynamic SQL within the stored procedure.
o Avoid mixing business logic in your stored procedures.
If you use dynamic SQL, follow these guidelines:
o Use the Parmeters collection to help prevent SQL injection.
o Batch statements if possible
o Consider maintainability. For example, you have to decide if it is easier for you to
update resource files or to update complied statements in code.
Improving ASP.NET Performance
How to build efficient web pages
How to tune the ASP.NET thread pool
How to handle long-running calls
How to cache data
How to call STA components from ASP.NET
Page 2
Software architecture - Tips
How to handle session state
Improving web services performance
How to improve web service performance
How to handle large data transfer
How to handle attachments
Testing solution
How to measure performance
How to test performance
How to turn performance
o you tune to eliminate bottlenecks and improve performance. You can tune
application, platform, system and network configurations setting. Use an iterative
and repeatable process. Start by establishing a baseline, and ensure you have a well-
defined set of performance objectives, test plans and baseline metrics.
Performance Objectives
Response time: This is the time it takes your system to complete a particular operations,
such as user transaction
Throughput: This is the amount of work your system can support. Throughput can be
measured in terms of requests per second, transactions per second, or bytes per second
Resource utilization: This is the percentage of system resources that are used by particular
operations and how long they are used. This is the cost of server and network resources,
including CPU, memory, disk U/O and network I/O.
Workload: This is usually derived from marketing data and includes total numbers of users,
concurrently active users, data volumes, transaction volumes, and transaction mix.
QoS
Business requirements -> QoS -> Performance Objectitves
Performance and Scalability Frame
Category Key consideration
Coupling and Cohesion Loose coupling, high cohesion among
components and layers
Communication Transport mechanism, boundaries, remote
interface design, round trips, serialization,
bandwidth
Concurrency Transactions, locks, threading, queuing
Resource management Allocating, creating, destroying, pooling
Caching Per user, application-wide, data volatility
State Management Per user, application-wide, persistence, location
Data Structures and Algorithms Choice of algorithm arrays vs. collections
Page 3
Software architecture - Tips
Performance Modelling
1. Identify key scenarios
2. Identify workloads - Identify how many users, and how many concurrent users your system
needs to support
3. Identify performance objectives
4. Identify Budget
5. Identify Processing Steps
6. Allocate Budget
7. Evaluate
8. validate
Several Questions for designing a system
How to conduct performance reviews of managed code
How to design efficient types
How to manage memory efficiently
How to use multithreading in .NET applications
How to use asynchronous calls
How to clean up resources
How to avoid unnecessary boxing
How to handle exceptions (P.24)
How to work with strings efficiently
How to choose between arrays and collections
How to improve serialization performance
How to improve code access security performance
How to reduce working set size
How to develop SMP friendly code
How to time managed code in nanoseconds
How to decide when to use the Native Image Generator (Ngen.exe)
Start to measure performance as soon as you have a defined set of performance objectives
for your application. (Use tools such as System monitor, network monitoring tools such as
Netmon, profiling tools such as CLR Profiler, SQL Profiler, SQL Query Analyzer and
application instrumentation to collect metrics for measuring.
Identify a stress test tool, such as Microsoft Application Center Test (ACT)
My Skills:
Able to design system using OO or SO concepts
Both software and hardware have performance issues. In hardware - Embedded system,
require to think of memory allocations, such as reuse data in a memory space. In computing,
software programming, network bandwidth restrictions, client-side processing, data
volumes, sorting data and etc are the issues that need to be addressed and defined.
Developed a load testing application to test a back office system. By measuring the time for
processing the data the application created with the machines specification. We actually
Page 4
Software architecture - Tips
comes up with a performance appraisals for the back office system and the data was used in
customer site for demonstration of speed of data processing by the back office system
Reasons for resigned the repair job
Background: I was appointed to setup the repair centre at Parkeon as I had the skills in repairing all
company's product and I have background in system design. I setup a very basic system in the repair
centre to log repair histories, book-in and out date and time, cost centre code, time allocation, cost
to parts and products locations and setup the repair centre with lean manufacturing technique.
The attributes defined provides all details of machines and most importantly in the future, the
repair centre can analysis the repair histories and provide a statics of common faults to products,
therefore this could potentially lower down all cost for repair by employing lower labours in the
future.
The repair centre has very complex business models. The ideal model to be employed is purely B2C
model, which all employees working in the repair centre are not working in the repair centre, they
are there to provide "SERVICES" to different project managers. By providing all the services to them,
it generates revenue.
However there are many other communicate issues other departments, such as production and
stores.
Reasons for leaving, I would like to work there longer, however I would love to spend my time
developing and analysis something rather than deal with repairs as I believe I became one of the guy
know the best of all products and this becomes just a job with no challenges.
Finally, I would love to find a career path that I can enjoy more and have constant challenges.
Performance affects different roles in different ways
As an architect, you need to balance performacne and scalability with other QoS attributes
such as manageability, interoperability, security, and maintainability
As a develop, you need to know ehere to start, how to proceed, and when you have
optimized your sofwtare enough.
as a tester, you need to validate whether the application supports expected workloads
As an administrator, you need to know when an application no longer meets its service level
agreements, and you nede to be able to create effective growth plans
As an organization, you nede to know how to manage performance throughout the software
life cycle, as well as lower total cost of ownership of the software that your organization
creates
References
Ref [1]: http://business.timesonline.co.uk/tol/business/career_and_jobs/best_100_companies/articl
e3440515.ece
Ref [2]: J.D. Meier, Vasireddy S., Babbar A. and Mackman A, 2004. Improving .NET Application
performance and Scalability. USA: Microsoft Corporation (ISBN: 0-7356-1851-8)
Page 5
Software architecture - Tips
Page 6