Skip to content
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

Fix bottleneck when using confirms #266

Merged
merged 3 commits into from
Dec 3, 2013
Merged

Conversation

aheckmann
Copy link
Contributor

Publishing msgs using confirms can create a situation where so many event listeners are registered that exchange.removeListener becomes a significant bottleneck (see https://gist.github.com/aheckmann/7762370)

Instead of relying on EventEmitter, this PR now registers a single error handler for the exchange and handle error disbursement manually.

Results of running the above gist as follows:

> time DEBUG=amqp:* COUNT=30000 PREFETCH=0 BUCKET_SIZE=20000 node index.js

before applying the fix:

real  1m22.216s
user  1m10.973s
sys 0m16.106s

after:

real  0m25.034s
user  0m14.082s
sys 0m15.153s

Also tried to make whitespace use more consistent throughout the project base on what seemed to be the predominant style.

Aaron Heckmann added 3 commits November 29, 2013 10:53
Publishing msgs using confirms can create a situation where
so many event listeners are registered that `exchange.removeListener`
becomes a significant bottleneck (see https://gist.github.com/aheckmann/7762370)

Instead of relying on EventEmitter we now register a single error
handler for the exchange and handle error disbursement manually.

Results of running the above gist as follows:

> time DEBUG=amqp:* COUNT=30000 PREFETCH=0 BUCKET_SIZE=20000 node index.js

before applying the fix:
real  1m22.216s
user  1m10.973s
sys 0m16.106s

after:
real  0m25.034s
user  0m14.082s
sys 0m15.153s
it doesnt belong on a Promise. we just use "once" instead
@postwait postwait merged commit 25f7f29 into postwait:master Dec 3, 2013
@aheckmann aheckmann deleted the bottleneck branch December 3, 2013 23:11
@aheckmann
Copy link
Contributor Author

thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants