-
Notifications
You must be signed in to change notification settings - Fork 84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Performance modify rate: contention on syntax (oid/name) RWlocks #4598
Comments
Something I had a patch for and lost :-(, was having each worker thread have its own copy of these tables. The only issue was how to deal with refreshing those per thread copies without it being too costly. Anyway, I just wanted to present this idea for this issue. |
@mreynolds389 If I make a C ffi wrapper to https://docs.rs/concread/0.2.7/concread/cowcell/struct.CowCell.html this would be perfect. It allows rwlock semantics but with no blocking on writes. |
@Firstyear, there is no schema update (writers) in the tests. I guess the contention appears with the way the underlying RWlock is implemented where an 'internal' lock is acquired to update the RWlock structure. |
Yes, you need to lock/atomic to get a read lock which is expensive. The cowcell I showed works that when you "read" you get a transaction to that item, and if someone writes they have to copy and then write the content. It's kind of exactly what you want in this case .... It's a rwlock without any blocking when a writer comes in. And internally it uses pthread mutex so it's going to be faster than nspr. |
@Firstyear, sorry I miss how cowcell helps in this case. Note that at the moment syntax RWlock are using pthread rwlock. I understand the need to protect name/oid tables. But changes are pretty rare (even with replication schema update is not that frequent) and it is pretty frustration to see this contention for rare events. |
Description: There is a lot of contention around the rwlocks for the attribute syntax hashtables. Since syntaxes rarely change we can just keep a copy in each thread and avoid locking. Then the worker can check for changes on each loop and rebuild the hashtables as needed. Did some code cleanup in schema.c relates: 389ds#4598 Reviewed by: progier(Thanks!)
Issue Description
/opt/ldapbench/bin/modrate --hostname instance --port 389 --bindDN 'cn=Directory Manager' --bindPassword xxx --entryDN id=user.[1-10000],ou=People,dc=example,dc=com" --attribute street --attribute description --valueLength 12 --numThreads 5
updates two non unindexed attributes. No need to put more threads as updates are serialized it only increases response time.
By default the syntax names/oids tables are protected by a lock (each one). These locks are the one on higher contention (21%). Attribute syntax are lookup for normalization/comparison.
When turning off the protection 'nsslapd-schemamod: off' it gives a 5% gain of throughput (similar resp time): 3555/s vs 3370/s.
This issue is to evaluate possible improvements.
Package Version and Platform:
All plateforms/versions
Steps to Reproduce
provision a 10K entries and apply updates MOD_REPLACE on non indexed attributes
Expected results
Reduce the contention.
The text was updated successfully, but these errors were encountered: