wuguobao / pybeanstalk

Automatically exported from code.google.com/p/pybeanstalk
0 stars 0 forks source link

Expected functionality: multiple servers #6

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
According to the beanstalkd homepage, the ruby client can connect as such:

beanstalk = Beanstalk::Pool.new(['10.0.1.5:11300'])

Such functionality would be useful as standard in pybeanstalkd, eg:

from beanstalk import serverconn
conn = serverconn.ServerPool(['0.0.0.0:11300','212.212.212.30:9090'])

Original issue reported on code.google.com by phillip....@gmail.com on 9 Feb 2009 at 3:52

GoogleCodeExporter commented 9 years ago
May be more correct to assert that serverconn expects a list as the first 
parameter
containing "host:port" strings.

Original comment by phillip....@gmail.com on 9 Feb 2009 at 4:00

GoogleCodeExporter commented 9 years ago
I agree that this functionality should exist. There have been a few discussions 
on the beanstalk-talk list about 
this, and there is not a consensus yet on what "proper" multiple server use 
consists of. 

 In lieu of that, I am thinking that a multi-server implementation should be in its own package 

from beanstalk.multisever import RoundRobin as Queue

or similar.

Some issues that have to be resolved to work on this:

1. how does the module know which server to add jobs to
2. How should polling happen?

Original comment by sophac...@gmail.com on 9 Feb 2009 at 4:12

GoogleCodeExporter commented 9 years ago
Is there a big issue in having a default behaviour which can be customised by 
the
user? For instance, knowing that beanstalkd is "talking memcached" I as a user 
would
expect it to automatically default to round-robin when I pass in a list of 
host:port
strings. I'd expect to be able to select the server when I issue a .put(), to
.add_servers(), and to .remove_servers(). If there are other methods than 
round-robin
I'd expect to be able to pass this into the initial connection method as a 
keyword
argument to select.

As for polling, maybe check the Ruby implementation to see how they do it?

Original comment by phillip....@gmail.com on 9 Feb 2009 at 4:23

GoogleCodeExporter commented 9 years ago
Maybe define a MultiServer interface for the project (either as a base class or 
as a well defined convention or 
something). That way it's really easy to do customizations.  Then implement 
classes like QueuePool etc. that 
conform to it.

It allows for those who wish to do it differently to do so.

Original comment by sophac...@gmail.com on 9 Feb 2009 at 4:30

GoogleCodeExporter commented 9 years ago
Are you "thinking out loud" there as further work in the pybeanstalk library, or
suggesting this is something users should do themselves?

Original comment by phillip....@gmail.com on 9 Feb 2009 at 5:48

GoogleCodeExporter commented 9 years ago
Sorry, that is a "capture thoughts" post, that I didn't label as such. Mostly a 
note to self about how to proceed 
with work on this when I get a chance.

Original comment by sophac...@gmail.com on 9 Feb 2009 at 6:00

GoogleCodeExporter commented 9 years ago
This issue has been addressed in: http://github.com/tjdziuba/pybeanstalk

Original comment by mabdelka...@gmail.com on 19 Jan 2010 at 8:51