cn=Directory Manager
All about Directory Server
All | Personal | Sun

20051208 Thursday December 08, 2005

Little-known performance enhancements #2: Solaris tuning

This set of tips is kind of a cop-out since I'm not really talking about tuning the Directory Server itself all that much. However, if you're running the Directory Server on Solaris (and you should be), then there are a couple of simple things that you might not know about that can provide notable performance improvements. And unlike my last post, which was around write performance, this one should provide an all-around benefit. However these improvements will be most noticeable for CPU-intensive operations like searches, binds, and compares.

The first thing that you can do is to make the server run under the fixed-priority scheduler rather than the default time-sharing scheduler. In my experience, this generally gives you about a 5% increase in maximum search performance. And it's really simple. Just add the following near the top of your start-slapd script (and I also usually put in ldif2db as well, since it can help out there too):
# Use the fixed-priority scheduler.
priocntl -s -c FX $$

In this case, the "$$" is a special shell variable that expands to the PID of the current process (i.e., the start-slapd script itself), and the scheduler for that process will be inherited by anything that it spawns, including the Directory Server. Note that while you can provide additional configuration like setting a specific priority, you often need special privileges for doing that and even scheduling with the maximum priority doesn't seem to make much difference versus the default.

The second tip applies primarily if you're running the server on Solaris x86 (which is an excellent choice for our Opteron-based systems). By default, the Directory Server will use the mtmalloc memory manager, which was intended to help provide better memory allocation performance than the standard single-threaded malloc. Unfortunately, it doesn't quite live up to its intended purpose. However, Solaris 10 introduces the new libumem memory manager, and it has been backported to most versions of Solaris 9 (I believe update 3 or later). It is far better than mtmalloc in virtually every respect, and it will generally allow the server to go faster and consume less memory. To configure the server to use libumem rather than mtmalloc, edit the start-slapd script to add the following:
# Use the libumem memory manager.
LD_PRELOAD=/usr/lib/libumem.so
LD_PRELOAD_64=/usr/lib/64/libumem.so
export LD_PRELOAD LD_PRELOAD_64

Note that you can do this with Solaris on SPARC-based systems as well, but in general this is not necessary because on that platform we use a third-party allocator that accomplishes the same thing.

For those of you that may still be running Solaris 8, there's another potential boost that you can take advantage of (until, of course, you decide to upgrade to Solaris 10 for even better performance and tons of great new features like least privilege and zones). You can configure the server to use the alternate thread library, which became the default in Solaris 9. To do this, add the following to your start-slapd:
# Use the alternate thread library.
LD_LIBRARY_PATH=/usr/lib/lwp
LD_LIBRARY_PATH_64=/usr/lib/lwp/64
export LD_LIBRARY_PATH LD_LIBRARY_PATH_64

Note that in this case, though, you'll also need to remove another line already in the start-slapd script that unsets the LD_LIBRARY_PATH so they don't get undone before they can be of any use.

Posted by cn_equals_directory_manager ( Dec 08 2005, 12:08:57 AM CST ) Permalink Comments [2]


Archives
Language
Links
Referrers