Sunday, 15 January 2012

Enterprise Library WCF Validation Performance

Following on from my previous post on WCF Request Validation Performance I thought I would share some of the performance test comparisons between the Enterprise Library WCF Validation and performing manual validation of service request objects.
It should be noted that the aim of this testing was not to be an exhaustive test of the relative performance of each approach but to simply get an order of magnitude comparison between the two options.
The test comprises of a host that exposes two services:
  • EntLibValidationService – A service that is configured with Enterprise Library WCF validation
  • ManualValidationService – A service that is performing manual validation
A client console application which has a number of test cases configured for each of the services:
  1. A null argument passed to a service request
  2. A property of a request object out of range
  3. A request containing a list of objects
  4. A request containing a list of derived request objects
The tests are run 1000 times in a loop and timed the average is then calculated. The following are the results executed on my desktop which has the following specification:

Processor: Intel(R) Xeon(R) CPU E5606  @ 2.13GHz (4 CPUs), ~2.1GHz
Memory: 3072MB RAM

Test Case
Run 1
Run 2
Run 3
Average
EntLIb
1
7.6 ms
7.7 ms
7.7 ms
7.6 ms
2
7.5 ms
7.7 ms
7.7 ms
7.6 ms
3
9.1 ms
9.4 ms
9.7 ms
9.4 ms
4
9.8 ms
10 ms
10 ms
9.9 ms
Manual
1
9.6 ms
9.8 ms
9.7 ms
9.7 ms
2
9.2 ms
9.5 ms
9.5 ms
9.4 ms
3
9.3 ms
9.5 ms
9.5 ms
9.4 ms
4
9.9 ms
9.9 ms
9.8 ms
9.8 ms

From the above results it can be seen that there is not much overhead in using the Enterprise Library for WCF request validation. In the case of argument or property validation, Case 1 and Case 2, it can be seen that it actually performs better than manual validation.

For test Case 3 and 4 the numbers do not reflect an accurate comparison of manual validation due to the fact that the Enterprise Library validator performs validation on all of the objects in the collection for each call therefore it has actually performed better than the manual validation.

I suspect that most of the overhead of the request’s are serialising and de serialising the faults generated from both validation mechanisms.

No comments:

Post a Comment