I would love to call it a Hub and Spoke architecture. Its pretty common to have enterprise applications grow in a way that numerous applications spring up that work and share only a subset of domain objects of a "Big Daddy" application. For example a central application that does Order management and creates Shipments. Other application only works on Shipment details and other may be doing an analytic on the Products sold. With Toplink it is fairly simple to do so and the trick is to partition the application in multiple independent units and map it with their respective data model accordingly. Toplink session allows to have multiple projects. Click on the Session and General tab, select Multiple Projects checkbox and provide the name of the primary toplink project (In our example that would be Order).
Select Multiple Projects tab and click the Add button. Select other components of the application, in our example it would be Shipment. Repeat the process for each component of the application.
Then create another Toplink session (Either in the same sessions.xml or multiple sessions_xxx.xml files) for each individual components. The following image shows the Shipment project:
And repeat for each individual applications. Deploy the Big application and then other "spoke" applications. One more important thing.. Make sure they all share the same Cache Coordination configuration. If using RMI same multicast address and port and their each individual Registry Naming Services.
And thats pretty much it you need. Toplink, Cache Coordination and judiciously partitioning the application to individual components can achieve a true hub-n-spoke enterprise application. For a sample project download it from: Sample Toplink Project
Wednesday, February 25, 2009
Toplink MultiProjects with Cache Coordination
Posted by Ashish at 7:35 PM 0 comments
Labels: toplink
Sunday, February 22, 2009
Why I would not vote for BJP
I have voted for BJP since after Rajiv Gandhi's first term. One reason being I am from Lucknow and Atal B. Vajpayee was good enough reason to believe in a party "with a difference". Along the line I continued to believe in what they had to say. Common civil code, strict action against terrorism, strong Swadeshi movement and yes Ram temple. While they were in power I also liked some of their policies like Interconnecting Indian rivers to address flood and famine problems and bringing India to the select club of Nuclear nations. Being from UP I also liked Kalyan Singh's term as a Chief Minister and his relative cleaner and non-corrupt image. In last decade things have changed. Atal has retired and is not active in politics or even sidelined. Kalyan has left BJP and has dragged himself into the same pity politics that I found him against of. And after a decade India is young again. If I vote this year following are five reasons why I would not vote for BJP:
- Advani does not represent young India. He seems running for PM@81 to fulfill his dream rather to give the nation a new leadership.
- BJP is responsible to release dreaded terrorists like Masood Azhar. Time tests the tough and BJP failed miserably.
- State's response to unapologetic Godhara massacre by Muslim fanatics was equally terrible, sad and unjustifiable. The incident was the beginning of BJP's downfall.
- There are no committed national level second generation leaders in BJP.
- They rake Ram Temple issue to get to the power. They are neither committed nor capable to achieve it.
Posted by Ashish at 5:28 PM 3 comments
Labels: Indian politics
Saturday, February 21, 2009
Using Cache Coordination with Toplink
Most of my consulting engagements revolve around two products - Oracle Coherence and Oracle Toplink. While both have Caching component and caching in a distributed environment they are complementary and are built for two entire different purposes. Coherence is built for massive scalability for humongous amount of in memory data while Toplink is for persistence and can pretty much map any domain model with any data model. So the moment you find yourself in a situation where multiple applications need to share the same set of objects or need to be notified of changes in one application to another, a quick call with Oracle Professional services might help. One feature of Toplink that gets a little not so talked about is its ability to coordinate caches across multiple Toplink sessions. If your application is Toplink API driven and requires up to 500/600MB of in memory data some huge performance gains can be achieved using its Cache Coordination. During a recent project I got myself into some challenges while migrating a Toplink9g project and I hope this blog helps for future references.
- Cache Synchronization is now called Cache Coordination.
- Cache Coordination uses RCM and the old synchronization mechanism has been deprecated.
- Do not rely completely on Toplink10g workbench for creating sessions.xml
- Migrate to Toplink11g and it's workbench - It will make life much easier.
- If migrating 9g to 10g, 10g will work with the 9g's sessions.xml. 10g cache coordination configuration could be a challenge.
- Cache coordination is meant for mostly read-only and a low writes.
- If requirement is heavy object mutation across multiple instances or heterogeneous applications, consider Coherence.
- A sample setting for Cache Coordination using RMI
- Type: RMI
- Channel: ToplinkCommandChannel
- Multicast Group Address: 237.14.12.12
- Multicast Port: 25000
- Packet Time to Live: 2
- Announcement Delay: 1000
- Select Remove Connection on Error
- Select Synchronous
- URL for Registry Naming Service: rmi://$HOST:1099
- Starting rmiregistry
- rmiregistry.exe -J-Djava.class.path="classes;toplink.jar" -J-Djava.rmi.server.logCalls=true -J-Dsun.rmi.server.logLevel=VERBOSE -J-Dsun.rmi.client.logCalls
- Following is a simple sample sessions.xml
<?xml version="1.0" encoding="UTF-8"?>
<toplink-sessions version="11g (11.1.1.0.0)"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<session xsi:type="server-session">
<name>Session</name>
<remote-command>
<commands>
<cache-sync>true</cache-sync>
</commands>
<transport xsi:type="rmi-transport">
<send-mode>Synchronous</send-mode>
<discovery>
<multicast-group-address>
237.12.14.12
</multicast-group-address>
<multicast-port>25000</multicast-port>
<announcement-delay>2000</announcement-delay>
</discovery>
<rmi-registry-naming-service>
<url>rmi://$HOST:1099</url>
</rmi-registry-naming-service>
</transport>
</remote-command>
<event-listener-classes/>
<profiler>toplink</profiler>
<logging xsi:type="toplink-log">
<log-level>all</log-level>
</logging>
<primary-project xsi:type="xml">ToplinkRI.xml</primary-project>
<login xsi:type="database-login">
<platform-class>
oracle.toplink.platform.database.oracle.Oracle10Platform
</platform-class>
<user-name>username</user-name>
<password>56F55BD62D7347611874F25952AA55F6</password>
<sequencing>
<default-sequence xsi:type="native-sequence">
<name>Native</name>
<preallocation-size>10</preallocation-size>
</default-sequence>
</sequencing>
<driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
<connection-url>
jdbc:oracle:thin:@localhost:1521:XE
</connection-url>
<cache-all-statements>true</cache-all-statements>
<struct-converters/>
</login>
<connection-pools>
<read-connection-pool>
<name>ReadConnectionPool</name>
</read-connection-pool>
<write-connection-pool>
<name>default</name>
</write-connection-pool>
</connection-pools>
<connection-policy/>
</session>
</toplink-sessions>
Posted by Ashish at 3:42 PM 11 comments
Monday, February 16, 2009
Why would Congress win next elections
- When no one is better, advantage goes to the ruling party.
- BJP didn't walk its talk.
- Majority of Indians do not like Advani.
- Manmohan Singh Government has not done awfully bad.
- Modi says Reject dynastic parties but Its still better than leaderless Party.
- Congress appears more sincere.
- Regional parties help Congress.
- Who next is known in Congress. Others are either one man show or still battling.
- Its easier to form a UPA coalition than a NDA coalition.
- Less infighting with in Congress.
Posted by Ashish at 9:22 PM 0 comments
Labels: Indian politics
Wednesday, February 11, 2009
Issues and non issues of Distributed computing
By Distributed computing I refer to platforms, infrastructure or technology that involves multiple JVMs to perform a cohesive operation. So what are the core issues and non-issues before we select the right platform?
- NI: Moving object from one system (JVM) to another
- How compact is the object over the wire?
- NI: Synchronizing changes from one JVM to another
- How fast is the synchronization?
- How many JVMs to be synchronized?
- Is the synchronization synchronous or Async
- NI: Continuous Availability of the Application
- What state does the failure of one server leaves the data in?
- What happens to in-flight Transaction upon failure?
- What state is the persistence storage in?
- Upon recovery what happens to the new node?
- How is the past affecting the present for the recovered node?
- How is the user request handled after its submission and after the node's failure but before the processing completes?
- NI: Managing common state across multiple services
- Is that a single point of failure?
- What is the transaction isolation?
- NI: A feature list
- How extensible is it?
- Are the integration points well defined?
Posted by Ashish at 10:10 AM 0 comments
Tuesday, February 10, 2009
Sridhar Acharya Process
How to solve a polynomial equation like ax2+2abx+b2 = 0? Shridhar Acharya born in 800BC gave the following solution:
x = (-b ± (b2 - 4ac)1/2)/2, simple and straight forward.
Posted by Ashish at 9:30 AM 0 comments
Labels: math
Wednesday, February 04, 2009
Will this product work with Coherence?
If you happen to find yourself asking this question then ask yourself the following:
- Is your product written in Java, C++ or .NET?
- Can you bring application state out and put it in Coherence?
- Do you have an ability to make changes to the product code you are concerned about?
- Does your application use open spec whose implementation can be replaced and plugged in?
Posted by Ashish at 9:43 PM 0 comments
Labels: coherence
Sunday, February 01, 2009
JPA Annotations in Domain Model
Why I don't like them?
- It corrupts the domain object. Domain object doesn't have to know that it is meant for persistence to a relational database.
- Vis-a-vis Coherence, CacheStore that is meant to interact with an external data source is not necessarily meant for relational database. CacheStore could hook a database, a Directory server or even another Coherence cluster. @OneToOne has no sense if the external datasource is a Coherence cluster.
- Having a separate OR Mapping is much cleaner
Posted by Ashish at 2:22 PM 0 comments