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

AMPQ broker connection reusing #26

Closed
requilence opened this issue Sep 7, 2015 · 7 comments
Closed

AMPQ broker connection reusing #26

requilence opened this issue Sep 7, 2015 · 7 comments

Comments

@requilence
Copy link
Contributor

Is there a reason to open/close broker connection on every message publishing?
In a single goroutine with AMPQ connection reusing I have 110 msg publish/sec vs 55 msg/sec with current implementation.
Also with using of goroutines to publish messages I was able to get 34000 msg/sec on the same configuration. Looks like goroutines is safe when reusing AMPQ connection

@RichardKnop
Copy link
Owner

@requilence Hi Roman. There is no specific reason for it. You can submit a PR if you want. I'm a bit busy at the moment but performance improvements like this are needed. The way I did it was the easiest implementation but it would be much better to reuse connections.

@requilence
Copy link
Contributor Author

@RichardKnop Ok, I will test my solution and if everything works great I will create PR.

@wizard580
Copy link

@requilence
Can you show your solution? I'll try to test it.

@requilence
Copy link
Contributor Author

@wizard580 #36

@mission-liao
Copy link

I've working on some go-amqp stuff (another worker queue project) and found this (issue)[https://github.com/streadway/amqp/issues/119] in that project. Quote from one discussant:

I personally saw massive performance improvements by using a channel per go routine. 

In current implementation of machinery, we create a channel (and connection) per 'SendTask', it seems a reasonable implementation, or maybe we would at least maintain a 'channel pool' for each request from different go routine.

@requilence
Copy link
Contributor Author

@mission-liao Also the similar approach is using in https://github.com/go-mgo/mgo.
Initially I made the same decision (reusing connection, reinit channel) but doesn't see any performance benefits from this. I will repeat tests today and come back with results

@RichardKnop
Copy link
Owner

Great work and investigation guys. It seems reusing channels might be the way to go.

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

No branches or pull requests

4 participants