On 01.07.20 10:53, Zoran Vasiljevic wrote:
I understand you added rwlocks elsewhere as well?
There are already rwlocks in NaviServer since ages, used e.g. for epoch management, ADP tags, permissions. The current version uses as well rwlocks for nsv variables (most user visible part) and also for URLspace and connchan handles. For URLspace, the write ratio is in the very low per mille range (clear advantage for rwlocks), for connchan handles, it is already better use rwlocks for channels with a single read operation, and the benefit becomes larger with more channel interactions. This is the current state - some parts still under evaluation. More details will be in the summaries before the releases.
Another interesting candidate is nscache, but the situation is more complex: although - by construct - caches experience much more read than write operations, the usage for rwlocks there would be rather complex, since one has to know before the lock, whether an operation will be read or write. But the lock guarding the main interface (nscache_eval) is used for reading and writing, so it would require always a write lock. So, due to my workload, i have no final opinion on the usefulness of rwlocks in this context.
For the people not having an eye on the source code changes: One important enabler/driver for these changes is the switch from the "manual" rwlock implementation we had before towards using the rwlock implementation from pthreads (we still use the "manual" rwlock implementation for NaviServer variants compiled without pthreads, such as the usual windows compilations).
The newer implementations of pthreads in the Linux world benefit from the work on futex variants (fast userspace mutex), which exist in new Linux versions in many variants (wake-wait futex, priority inversion futex, optimistic spinning futex formerly called throughout optimized futex). As the results show, there is similar work going on e.g. on macOS.
all the best -g _______________________________________________ naviserver-devel mailing list naviserver-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/naviserver-devel