当社は、テキストファイルを解析するための内部プロジェクトを開発しています。これらのテキストファイルは、通常の式を使用して抽出されたメタデータで構成されています。10台のコンピューターが24時間年中無休でテキストファイルを解析し、抽出されたメタデータをハイエンドのIntel Xeon SQLServer2005データベースに供給しています。
簡略化されたデータベーススキーマは次のようになります。
アイテム | Id | 名前| | ---- | -------- | | 1 | サンプル|
Items_Attributes | ItemId | AttributeId | | -------- | ------------- | | 1 | 1 | | 1 | 2 |
属性 | Id | AttributeTypeId | 値| | ---- | ----------------- | ------- | | 1 | 1 | 500mB | | 2 | 2 | 1.0.0 |
AttributeTypes | Id | 名前| | ---- | --------- | | 1 | サイズ| | 2 | バージョン|
内部に異なるメタデータを持つ多くの異なるテキストファイルタイプがあります。すべてのテキストファイルに対して、Item
および抽出されたすべてのメタデータ値に対して、Attribute
.
Items_Attributes
allow us to avoid duplicate Attribute
values which avoids database size to increase x^10.
This particular schema allows us to dynamically add new regular expressions and to obtain new metadata from new processed files no matter which internal structure they have.
Additionally this allow us to filter the data and to obtain dynamic reports based on the user criteria. We are filtering by Attribute
and then pivoting the resultset (http://msdn.microsoft.com/en-us/library/ms177410.aspx). So this example pseudo-sql query
SELECT FROM Items WHERE Size = @A AND Version = @B
would return a pivoted table like this
| ItemName | Size | Version |
|----------|-------|---------|
| Sample | 500mB | 1.0.0 |
The application has been running for months and performance decreased terribly at the point is no longer usable. Reports should take no more than 2 seconds and Items_Attributes
テーブルは週に平均10,000,000行増加します。すべてが適切にインデックス化されており、クエリ実行プランの分析と最適化にかなりの時間を費やしました。
だから私の質問は、レポートの実行時間を短縮するためにこれをどのようにスケーリングしますか?
私たちはこの可能な解決策を持ってきました:
- ハードウェアを追加購入し、SQLServerクラスターをセットアップします。(適切な「クラスタリング」戦略に関するアドバイスが必要です)
- HBaseのようなキー/値データベースを使用します(問題が解決するかどうかはわかりません)
- RDBMSではなくODBMSを使用する(db4oを検討してきました)
- ソフトウェアをクラウドに移動します(経験はありません)
- 実行時に静的にレポートを生成します。(私たちは本当にしたくありません)
- 一般的なレポートの静的インデックスビュー(パフォーマンスはほぼ同じ)
- スキーマの非正規化(一部のレポートには、1回のクエリで最大50個のテーブルが含まれます)