Author |
Message
|
sms@pccl.demon.co.uk |
Posted: Thu Jan 05, 2006 4:07 am Post subject: Security Exit Threads |
|
|
Newbie
Joined: 05 Jan 2006 Posts: 3 Location: UK
|
I'm writing my first MQ Channel Security Exit. It is to run on Solaris and possibly Linux.
The "Interconnections" manual says that Exit code must make thread-safe calls, which I can do. However, it does not say whether it is possible for a Security Exit to be called concurrently with itself. If it can be called concurrently then it will have to be thread-safe too (eg by using thread-specific data).
Does anyone know whether the code should be thread safe or can I assume that the Exit Code will be called serially?
TIA. |
|
Back to top |
|
 |
EddieA |
Posted: Thu Jan 05, 2006 9:17 am Post subject: |
|
|
 Jedi
Joined: 28 Jun 2001 Posts: 2453 Location: Los Angeles
|
I don't have any experience with this, but if the manual says:
Quote: |
Exit code must make thread-safe calls |
then my assumption would be the opposite of yours. I would assume that the code must be thread save. Or IBM woudln't have made that statement.
Cheers, _________________ Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0 |
|
Back to top |
|
 |
sms@pccl.demon.co.uk |
Posted: Fri Jan 06, 2006 1:15 am Post subject: |
|
|
Newbie
Joined: 05 Jan 2006 Posts: 3 Location: UK
|
Thanks Eddie.
In order to prove the situation I have performed the following experiment:
1. Write a security exit which writes to a log file, sleeps for 5 seconds, writes to the log file again and then returns.
2. Arrange for two channels to be opened at the same time.
The log files show sequences like:
entry - entry - exit -exit
This shows that the function is running concurrently so it has to be thread-safe. |
|
Back to top |
|
 |
sms@pccl.demon.co.uk |
Posted: Fri Jan 06, 2006 1:56 am Post subject: |
|
|
Newbie
Joined: 05 Jan 2006 Posts: 3 Location: UK
|
I forgot to say why I was worried about this. The Redbook on Channel Security Exits (SG24-5306-00) contains an example Exit. The code uses several global variables so it does not appear to be thread-safe.
So, the documentation suggests that there is no need to write thread-safe code. However, the experiment I performed early shows that thread-safe code is required. |
|
Back to top |
|
 |
mvic |
Posted: Wed Jan 11, 2006 3:34 am Post subject: |
|
|
 Jedi
Joined: 09 Mar 2004 Posts: 2080
|
sms@pccl.demon.co.uk wrote: |
The Redbook on Channel Security Exits (SG24-5306-00) contains an example Exit. The code uses several global variables so it does not appear to be thread-safe. |
I checked the redbook...
http://publib-b.boulder.ibm.com/abstracts/sg245306.html?Open
...and the date is 1998. In those days it may well (someone correct me?) have been most common to run channels in single-threaded processes on *ix.
For a couple of releases now, MQ has had a much more sophisticated multi-threaded channel capability involving master (runmqlsr) and slave (amqrmppa) channel processes running about 60 threads per process. But AFAIK it is still possible to run single threaded channels - well I can see /opt/mqm/bin/runmqchl so I assume this is the case. |
|
Back to top |
|
 |
KeeferG |
Posted: Thu Jan 12, 2006 3:17 am Post subject: |
|
|
 Master
Joined: 15 Oct 2004 Posts: 215 Location: Basingstoke, UK
|
From the docs
Quote: |
MCATYPE
Specifies whether the message-channel-agent program should run as a thread or a process.
PROCESS
The message channel agent runs as a separate process
THREAD
The message channel agent runs as a separate thread
In situations where a threaded listener is required to service a large number of incoming requests, resources can become strained. In this case, you should use multiple listener processes and target incoming requests at specific listeners though the port number specified on the listener.
This parameter is valid only for channels with a channel type (CHLTYPE) of SDR, SVR, RQSTR, CLUSSDR, or CLUSRCVR. It is supported only on AIX, Compaq OpenVMS, HP-UX, Linux, OS/2 Warp, OS/400, Solaris, and Windows.
On z/OS it is supported only for channels with a channel type of CLUSRCVR. When specified in a CLUSRCVR definition, MCATYPE is used by a remote machine to determine the corresponding CLUSSDR definition.
|
_________________ Keith Guttridge
-----------------
Using MQ since 1995 |
|
Back to top |
|
 |
mvic |
Posted: Thu Jan 12, 2006 3:28 am Post subject: |
|
|
 Jedi
Joined: 09 Mar 2004 Posts: 2080
|
Quote: |
In situations where a threaded listener is required to service a large number of incoming requests, resources can become strained. In this case, you should use multiple listener processes and target incoming requests at specific listeners though the port number specified on the listener. |
Hmm, I would like to hear others' opinions here, but I think that is a bit out of date. MQ 5.3 and 6 have a much more scalable design, with master and slave channel responders, so that no single process ends up doing all the work for a given IP port.
Therefore no need, for the sake of scalability, to have multiple listeners on multiple IP ports for a single queue manager. |
|
Back to top |
|
 |
KeeferG |
Posted: Thu Jan 12, 2006 4:28 am Post subject: |
|
|
 Master
Joined: 15 Oct 2004 Posts: 215 Location: Basingstoke, UK
|
It does sound a bit out of date. As you point out, a lot of work has gone into the multi-threaded lisening processes.
The joys of cut and paste from the manuals.
In most cases mutlithreaded is fine however there are scenarios where single threaded is requried as in the case at my company _________________ Keith Guttridge
-----------------
Using MQ since 1995 |
|
Back to top |
|
 |
|