Wednesday, September 21, 2011

Database scalability tips

  1. Avoid Object Relational Mappers. They create complex queries that hard to optimize.
  2. Analyze locks. Row level locking is better than table level locking. Use async replication
  3. Single database choke point? Create parallel databases and let a driver select between them.
  4. Use metrics. Visualize what's happening to your system using one of the many monitoring packages.
  5. Lack of Feature Flags. Turn off features via a flag so when a spike hits less important features can be turned off to reduce load.
© Copyright 2011, Tomas Elfving

Friday, September 16, 2011

WS consumer performance tips

WS call are always expensive with the overhead each call require. Caching is a way to avoid unneccesary WS calls and improve performance: 

The general rules for cacheing are:

Always cache WS data which is not very dynamic in nature, bu at the same time make sure you don't get functional error by caching data that needs to be fetched fresh.

Use the ASP.NET cache with a timeout instead of some custom cache like hash table

Invalidate cache based on business rules or time-out

Consumers of Web services have the option of calling web services asynchronously or synchronously. Your code should call a Web service asynchronously only when you want to avoid blocking the client while a web service call is in progress. If you are not careful, you can use a greater number of worker and I/O threads cause by asynchronous WS calls, which negatively affects performance. It is also slower to call a service asynchronously; therefore, you should avoid doing so unless your client application needs to do something else while the service is invoked.

© Copyright 2011, Tomas Elfving