Ticket #995 (assigned enhancement)
CCL internal lock contention during multi-threaded computation
| Reported by: | fare | Owned by: | gb |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Performance | Version: | trunk |
| Keywords: | ITA | Cc: |
Description
We have a multithreaded computation that uses TYPEP a lot to filter results but is experiencing performance issues.
There's an internal recursive-lock in the CCL type system that causes reporting threads to block a noticeable amount of time. The lock is 'lock' in l1-typesys.lisp in the form that defines clear-type-cache values-specifier-type and is closed over those functions.
And our culprit is a simple TYPEP.
Not much happens while the lock is grabbed; for a (typep <obj> '<class-name>) call, it's basically an sxhash and an svref. But with many processes all filtering entries from their database session identity maps by type, there's a lot of contention.
We can refactor our application to have fewer calls to TYPEP.
But CCL implementers might be interested in some lock-free algorithm , for instance using persistent datastructures for the type cache, or some structure that only requires a lock when writing.
Xref: ITA bug 119154
