views:

219

answers:

2

Hey All,

I am new to Gearman. I have following queries about optimized Gearman usages:

1) I think worker expects job as a "string". Can I send an Array or Hash as Job to worker? If not, is JSON the best Job format to send Array/Hash?

2) Can I attach rails application routes as worker for Job Server?

3) How do you check if a worker is running or not? Is there any administration tool available for Job Server and Worker stats?

4) Can I architect a ROR system, such that every request passes through Gearman job server? I have multiple applications using same database (some of them are iPhone app, Android app, website). My main goal is to access content using general API for all these applications. Or Gearman is more suitable for background processes?

Thanks.

A: 

I can't say I know anything about gearman, but I think I can answer to the first question.

When you want to pass objects to other methods, you need to serialize it in one way or another (this is almost always done when passing an object to another process). The "best" way to do this depends very much on what you want to send. JSON is one way, and is probably one of the smallest when it comes to transfer size. So, yes, you can use JSON to transfer hashes and arrays.

dvyjones
A: 

http://rack.rubyforge.org/

You may want to look at rack. This might get you where you want to go..

Daniel