Description
Historically, we have considered exception handling performance to not to be important. The point was that exceptions should be used for exceptional cases handling and thus they should not have significant impact on well behaved applications. However, a new scenario where this is not true has surfaced recently. When a service depends on a resource that is inherently unreliable, for example a computer network, random temporary failures in such a resource can trigger a failure storm in the service and potentially other services that depend on that service. In this case, the performance of the exception handling is very likely an important factor for fast recovery of these services.
Moreover, the fact that such cases would most likely involve async patterns, the exception handling performance issues get amplified by the fact that the exceptions are rethrown on async state transitions.
A customer has reported that JAVA exception handling is about 10 times better on the same hardware (#12892). We also know that native AOT has much better exception handling performance than CoreCLR.
Goals
- Measure performance of exception handling in various scenarios
- Software / hardware exceptions
- Sync / async code
- Windows / Unix
- CoreCLR / native AOT
- Profile the CoreCLR scenarios and determine if there are opportunities for improvements within the confines of the current implementation.
- Investigate what it would take to leverage the native AOT exception handling architecture in CoreCLR.
- Estimate the cost of potential changes.
- Write and publish a learning document on the found details and suggested improvements.