|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Using of Shared Variable |
« View previous topic :: View next topic » |
Author |
Message
|
Gaya3 |
Posted: Fri Apr 11, 2008 5:30 am Post subject: Using of Shared Variable |
|
|
 Jedi
Joined: 12 Sep 2006 Posts: 2493 Location: Boston, US
|
Hi All,
Using of shared variable, impacts the performance or what? please cover this
I am having 22 message flow, thought of using Shared varibale.
If its running in multiple threads, i believe it will create some issues to my flow.
How about using mutex variable or straight away using ESQL in a different approach?
Regards
Gayathri _________________ Regards
Gayathri
-----------------------------------------------
Do Something Before you Die |
|
Back to top |
|
 |
jefflowrey |
Posted: Fri Apr 11, 2008 5:39 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
what do you mean, affect the performance?
The only way it would affect the performance is if you are using atomic and have to wait for the lock.
But you'd only do that when you need to update the variable... and presumably you won't be doing that *a lot* simultaneously... ? Even then, contention should be rare.
And likely the performance hit of doing this using a database is going to be larger than the contention you'll see with an atomic block.
There isn't a "mutex" variable in ESQL, other than BEGIN ATOMIC. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
Gaya3 |
Posted: Fri Apr 11, 2008 5:48 am Post subject: |
|
|
 Jedi
Joined: 12 Sep 2006 Posts: 2493 Location: Boston, US
|
ok , thanks jeff,
Assume i am using a shared variable (share_var) for more than 25 to 30 flows. Say I am using this for a condition checking?
what could be the impact,
does this will be updated by some other flow and make strange issues to another flow using the shared variable.
Assume i am using different shared variable across all flows, then it will be polluted much.
How do you rate these two.
Regards
Gayathri _________________ Regards
Gayathri
-----------------------------------------------
Do Something Before you Die |
|
Back to top |
|
 |
jefflowrey |
Posted: Fri Apr 11, 2008 5:59 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Shared variables perform the same as regular variables, afaik. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
smdavies99 |
Posted: Fri Apr 11, 2008 10:58 am Post subject: Experience of using shared variables. |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
I used them on a project in London that has been processing messages on a daily basis for over a year. It has been benchmarked at up to approx 260,000 messages per hour of quite complex XML.
The flow that does all the work has up to 5 additional instances. All the flows use a set of shared variables to improve performance and also to allow the different instances to update counts etc again for performance.
I treated the use of shared variables and the use of the ATOMIC structure much like ow I used to write interrupt level code for OpenVMS Device Drivers many years ago.
The rule is to spend as little a time as possible inside an ATOMIC structure.
For example, If you want to update a message count then
Begin ATOMIC
Count = count + 1;
End ATOMIC
will ensure that the count is always accurate.
Then we used a Timer node to start a thread at a timed interval to get the current count and update a database table with the new count.
Begin Atomic
set save_count = count;
set count = 0;
End Atomic;
Update table set count = count + save_count;
Shows simply how we did it.
We also used shared vairables to improve performance on some table reads where every instance was going to read the same row in the table. For example, a table of static data.
This was read by the same times thread and the shared values updated.
On the same Hardware, the performance of the flow went from 22 messages per second to over 50 per second when we started useing shared variables as DB and other locking contention was reduced.
I hope this information from a real world example will help you design your flow(s) _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
Gaya3 |
Posted: Fri Apr 11, 2008 8:59 pm Post subject: |
|
|
 Jedi
Joined: 12 Sep 2006 Posts: 2493 Location: Boston, US
|
Good information to me, smdavies99 Really thanks
Regards
Gayathri _________________ Regards
Gayathri
-----------------------------------------------
Do Something Before you Die |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|