Skip to content

Performance Tuning #87

@JohnOmernik

Description

@JohnOmernik

Are there ways to set the cache sizes for the bdb files? I'd like to tell open ldap to use more memory if possible to cache entries for optimal performance. There are times that normal operations seem to take longer than they should, and I'd like to optimize then troubleshoot.

Thanks!

Activity

snipking

snipking commented on Nov 18, 2016

@snipking

@JohnOmernik

You can try to add index and add cache.

In my case, I use a data container name openldap-data and app container openldap.

Add Index

  1. Make sure your openldap container running.

  2. Create add_index.ldif on docker host like this

    dn: olcDatabase={1}hdb,cn=config
    changetype:modify
    add: olcDbIndex
    olcDbIndex: mobile eq
    olcDbIndex: scimId eq
    

    In my cases I add index for mobile and scimId

  3. Copy add_index.ldif to your running openldap container

    $ docker cp add_index.ldif openldap:/
    
  4. Add index use ldapmodify

    $ docker exec -it openldap ldapmodify -Q -Y EXTERNAL -H ldapi:/// -f /add_index.ldif
    
  5. Stop running openldap container

    $ docker stop openldap
    
  6. Mount data container to a temp container and do slapindex

    $ docker run --name openldap-reindex --rm -it --volumes-from openldap-data --entrypoint slapindex osixia/openldap -F /etc/ldap/slapd.d/ -b "dc=geekrealm,dc=net" mobile
    
    $ docker run --name openldap-reindex --rm -it --volumes-from openldap-data --entrypoint slapindex osixia/openldap -F /etc/ldap/slapd.d/ -b "dc=geekrealm,dc=net" scimId
    

    Remember to change the -b "dc=geekrealm,dc=net" to your LDAP_BASE_DN or target root

  7. Start openldap container

    $ docker start openldap
    

Add Cache

  1. Make sure your openldap container running.

  2. Create add_cache.ldif on docker host like this

    dn: olcDatabase={1}hdb,cn=config
    changetype:modify
    add: olcDbIDLcacheSize
    olcDbIDLcacheSize: 500000
    
    dn: olcDatabase={1}hdb,cn=config
    changetype:modify
    add: olcDbCachesize
    olcDbCachesize: 500000
    
  3. Copy add_cache.ldif to your running openldap container

    $ docker cp add_cache.ldif openldap:/
    
  4. Modify openldap config with ldapmodify

    $ docker exec -it openldap ldapmodify -Q -Y EXTERNAL -H ldapi:/// -f /add_cache.ldif
    
  5. Restart openldap container

    $ docker restart openldap
    

    Follow the openldap document. There's another olcDbConfig: set_cachesize 0 2097152 0 you can set on bdb. But current version openldap change this value with ldapmodify will cause bdb crash and modify fail. The openldap team know this bug and seems will not fix this but push users switch to mdb.

JohnOmernik

JohnOmernik commented on Dec 8, 2016

@JohnOmernik
Author

"The openldap team know this bug and seems will not fix this but push users switch to mdb."

Is it possible to select MDB for the docker openldap on start up? Based on reading, just that change can have a great affect on performance... thoughts?

snipking

snipking commented on Dec 30, 2016

@snipking

@JohnOmernik

You can select MDB when run the container. In my way, I got a workaround by setting BDB config value in /var/lib/ldap/DB_CONFIG which will override the config in dn: olcDatabase={1}hdb,cn=config.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @JohnOmernik@snipking

        Issue actions

          Performance Tuning · Issue #87 · osixia/docker-openldap