Hi Folks,
We are glad to announce shiny new release of BackgrounDRb, which will soon become 1.0.
A quick summary of changes:
- BackgrounDRb is no londer DRb, its based on event driven network programming library packet ( http://www.packet.googlecode.com ) .
- Since we moved to packet, many nasty thread issues, result hash corruption issues are totally gone. Lots of work has went in making scheduler rock solid stable.
- Each worker, still runs in its own process, but each worker has a event loop of its own and all the events are triggered by the internal reactor loop. In a nutshell, you are not encouraged to use threads in your workers now. All the workers are already concurrent, but you are encouraged to use co-operative multitasking, rather than pre-emptive. A simple example is,
For implement something like progress bar in old version of bdrb, you would: - start your processing a thread (so as your worker can receive further request from rails ) and have a instance variable ( protected by mutex ) which is updated on progress and can be send to rails.
With new backgroundrb, progrss bar would be: - process your damn request and just use register_status() to register status of your worker. Just because you are doing some processing won't mean that your worker will block. It can still receive requests from rails.
- Now, you can schedule mulitple methods with their own triggers.
- Inside each worker, you can start tcp server or connect to a external server. Two important methods available in all workers are:
start_server("localhost",port,ModuleName) connect("localhost",port,ModuleName)
Connected client or outgoing connection would be integrated with Event Loop and you can process requests from these guys asynchronously. This mouse trap can allow you to build truly distributed workers across your network.
The detailed list of changes can be found here:
http://backgroundrb.rubyforge.org/
Please give it a try and let me know if you found any bugs.