[CSHARP-272] Reduce lock contention in LookupSerializer (and in serialization config in general) Created: 19/Jul/11 Updated: 02/Apr/15 Resolved: 19/Jul/11 |
|
| Status: | Closed |
| Project: | C# Driver |
| Component/s: | None |
| Affects Version/s: | 1.1 |
| Fix Version/s: | 1.2 |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Robert Stam | Assignee: | Robert Stam |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Description |
|
LookupSerializer is called millions of times under heavy load. Currently it uses an exclusive lock to provide thread safety. Since after a short initialization period the access pattern becomes almost exclusively read-only it would be very beneficial to switch from an exclusive lock to a shared ReaderWriterLockSlim which would allow parallel readers. This is motivated by an actual test scenario that showed lock contention really was happening. |