Re: IPC looking for simple/best way to communicate

whansen_at_corporate-image_dot_com_at_us.com
Date: 01/10/05


Date: Mon, 10 Jan 2005 21:19:35 GMT

I'm starting to think that Shareable may be the way to go unless I
want to go to a server/client connection. I already mentioned that I
have found a way to use Shareable for communication instead of for the
actual list and that sped things up a great deal.

A server would work like this:

Server accepts connections on given port. Connection can be just a
request or a request with a removal. Sever accepts any removals and
removes them from it's list and then replies with the next data item
from it's list for the client to run. Disadvantage - each process must
connect to the server once for each itteration. What happens if the
server is busy with another process. Advantage - Very exact control
over the list. The server can easily make sure the list is run evenly
where the current model uses a randomization so that the processes
won't all be running the same list in synyc.

Now the server process would be very simple. It just maintains the
list and gives out the next element. But I wonder if a single process
could deal well with 150 or more requests per second. I think I'd just
have to program it and give it a try. Can anyone comment on this? What
would happen if the server was not avialble? I'm assuming the
requesting process would just wait for the port to be clear. Again
this would be much less important in the actual use when it slows down
to 5 requests per second.

On Fri, 07 Jan 2005 12:29:16 -0800, Jim Gibson
<jgibson@mail.arc.nasa.gov> wrote:

>In article <41ded263.3951491@news.sonic.net>,
><whansen_at_corporate-image_dot_com@us.com> wrote:
>
>> I'm trying to find the best way to do something. I've got 50 processes
>> (may have 200 soon) that need to broadcast simple messages to each of
>> them. I tried doing this with sockets, but although I was able to get
>> them to read a socket without halting succesfully I found that when
>> one process reads a socket it removes the message from the socket and
>> the other processes don't see it. My current solution works using
>> IPC::Shareable, but is slow and hogs memory as well as the CPU.
>> Shareable lets you set a variablle that multiple programs can read and
>> write to. In my case they read and write to the list that they all run
>> off.
>
>Sockets implement a data connection between two processes, potentially
>on different systems. Three or more processes cannot share a socket.
>When you write data to a socket that connects two processes, only the
>reading process will get the data. Any other process will be reading
>from its own unique socket and will not receive the data. You would
>have to connect each pair of processes with a unique socket pair. For
>200 processes, that would mean 39800 separate sockets.
>
>A better approach using sockets would implement a single dispatcher
>process that sends the current list to each of the 200 analysis
>processes (or whatever you want to call them). Each analysis process
>would send the updated list to the central dispatching process.
>
>If all of your processes are on the same system, then internet protocol
>(IP) domain sockets impose a network overhead that is unnecessary. You
>are better off using Unix domain sockets (assuming you are on Unix,
>that is).
>
>However, it would seem for this application that shared memory is the
>fastest way to go, and IPC::Shareable gives you access to shared memory
>(disclaimer: I have not used it). If you are having performance
>problems, then can try to optimize your use of shared memory. One
>suggestion would be to make a local copy of the shared memory list and
>iterate over the local copy. This works if you can use an old list when
>the list gets modified for a short period of time. You can check
>periodically (using another shared variable perhaps) if the list has
>been modified and fetch the new version. You can use a simple counter
>to indicate when the list has been updated.
>
>If you can't get IPC::Shareable to work, you can put the list into a
>file, periodically read the file if it is unlocked, and have any
>process that wants to update the file lock it and re-write it.
>
>
>----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
>http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
>---= East/West-Coast Server Farms - Total Privacy via Encryption =---



Relevant Pages

  • Re: Anonymous Anonymity - Request For Comments
    ... > and request that you reply directly to my e-mail address. ... > for the entity wishing to preserve their anonymity. ... > the machine can perform as a Intermediary Server and / or as a Intermediary ... > The software then attempts connection to a Intermediary Server. ...
    (Bugtraq)
  • Re: ASP.NET 2.0 - a newbie question
    ... Is there some experienced ASP.NET 2.0 developer, ... server that comes bundled Microsoft VWDE. ... A connection attempt failed because the ... connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& ...
    (microsoft.public.dotnet.framework.aspnet)
  • IE6 bug: doesnt resend form-data when server resets connection
    ... When the server closes the connection on a socket where IE is currently ... sends the request on an existing socket and the server immediately replies ...
    (microsoft.public.windows.inetexplorer.ie6.browser)
  • Re: Performance Issue with Runtime Image
    ... >> the client, closes the connection, then dies. ... request before even accepting the next incoming connection. ... The client program is unaffected so presumably the server is ...
    (comp.lang.smalltalk.dolphin)
  • error when move web service from dev machine to test server
    ... I have a simple web service that I developed on my laptop that resides ... test server, & when I try to run it, I get the error "No connection could be ... No connection could be made because the target machine actively refused it ... Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState ...
    (microsoft.public.dotnet.framework.webservices)