Thinking About GServer

  • Thread starter James Edward Gray II
  • Start date
J

James Edward Gray II

I need to code up a server. It could have as many as fifty
simultaneous users all sending in commands. Those commands need to be
processed in the order received, and many logged-in users may see
changes based on the processing of those commands.

I can code all this myself, I'm sure, but I thought I would have a look
at GServer. It looks to simplify server setup and incoming reads, but
it doesn't seem to offer any help for output. Am I reading this right?

My plan for handling input is to push all commands onto a thread safe
queue and have the main event thread pull them off the other end one at
a time. But let's say that an event affects users A, B, and C. How do
I notify them all?

Do I cache their sockets when they log in, by name, and then write to
each of those when the time comes? Those writes would need to be
threaded I suppose, to avoid blocking the event thread.

I guess mainly what I'm asking is, I need to roll all this output
handling on top of GServer, if I want to use it, right?

Thanks.

James Edward Gray II
 
J

Joel VanderWerf

James said:
I need to code up a server. It could have as many as fifty simultaneous
users all sending in commands. Those commands need to be processed in
the order received, and many logged-in users may see changes based on
the processing of those commands.

I can code all this myself, I'm sure, but I thought I would have a look
at GServer. It looks to simplify server setup and incoming reads, but
it doesn't seem to offer any help for output. Am I reading this right?

My plan for handling input is to push all commands onto a thread safe
queue and have the main event thread pull them off the other end one at
a time. But let's say that an event affects users A, B, and C. How do
I notify them all?

Do I cache their sockets when they log in, by name, and then write to
each of those when the time comes? Those writes would need to be
threaded I suppose, to avoid blocking the event thread.

I guess mainly what I'm asking is, I need to roll all this output
handling on top of GServer, if I want to use it, right?

Have you considered, at least for prototyping, using drb, with the
thread-safe queue being the object exposed to clients (i.e.,
DRbUndumped) by drb? The client code would push commands onto this
queue, and the server would pull them off. The command object could
contain a reference to a DRbUndumped object that stays on the client
side. The server calls methods on this object to notify the client.
(Another approach is to use yield: the client provides a block, and the
server yields to it, passing a notification value.)

For 50 clients, this might be less responsive than using GServer, though.
 
J

James Edward Gray II

Have you considered, at least for prototyping, using drb, with the
thread-safe queue being the object exposed to clients (i.e.,
DRbUndumped) by drb?

I should have specified this in my original message, my bad. My server
needs to be reachable with simple Telnet.

James Edward Gray II
 
S

Shashank Date

Hi James,

My plan for handling input is to push all commands
onto a thread safe
queue and have the main event thread pull them off
the other end one at
a time. But let's say that an event affects users
A, B, and C. How do
I notify them all?

I may not be reading this right (ignorant me ;-) but
it sounds something like Ara Howard's rq package:

http://raa.ruby-lang.org/project/rq/

Again, apologies if that is not you meant.
James Edward Gray II

-- shanko



__________________________________
Do you Yahoo!?
The all-new My Yahoo! - Get yours free!
http://my.yahoo.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top