The simplest approach is to use the queue, but that requires 
check...wait...check...wait....

Another way, is to have one master and several always awake slaves "listening" 
as devices.
The master uses the SEND command to pipe a command directly into the "input 
stream" of the listeners.
This makes them wake up instantly (more or less) instead of waiting a second or 
a minute to check the queue.



-----Original Message-----
From: Peter Cheney <peter.che...@firstmac.com.au>
To: 'U2 Users List' <u2-users@listserver.u2ug.org>
Sent: Thu, Mar 6, 2014 4:05 pm
Subject: Re: [U2] Multi-threaded phantom processing


My thoughts were that the parent will need to allocate the work and in doing so 
take the incoming data stream, launching a child and somehow pass the work to 
it. My only current knowledge of doing that within UV basic is writing to a 
queue and have the child phantom read from that and respond via another queue. 
Hence my question if there there's another possibly better way of doing it?

It is nice to know if a particular phantom is busy or available though so that 
suggestion is certainly handy thanks.



Peter Cheney
Ultracs Developer
t 07 3017 8837 | f 07 3002 8400
e peter.che...@firstmac.com.au
w firstmac.com.au


-----Original Message-----
From: u2-users-boun...@listserver.u2ug.org 
[mailto:u2-users-boun...@listserver.u2ug.org] 
On Behalf Of Wjhonson
Sent: Friday, 7 March 2014 02:52
To: u2-users@listserver.u2ug.org
Subject: Re: [U2] Multi-threaded phantom processing


I was referring solely to the point of launching "phantoms" and how they could 
communicate back to their master who launched them.  Not back to a different 
server.  So the thread was mentioning a master-slave relationship on *a* server 
as I understood it.  And the question asked was how do the slaves and master 
communicate.



-----Original Message-----
From: David A. Green <dgr...@dagconsulting.com>
To: 'U2 Users List' <u2-users@listserver.u2ug.org>
Sent: Thu, Mar 6, 2014 5:43 am
Subject: Re: [U2] Multi-threaded phantom processing


Will you kinda lost me on this approach.  Since the Server socket is on a 
different machine than the client they don't see each other's locks.
Different clients might be on different servers too.

David A. Green
(480) 201-7953
DAG Consulting


-----Original Message-----
From: u2-users-boun...@listserver.u2ug.org
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Wjhonson
Sent: Wednesday, March 05, 2014 5:26 PM
To: u2-users@listserver.u2ug.org
Subject: Re: [U2] Multi-threaded phantom processing


Peter is the only point of the "parent child communications" to address points 
like

1 I'm busy go away; OR
2 I'm available to work

If so, you could simply use a lock-semaphore to address both of those issues.\


-----Original Message-----
From: Horacio Pellegrino <pellegrin...@gmail.com>
To: U2 Users List <u2-users@listserver.u2ug.org>
Sent: Wed, Mar 5, 2014 4:19 pm
Subject: Re: [U2] Multi-threaded phantom processing


Why don't you have one port listening for requests, and as soon as they come 
in, 
you create a new phantom to answer that request ( liberating the listener 
immediately for the next request ), then when the phantom finishes it could log 
off.

Might be you want to keep a "pool" of phantoms alive for a while, on the 
assumption they might be reused. That way you are sill using one license per 
request, but you have the benefit of "pooling"... You can always set min-max 
limit for those phantom-workers.

Horacio Pellegrino




On Tue, Mar 4, 2014 at 11:30 PM, Peter Cheney
<peter.che...@firstmac.com.au>wrote:

> Thanks David. As they say "Bigger than Ben-Hur"!
>
> That's a great idea. The server I have is listening on a predetermined
> port. I trolled through /etc/services and a netstat on the remote host
> to select something that looked unused.
>
> So then if it the main phantom spawns 1-n children (presumably more
> phantoms?), it would also need to select 1-n ports which I suppose
> must also be predetermined? Or is there a call to the OS that can
> return an unused port? We're on AIX but the remote host is HPUX.
>
> Cheers
> Peter
>
>
>
> Peter Cheney
> Ultracs Developer
> t 07 3017 8837 | f 07 3002 8400
> e peter.che...@firstmac.com.au
> w firstmac.com.au
>
>
> -----Original Message-----
> From: u2-users-boun...@listserver.u2ug.org [mailto:
> u2-users-boun...@listserver.u2ug.org] On Behalf Of David A. Green
> Sent: Wednesday, 5 March 2014 13:01
> To: 'U2 Users List'
> Subject: Re: [U2] Multi-threaded phantom processing
>
> Peter, first of all let me congratulate you on this achievement.
> Having just finished a similar feat using UniData I understand the
> complexities that went into it.
>
> The system I'm current working with will be relatively low traffic.
> But I was pondering on the method of having a server socket that would
> just spawn a transfer server socket and send the socket address to the
calling client.
>  Then the client disconnects from the main server and just uses the
> transfer server to complete the task.
>
> Having 10 open phantoms with sockets will use up 10 licenses.
>
> David A. Green
> (480) 201-7953
> DAG Consulting
>
>
> -----Original Message-----
> From: u2-users-boun...@listserver.u2ug.org [mailto:
> u2-users-boun...@listserver.u2ug.org] On Behalf Of Peter Cheney
> Sent: Tuesday, March 04, 2014 6:18 PM
> To: U2 Users List (u2-users@listserver.u2ug.org)
> Subject: [U2] Multi-threaded phantom processing
>
> Hi Everyone,
>
> A project that I'm currently working on requires transmission of
> transactional and ancillary data from one UV site to site to another.
> I have the communications all set up and it is working very well via
> the UV socket functions with a client at one end and a server at the
other.
> Both the client and the server both run as a UV phantom processes
> written in UV basic and the data being transferred (also encrypted) is
> more or less real time with various UV file triggers on the client end
> creating queue items for transmission based on the data content /
transaction type.
>
> This set up is a single threaded affair and I am wondering how it will
> cope and what options I'll have as the volume of data increases.
>
> Multi-threading my server process to dish out some of the load might
> be one possibility and I've seen examples in the past where the last
> digit of a numeric key (i.e. 0-9) is used to determine which one of 10
> phantoms to call thus providing an effective distribution of the work.
>
> But even then, reading/writing processing data to a file for each
> child process seems to me to be the only way to achieve parent <->
> child phantom communications at either end. Is there another way
> perhaps? It may be that I will need 2 sets of phantoms, 1 for the
> transactions and one for the ancillary data. Although we run UV on AIX
> the only other requirement is that I must be able to do it within UV
Basic.
>
> Does anyone out there on the list know of a better way or any
> alternatives/advice so I can get a better appreciation of what else
> might be possible please?
>
> Many thanks in advance,
> Peter
>
>
> Peter Cheney
> Ultracs Developer
> t 07 3017 8837 | f 07 3002 8400
> e peter.che...@firstmac.com.au
> w firstmac.com.au
>
>
>
>
> ----------------------------------------------------------------------
> ---------
> Note:
> This email (inc all attachments) is for the use of the intended
> recipient(s) only.
> Privileged or confidential information may be contained in this
> communication. If you have received this email in error, please notify
> the sender immediately and then delete all copies of this message from
> your computer network. If you are not the intended recipient, you must
> not keep, use, disclose, copy or distribute this email without the
> author's prior permission. If you are the intended recipient and you
> do not wish to receive similar electronic messages from us in future,
> then please respond to the sender to this effect.
> We have taken precautions to minimise the risk of transmitting
> software viruses, but advise you to carry out your own virus checks on
> this email and its attachments. We do not accept liability for any
> loss or damage caused by software viruses and do not represent that
> this transmission is free from viruses or other defects.
> Firstmac Limited (ABN 59 094 145 963) (AFSL 290600)
>
>
> ----------------------------------------------------------------------
> --------- _______________________________________________
> U2-Users mailing list
> U2-Users@listserver.u2ug.org
> http://listserver.u2ug.org/mailman/listinfo/u2-users
>
> _______________________________________________
> U2-Users mailing list
> U2-Users@listserver.u2ug.org
> http://listserver.u2ug.org/mailman/listinfo/u2-users
>
>
>
> ----------------------------------------------------------------------
> ---------
> Note:
> This email (inc all attachments) is for the use of the intended
> recipient(s) only.
> Privileged or confidential information may be contained in this
> communication. If you have received this email in error, please notify
> the sender immediately and then delete all copies of this message from
> your computer network. If you are not the intended recipient, you must
> not keep, use, disclose, copy or distribute this email without the
> author's prior permission. If you are the intended recipient and you
> do not wish to receive similar electronic messages from us in future,
> then please respond to the sender to this effect.
> We have taken precautions to minimise the risk of transmitting
> software viruses, but advise you to carry out your own virus checks on
> this email and its attachments. We do not accept liability for any
> loss or damage caused by software viruses and do not represent that
> this transmission is free from viruses or other defects.
> Firstmac Limited (ABN 59 094 145 963) (AFSL 290600)
>
>
> ----------------------------------------------------------------------
> --------- _______________________________________________
> U2-Users mailing list
> U2-Users@listserver.u2ug.org
> http://listserver.u2ug.org/mailman/listinfo/u2-users
>



--

*hp*
_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users

_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users

 -------------------------------------------------------------------------------
Note: 
This email (inc all attachments) is for the use of the intended recipient(s) 
only.
Privileged or confidential information may be contained in this communication. 
If you have received this email in error, please notify the sender immediately 
and then delete all copies of this message from your computer network. If you 
are not the intended recipient, you must not keep, use, disclose, copy or 
distribute this email without the author's prior permission. If you are the 
intended recipient and you do not wish to receive similar electronic messages 
from us in future, then please respond to the sender to this effect. 
We have taken precautions to minimise the risk of transmitting software 
viruses, 
but advise you to carry out your own virus checks on this email and its 
attachments. We do not accept liability for any loss or damage caused by 
software viruses and do not represent that this transmission is free from 
viruses or other defects. 
Firstmac Limited (ABN 59 094 145 963) (AFSL 290600) 
 -------------------------------------------------------------------------------
_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users

 
_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users

Reply via email to