2

I have a ASP.Net 3.5 web application. Both the website and SQL-Server are hosted on the same server.

The whole system is based on Numbers/Data, users need to import massive data to the system (e.g. using excel spreadsheet), the system needs to show the calculated figures on screen as well as generate reports for users.

Currently, there is an Import Server app running on this server, inserting/updating the data to raw data tables, then calculated the data and insert/update it to an post-processed table. All these processes are involved in one thread (could be in one Stored Procedure).

The drawback of this design is: the import app costs a lot of system resource and take a long time to run. It locked the table (e.g. TRANSACTION) and affected user's action on the website. Moreover, the calculated data are hard to be tracked and easy to be miscalculated.

I've tried to create a temp table (View) in the system to process the data on demand instead of post-processing it into calculated table. But I found the process time (View and SQL Stored Procedure execution time) is too long to be accepted (5 minutes or more, some query e.g. join...between or apportion annual data to daily takes the most processing time).

Hope some experienced guys could give me some advices (or general strategies) on how to improve the design/implementation for the system in all aspects, thanks.

All aspect includes: Multi-Servers, DBMS, Server Apps, Web Service, SQL Server Optimization, SQL Components, the whole system design and architecture etc.

4

3 に答える 3

1

したがって、質問を正しく読んだ場合、以前は次のように表示されていました。

  • 生データのインポート + 後処理を備えたシステム。2組のテーブル。
  • 生データの後処理には時間がかかり、Web アプリケーションがデータを読み取る後処理テーブルにロックが発生するため、Web アプリケーションのパフォーマンスが低下します。

このため、次のようなセットアップを試しています。

  • 生データは 1 セットのテーブルにインポートされます。
  • 後処理して処理済みデータを保存する代わりに、ビューで「オンデマンド」で後処理を行っています。
  • これも満足のいく性能を発揮していません

元のセットアップの代替バージョンを試してみませんか? 次のような解決策を試すことができます。

  • テーブルを3セット作る
  • 生データのインポート用に 1 セット
  • 生データの後処理の結果を格納するための 1 つのセット
  • そして、処理されたデータのコピーを保存するための 1 つのセット。

この最後のテーブル セットは、レポートの生成に使用されます。このセットアップを使用すると、「データのインポート」は次の 3 つのステップで構成されます。

  • 生データのインポート
  • 後処理
  • 処理されたデータを「ライブ」テーブルに更新します。

おそらく、処理されたデータを 1 つのテーブル セットから別のテーブル セットにコピーすると、かなりのパフォーマンスが得られる可能性があります。したがって、後処理が「ライブ」テーブルに直接触れないため、Web アプリケーションに対するデータ インポートの影響を制御できます。

于 2012-07-12T20:53:42.850 に答える
0

結合に時間がかかっているようですが、外部キーが配置されていることを確認できますか。また、SQL を見せていただければ、お役に立てるかもしれません。

于 2012-07-06T14:46:23.070 に答える
0

次の方法を試すことができます

まず、データを生データ テーブルに直接インポートします。

次に、ストアド プロシージャではなくコード ビハインドで計算を行います。コード ビハインドでこれを行うと、データベース リソースが節約されます。

計算が完了したら、計算された値を計算テーブルに挿入します。

可能な限りデータベースの代わりにコード ビハインドを使用するようにしてください。コード ビハインドで何かを実行できない場合にのみデータベースを使用してください。

于 2012-07-06T13:32:59.020 に答える