-
Notifications
You must be signed in to change notification settings - Fork 96
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
Issue 6574 - Move pblock access from switch to func table #6575
base: main
Are you sure you want to change the base?
Conversation
As for performance, with ldclt doing exact searches I do see a 5% - 8% performance improvement when the number of threads is increased to 16 (matching the hardware). Under less load I don't really see an improvement. So there is a benefit when the server is being hit hard. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not every day you get a 5 to 8% improvement! That's amazing to see :)
Well its only under certain load types - it's not across the board :-) But yes I see an improvement when all the workers are working |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Besides a couple of minor issues, it looks like a simple but powerful fix! Nice find!
#ifdef PBLOCK_ANALYTICS | ||
pblock_analytics_record(pblock, arg); | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This analytics code (and the one in _set
) were removed. Should we still keep it? Or it's not used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This analytics code (and the one in
_set
) were removed. Should we still keep it? Or it's not used?
I'm not 100% what these are for. I assumed it was for measuring how we accessed the pblock, but I have a feeling this is no longer needed. Perhaps we can remove it in a separate PR?
/******* Deprecated (obsolete) pblock arg identifiers ************************/ | ||
#define SLAPI_CONFIG_FILENAME 40 /* use config. entries instead */ | ||
#define SLAPI_CONFIG_LINENO 41 /* use config. entries instead */ | ||
#define SLAPI_CONFIG_ARGC 42 /* use config. entries instead */ | ||
#define SLAPI_CONFIG_ARGV 43 /* use config. entries instead */ | ||
#define SLAPI_CONN_AUTHTYPE 144 /* use SLAPI_CONN_AUTHTYPE */ | ||
#define SLAPI_REQUESTOR_ISUPDATEDN SLAPI_IS_REPLICATED_OPERATION | ||
#define SLAPI_CONN_CLIENTIP 145 /* use SLAPI_CONN_CLIENTNETADDR */ | ||
#define SLAPI_CONN_SERVERIP 146 /* use SLAPI_CONN_SERVERNETADDR */ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should mention the removal in the commit message.
But also, we have some leftovers in test/libslapd/pblock/pblock_accessors*
and a bit in _slapi_pblock_deprecated
in ldap/servers/slapd/pblock_v3.h
.
IMO, it'll be cleaner to remove the code in a separate PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left this as is with the new commit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change looks good and perf improvement very nice. IIUC a former customer plugin will require to be rebuilt, correct ?
ldap/servers/slapd/slapi-plugin.h
Outdated
@@ -6977,50 +6974,6 @@ slapi_timer_result slapi_timespec_expire_check(struct timespec *expire); | |||
* into tombstone | |||
*/ | |||
|
|||
/* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not like the massive change in slapi-plugin.h
(looks like a risk of breaking existing custom plugin
And after a closer look as you changed the #define values, it will definitively break the binary compatibility
with existing custom plugin.
IMHO we should not do this. we should be able to split the switches without changing slapi-plugin.h
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
an option would be to have a conversion table that convert a former define value into an index into the callback table
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI, or you can do a simple table:
here is a python script that generate a skeleton of what it would looks like:
split_pblock_switches.py.txt
@progier389 @tbordaz Yeah you guys are right, but the problem is that the callback table will have thousands of empty slots to fill in the gaps between the #define numbers. Maybe we can use a hash table instead? |
Having a single table with hole will be faster than an hash table (there will be a single indirection versus hash computation) |
I guess I got caught up in maintainability and trying to fix how sloppy our current code is (in regards to defines). Anyway I'll undo the slapi-plugin change and adjust the tables in pblock.c |
005db05
to
1b70acc
Compare
}; | ||
|
||
int | ||
slapi_pblock_set(Slapi_PBlock *pblock, int arg, void *value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we still need PR_ASSERT(NULL != pblock);
here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we still need
PR_ASSERT(NULL != pblock);
here.
Agreed, done!
Description Currently there are over 300 switch cases for getting/setting pblock parameters. Instead we should have separate functions for each parameter, and use a callback function pointer table. Relates: 389ds#6574 Reviewed by: spichugi, firstyear, progier, tbordaz (Thanks!!!!)
1b70acc
to
b51a417
Compare
Description
Currently there are over 300 switch cases for getting/setting pblock parameters.
Instead we should have separate functions for each parameter, and use a callback function pointer table.
This also combines all the parameter definitions to a single ordered list. This will make future changes much easier to implement.
Relates: #6574