Multiple Client Instances?

1 view
Skip to first unread message

txjflip9557

unread,
Jul 16, 2010, 5:09:55 PM7/16/10
to Ramaze
Hello,

I am currently in the process of developing a web server application
through Ramaze framework. This application will be accessed by
multiple concurrent users (up to around 10 or so), and some of the
processes inside this server app could require much processing.

I was wondering - does Ramaze include some kind of functionality so
that the server creates a new instance of the application for each
client? Or, should some kind of design be achieved in the app for
handling and management of multiple client threads?

I would not want multiple clients accessing the server to conflict
with each other in the underlying controller code (especially since
much processing could be taking place per client).

Thanks for the help,
J

Pistos

unread,
Jul 17, 2010, 1:22:03 AM7/17/10
to Ramaze
One approach you could consider is to maintain some record of tasks,
such as in a database. Then the Ramaze app's responsibility is merely
to insert tasks into a queue, and something else would be responsible
for picking up queued jobs, and doing the work. That could be a
daemon, or a cronjob. That would let your Ramaze app return
immediately, and you could have a controller action for listing
pending jobs, etc.

The external daemon would be responsible for synchronization and
process/thread safety. You could choose to execute jobs only
serially, for example.


Pistos

txjflip9557

unread,
Jul 17, 2010, 10:28:49 AM7/17/10
to Ramaze
I think that sounds very similar to what I had in mind. So, I was
wanting to do something like the following:

"page/console.rb"

class MainController

# this is where page request is received?
def console

manage( request )
render_console

end

def render_console

# element( ... )

end
end

"main_controller.rb"

class MainController

def manage( request )
event = request[:event]
task_id = request[:task_id]

case( event )
when EVENT_1
# pass functionality for event1 to task[task_id]
@task[task_id].event_1()

# ...
end
end
end

...Or something along those lines. So, functionality is being passed
off to a new task, based on the form being received from the client.

How does this look? Would I be overlooking anything crucial?

Thanks for the help!
J

Michael Lang

unread,
Jul 20, 2010, 6:03:51 PM7/20/10
to ram...@googlegroups.com
J,

You might be interested in this blog I whipped up:
http://ramblings.gibberishcode.net/archives/implementing-ruby-jobs-in-the-background/38

Michael

--
You received this message because you are subscribed to the Google Groups "Ramaze" group.
To post to this group, send email to ram...@googlegroups.com.
To unsubscribe from this group, send email to ramaze+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/ramaze?hl=en.




--
http://codeconnoisseur.org

txjflip9557

unread,
Jul 22, 2010, 12:07:41 AM7/22/10
to Ramaze
That is great!! I can definitely work with that daemons
utility...thanks for the post!

On Jul 20, 5:03 pm, Michael Lang <mwl...@cybrains.net> wrote:
> J,
>
> You might be interested in this blog I whipped up:http://ramblings.gibberishcode.net/archives/implementing-ruby-jobs-in...
> > ramaze+un...@googlegroups.com<ramaze%2Bunsu...@googlegroups.com>
> > .
Reply all
Reply to author
Forward
0 new messages