Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Finding performance bottlenecks in a classic asp/sql server website

I've got an old classic asp/sql server app which is constantly throwing 500 errors/timeouts even though the load is not massive. Some of the DB queries are pretty intensive but nothing that should be causing it to fall over.

Are there any good pieces of software I can install on my server which will show up precisely where the bottlenecks are in either the asp or the DB?

like image 906
Colm Troy Avatar asked Dec 13 '25 22:12

Colm Troy


2 Answers

Some tools you can try:

  • HP (formerly Mercury) LoadRunner or Performance Center
  • Visual Studio Application Center Test (Enterprise Editions only?)
  • Microsoft Web Application Stress tool (aka WAS, aka "Homer"; predecessor to Application Center Test)
  • WebLoad
  • MS Visual Studio Analyzer if you want to trace through the application code. This can show you how long the app waits on DB calls, and what the SQL was that was used. You can then use the SQL profiler to tune the queries.
like image 94
Patrick Cuff Avatar answered Dec 16 '25 03:12

Patrick Cuff


Where is the timeout occurring? Is it at lines when ASP is connecting/executing sql? If so your problem is either with the connection to the db server or at the db itself. Load up SQL profiler in MSSQL to see how long the queries take. Perhaps it is due to locks in the database.

Do you use transactions? If so make sure they do not lock your database for a long time. Make sure you use transactions in ADO and not on the entire ASP page. You can also ignore lock in SQL Selects by using WITH (NOLOCK) hint on tables.

Make sure you database is optimized with indexes.

Also make sure you are conencted to the DB for as shortest time as possible i.e (example not working code): conn.open; set rs = conn.execute(); rs.close; conn.close. So store recordsets in a variable instead of looping through while holding the connection to the DB open. A good way is to use GetRows() function in ADO.

Always explicitly close and set ADO objects to nothing. This can cause the connection to the DB to remain open.

Enable connection pooling.

Load ADO constants in global.asa if you are using them

Do not store any objects in session or application scopes.

Upgrade to latest versions of ADO, MDac, SQL Server service packs etc.

Are you sure the server can handle the load? Maybe upgrade it? Is it on shared hosting? Maybe your app is not the problem.

It is quite simple to measure a script performance by timing it from the 1 line to the last line. This way you can identify slow running pages.

like image 26
Espen Avatar answered Dec 16 '25 01:12

Espen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!