Author |
Message
|
ajith_company |
Posted: Wed May 30, 2012 12:42 am Post subject: Cache node over shared variable |
|
|
Newbie
Joined: 30 May 2012 Posts: 3
|
What is the advantage of cache node over shared variable? |
|
Back to top |
|
 |
mqjeff |
Posted: Wed May 30, 2012 2:33 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
The cache node can share data between execution groups. |
|
Back to top |
|
 |
lancelotlinc |
Posted: Wed May 30, 2012 5:53 am Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
The cache node uses a Singleton and queues internally to share data. If you are an experienced Java programmer, you can use a Singleton directly and avoid the overhead of using queues to store cache data. _________________ http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER |
|
Back to top |
|
 |
Esa |
Posted: Wed May 30, 2012 6:07 am Post subject: |
|
|
 Grand Master
Joined: 22 May 2008 Posts: 1387 Location: Finland
|
lancelotlinc wrote: |
The cache node uses a Singleton and queues internally to share data. If you are an experienced Java programmer, you can use a Singleton directly and avoid the overhead of using queues to store cache data. |
And then you cannot share data between execution groups.
But with shared variables you can only share data within one flow file in one execution group. |
|
Back to top |
|
 |
lancelotlinc |
Posted: Wed May 30, 2012 6:10 am Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
Esa wrote: |
lancelotlinc wrote: |
The cache node uses a Singleton and queues internally to share data. If you are an experienced Java programmer, you can use a Singleton directly and avoid the overhead of using queues to store cache data. |
And then you cannot share data between execution groups.
But with shared variables you can only share data within one flow file in one execution group. |
We use a Singleton, and we share data between EGs. Why cannot you? _________________ http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER |
|
Back to top |
|
 |
Esa |
Posted: Wed May 30, 2012 6:15 am Post subject: |
|
|
 Grand Master
Joined: 22 May 2008 Posts: 1387 Location: Finland
|
lancelotlinc wrote: |
Esa wrote: |
lancelotlinc wrote: |
The cache node uses a Singleton and queues internally to share data. If you are an experienced Java programmer, you can use a Singleton directly and avoid the overhead of using queues to store cache data. |
And then you cannot share data between execution groups.
But with shared variables you can only share data within one flow file in one execution group. |
We use a Singleton, and we share data between EGs. Why cannot you? |
Well, it has never crossed my mind to share a Singleton across JVM's. I must admit that I thought it's not possible. |
|
Back to top |
|
 |
lancelotlinc |
Posted: Wed May 30, 2012 6:17 am Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
Esa wrote: |
lancelotlinc wrote: |
Esa wrote: |
lancelotlinc wrote: |
The cache node uses a Singleton and queues internally to share data. If you are an experienced Java programmer, you can use a Singleton directly and avoid the overhead of using queues to store cache data. |
And then you cannot share data between execution groups.
But with shared variables you can only share data within one flow file in one execution group. |
We use a Singleton, and we share data between EGs. Why cannot you? |
Well, it has never crossed my mind to share a Singleton across JVM's. I must admit that I thought it's not possible. |
You have never created any application that used inter-process communication? You've never used mutexes, or semaphores? Named-pipes? _________________ http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER |
|
Back to top |
|
 |
mqjeff |
Posted: Wed May 30, 2012 6:25 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
The use of a Singleton does not provide any automatic mechanism that requires no programming to provide data that is available in more than one DFE.
The use of ESQL shared variables or of Java static variables does not provide any automatic mechanism that requires no programming to provide data that is available in more than one DFE.
The use of the Cache node supportPac allows for an administrative configuration, that can be made after development is complete, that provides data that is available in more than one DFE without any additional programming.
That is the advantage of the Cache node supportPac. |
|
Back to top |
|
 |
Esa |
Posted: Wed May 30, 2012 6:26 am Post subject: |
|
|
 Grand Master
Joined: 22 May 2008 Posts: 1387 Location: Finland
|
lancelotlinc wrote: |
You have never created any application that used inter-process communication? You've never used mutexes, or semaphores? Named-pipes? |
I haven't needed to.
I guess your Singleton lives outside the broker. Do you share data accross brokers, too? |
|
Back to top |
|
 |
lancelotlinc |
Posted: Wed May 30, 2012 6:28 am Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
Very well stated, mqjeff. The support pak provides a way to cache data through administrative configuration. I like your synopsis. _________________ http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER |
|
Back to top |
|
 |
lancelotlinc |
Posted: Wed May 30, 2012 6:31 am Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
Esa wrote: |
lancelotlinc wrote: |
You have never created any application that used inter-process communication? You've never used mutexes, or semaphores? Named-pipes? |
I haven't needed to.
I guess your Singleton lives outside the broker. Do you share data accross brokers, too? |
The inter-process communication mechanism has no restrictions on boundaries, as long as you can access the interface through TCP/IP. We use JMX managed beans as cache objects, which can also be browsed by an adminstrator as cache data is being held, using either a standard web browser or jconsole, which ever suits your taste. _________________ http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER |
|
Back to top |
|
 |
rekarm01 |
Posted: Wed May 30, 2012 11:51 pm Post subject: Re: Cache node over shared variable |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 1415
|
lancelotlinc wrote: |
We use a Singleton, and we share data between EGs. |
A Singleton? It seems like it would require more than one.
In this case, what is the advantage of singletons, over static class methods/variables? |
|
Back to top |
|
 |
Esa |
Posted: Thu May 31, 2012 12:01 am Post subject: Re: Cache node over shared variable |
|
|
 Grand Master
Joined: 22 May 2008 Posts: 1387 Location: Finland
|
rekarm01 wrote: |
A Singleton? It seems like it would require more than one. |
This has been discussed above...
rekarm01 wrote: |
In this case, what is the advantage of singletons, over static class methods/variables? |
A singleton is just a pattern for synchronizing access to the (cache) object to make sure that everyone is accessing the same object and that only one thread at a time is allowed to update it. A standard way of using static varibles/methods for a certain purpose. |
|
Back to top |
|
 |
mqjeff |
Posted: Thu May 31, 2012 1:24 am Post subject: Re: Cache node over shared variable |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Esa wrote: |
rekarm01 wrote: |
In this case, what is the advantage of singletons, over static class methods/variables? |
A singleton is just a pattern for synchronizing access to the (cache) object to make sure that everyone is accessing the same object and that only one thread at a time is allowed to update it. A standard way of using static varibles/methods for a certain purpose. |
An ESQL shared variable wrapped in method calls that enforce BEGIN ATOMIC probably counts as a Singleton. |
|
Back to top |
|
 |
Esa |
Posted: Thu May 31, 2012 1:27 am Post subject: Re: Cache node over shared variable |
|
|
 Grand Master
Joined: 22 May 2008 Posts: 1387 Location: Finland
|
mqjeff wrote: |
An ESQL shared variable wrapped in method calls that enforce BEGIN ATOMIC probably counts as a Singleton. |
The only major difference being a more limited scope. |
|
Back to top |
|
 |
|