Solved

How to speed up an ASP/MS SQL web application

Posted on 2016-08-18
6
73 Views
Last Modified: 2016-08-19
I have an ASP with MS SQL 2008 web application.
It runs fine on some installations but for one or two it runs very slow, the settings are identical. This two have more data in the database but nothing that should slow it down.

What kind of things can I do to speed it up ?
Index the DB ?  if so how ?  How would I 'run a trace' and then index based on that ?
Anything else that I could do to make the system faster ?  seems like only pages with connection to the database are slow.
0
Comment
Question by:amucinobluedot
6 Comments
 
LVL 52

Expert Comment

by:Scott Fell, EE MVE
ID: 41761431
Can you post the code you are using?  How many rows in the dB?  In the recordset?

Well indexed dB, good queries and throw your data to an array instead of a recordset are the biggest without seeing what you are doing.
0
 
LVL 39

Assisted Solution

by:lcohan
lcohan earned 500 total points
ID: 41761442
Assuming the data is in the same database on the same server indexing should help indeed to return data faster from SQL however...if the slowness is NOT due SQL returning the record set but delivering/pasting data to client is different story.

In order to do that I would use SQL Profiler but please do NOT run the default trace against production servers as it may cause severe performance issues. You must customize the trace to select only events/columns that you're interested in and filter it by database name for instance to trace only queries hitting the DB(s) that's slow.

Here's what I usually do in profiler - start it from Tools menu in SSMS:
Click the Event Selection tab and un-select the two Audit
Check box "Show all columns" towards right bottom side and Un-check "BinaryData" then Check "DatabaseName", "Error", and "HostName"

Now you can Un-Check box "Show all columns"  and check "Column Filters" button below then add the DatabaseName you want to trace under the filter AND Duration > 1000 (milliseconds so only queries taking more than 1 second will be profiled)
Remember to check box to Exclude rows that contain no value on both filters then hit OK and Run.

IF all queries are fast - duration in max few seconds then I would look outside SQL for issues but if queries show long duration/timeouts(error 2 - Abort) then indexing definitely could help.
0
 
LVL 39

Assisted Solution

by:lcohan
lcohan earned 500 total points
ID: 41761444
Here's a query from SQL BOL to find missing indexes but please don't just add them all without further investigations.


--top 10 missing indexes from BOL
--https://technet.microsoft.com/en-us/library/ms345434(v=sql.110).aspx

use DbNameHere
go


SELECT top 100
  mig.index_group_handle, mid.index_handle,
  CONVERT (decimal (28,1), migs.avg_total_user_cost * migs.avg_user_impact * (migs.user_seeks + migs.user_scans)
  ) AS improvement_measure,
  'CREATE INDEX missing_index_' + CONVERT (varchar, mig.index_group_handle) + '_' + CONVERT (varchar, mid.index_handle)
  + ' ON ' + mid.statement
  + ' (' + ISNULL (mid.equality_columns,'')
    + CASE WHEN mid.equality_columns IS NOT NULL AND mid.inequality_columns IS NOT NULL THEN ',' ELSE '' END
    + ISNULL (mid.inequality_columns, '')
  + ') '
  + ISNULL (' INCLUDE (' + mid.included_columns + ')', ' WITH (FILLFACTOR=80,MAXDOP=1);') AS create_index_statement,
  migs.*, mid.database_id, mid.[object_id]
FROM sys.dm_db_missing_index_groups mig with (nolock)
      INNER JOIN sys.dm_db_missing_index_group_stats migs with (nolock) ON migs.group_handle = mig.index_group_handle
      INNER JOIN sys.dm_db_missing_index_details mid with (nolock) ON mig.index_handle = mid.index_handle
WHERE CONVERT (decimal (28,1), migs.avg_total_user_cost * migs.avg_user_impact * (migs.user_seeks + migs.user_scans)) > 10
      --and mid.statement like '%DBNameHere%'
ORDER BY migs.avg_total_user_cost * migs.avg_user_impact * (migs.user_seeks + migs.user_scans) DESC
0
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
LVL 39

Accepted Solution

by:
lcohan earned 500 total points
ID: 41761452
I also recommend to use SQL Own performance dashboard reports as they will unveil real time issue that can impact performance that you didn't even thought about like locking/blocking, DB file growth, parallelism, etc. I ran them since 2005 to date on all my prod servers with trust and no issues so far.

http://blogs.technet.com/b/rob/archive/2009/02/18/performance-dashboard-reports-for-sql-server-2008.aspx
http://blogs.msdn.com/b/sqlserverfaq/archive/2010/05/27/sql-server-performance-dashboard-reports-in-ssms-introduction-install-datediff-error-amp-modified-for-sql-2008.aspx
http://blogs.msdn.com/b/arvindsh/archive/2010/06/25/performance-dashboard-reports-in-sql-server-2008.aspx
0
 
LVL 48

Expert Comment

by:Vitor Montalvão
ID: 41762140
It runs fine on some installations but for one or two it runs very slow, the settings are identical.
Are those installations in the same network?
0
 

Author Comment

by:amucinobluedot
ID: 41762452
Different networks. I will spread the points. My client's IT will run a trace and index the DB and see if that helps.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Any business that wants to seriously grow needs to keep the needs and desires of an international audience of their websites in mind. Making a website friendly to international users isn’t prohibitively expensive and can provide an incredible return…
An enjoyable and seamless user experience can go a long way on an eCommerce site. While a cohesive layout and engaging copy play roles in creating a positive user experience, some sites neglect aspects that seem marginal but in actuality prove very …
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question