Vsoma
Vsoma

Reputation: 605

ldapjs ( using node-express) client.search is slow

I use node.js expressjs ldapjs to implement authentication.

I have a requirement as follows:

  1. Authenticate user
  2. Find all group names that user is part of
  3. Find the parent group names that user's groups are part of with a configured depth-level (3 most of times); This means find user --> find user'sGroup(s)---> find groups' parent group up to three more levels.

To implement the above in node-express environment I'm using ldapjs with passportjs (writing a custom strategy to fit our requirement).

My observation is that, each of the search requests made throgh ldapClient is taking approximately 70ms, which is very slow to finish all the search requests I need to make (will need to perform up to 60-80 search requests during authentication).

I implemented above to be serial requests(I make next request after the current one is finished).

How can I possibly improve the performance in this case. What are the available options that I can look into?

Upvotes: 1

Views: 775

Answers (1)

Vsoma
Vsoma

Reputation: 605

I could improve the performance significantly by making all the search requests run in parallel, and making use of 'parallel-searches-end' callback to handle parent search depth level.

The above was possible with async.parallel method of 'async' node module.

Thanks to everyone who might have looked into this.

Upvotes: 2

Related Questions