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

Connection pooling? #5

Open
blakesmith opened this issue Jan 25, 2013 · 1 comment
Open

Connection pooling? #5

blakesmith opened this issue Jan 25, 2013 · 1 comment

Comments

@blakesmith
Copy link

For other RPC clients that use HTTP as the codec, connection pooling is handled at the HTTP Client level. Since go-thrift uses a different codec, how should I tackle connection pooling in a concurrent environment?

A few thoughts:

  • The RPC documentation says that an RPC client can be accessed from multiple goroutines (http://golang.org/pkg/net/rpc/#Client). Does this simply imply thread safety, or does it imply pooling should be built in to the codec?
  • I've thought about wrapping my calls to access the client in something like this: https://gist.github.com/3504674 - but I wanted to see if there was a lower level place that could handle this for me.

What are your thoughts?

Thanks!

Blake

@samuel
Copy link
Owner

samuel commented May 24, 2013

Sorry for taking so long to get back to you on this.

I'm leaving the connection pooling out of the go-thrift library since it's really using the built in RPC package in Go (which is safe for concurrent use). To add connection pooling it would be best to add a layer around that package. The strategy to choose a connection may get tricky though since it's asynchronous (which is something I should discuss more in the docs.. not all thrift servers support asynchronous requests).

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

2 participants