Database Reference
In-Depth Information
Table 2-1. Coding Strategies to Design for Performance
Technique
Comments
Bulk data loading/changing
Minimizes roundtrips by using a data access library that
supports loading data in bulk, such as the Entity Framework.
Lazy loading
Allows you to create objects for which certain properties are
loaded only when first called, to minimize loading unnecessary
data (and improve performance). The Entity Framework 4.0
supports this.
Caching
Lets you to keep in memory certain objects that don't change
frequently. The caching application blocks provided by
Microsoft offer this capability as well as expiration and
scavenging configuration settings.
Asynchronous user interface
Not technically a performance-improvement technique, but
allows users to use the application while your code is
performing a long-running transaction and thus provides a
better user experience.
Parallel processing
Allows you to run code on multiple processors for optimum
performance. Although complex, this technique can provide
significant performance advantages.
Shards
Lets you to store data in multiple databases to optimize reads
and spread the load of queries over multiple database servers.
Because shards are considered a newer technology, the remainder of this chapter focuses on
building a HPS using caching and parallel processing in order to improve performance and scalability.
Building a Shard
Let's build a shard library that can be used by applications that need to load and update data against
multiple SQL Azure databases as quickly and transparently as possible. For the purpose of building an
efficient shard library, you stipulate the following requirements for the shard:
1.
Adding new databases should be simple and transparent to the client code.
2.
Adding new databases shouldn't affect performance negatively.
3.
The library should function with SQL Server, SQL Azure, or both.
4.
The library should optionally cache results for fast retrieval.
Search WWH ::




Custom Search