NSPR adds overheads to locking and threads that may not be beneficial any more. We don't have the portability issues of the past, so we should consider decoupling this. We can use pthread and inttypes.h instead.
<img alt="0001-Ticket-80-Decouple-nunc-stans-from-NSPR.patch" src="/nunc-stans/issue/raw/files/243764927dafe3b5dadc8e59dba85c41befa5238e39a297eb0883e42a55b6baf-0001-Ticket-80-Decouple-nunc-stans-from-NSPR.patch" />
Metadata Update from @firstyear: - Custom field Origin adjusted to Community - Custom field Review Status adjusted to review
you could probably do this instead of != 0
!= 0
402 + if (pthread_equal(tp->event_thread, pthread_self())) {
If you want to get rid of the PR_CreatePipe() you should investigate replacing it with eventfd()
PR_CreatePipe()
eventfd()
I was looking into the how we could replace the pipe. For now, I'm happy to leave it as it "works", but one day I'll look into replacing it with eventfd().
Another solution is that libevent is now threadsafe (I think), so we could use event loop in non-blocking mode, and avoid the event queue for new job insertion. This would mean we could just call loopexit instead of needing to use a wakeup mechanism of anykind.
Anyway, the best part of the change, is that NSPR -> pthreads doubled our throughput (1700 conns per second to 3800) on my laptop. Which is quite mind boggling that such an overhead existed.
With NSPR it's half the performance . . . that's scary. Makes me wonder about 389 as well . . .
Well, the aim is to replace DS threads with this ... so we should see a nice boost.
There are some tickets open for cleanup in DS, so this could come under that umbrella.
I noticed you replaced the PR monitors with mutex locks - could this introduce self deadlocks?
No, the mutexes are setup to be recursive (same as a monitor), so they won't self deadlock.
The nunc-stans has a self deadlock test in it, and this passes, so we are good :)
Thanks for the clarification, ack
Metadata Update from @mreynolds: - Custom field Review Status adjusted to ack (was: review)
commit 2df1fcb To ssh://git@pagure.io/nunc-stans.git 7209013..4998c86 master -> master
Metadata Update from @firstyear: - Custom field Review Status adjusted to review (was: ack)
Metadata Update from @firstyear: - Issue close_status updated to: Fixed - Issue status updated to: Closed (was: Open)
Login to comment on this ticket.