Distributed cache with WSO2 cep engine - wso2

General info:
Using tomcat server7.0 with JDK1.7
I have two servers, and I'm using Hazlecat version 3.0 for caching.
My problem is with CEP engine. Using WSO2 engine
I added the following to my pom.xml:
<dependency>
<groupId>org.wso2.siddhi</groupId>
<artifactId>siddhi-api</artifactId>
<version>2.1.0-wso2v1</version>
</dependency>
<dependency>
<groupId>org.wso2.siddhi</groupId>
<artifactId>siddhi-core</artifactId>
<version>2.1.0-wso2v1</version>
</dependency>
<dependency>
<groupId>org.wso2.siddhi</groupId>
<artifactId>siddhi-query</artifactId>
<version>2.1.0-wso2v1</version>
</dependency>
I set siddhiConfig to DistributedProcessing(true) + set the instanceIdentifier to have the same id of my HazelcastInstance.
Each one of the server has one instance of siddihiManager.
My question is, does the 2 server read from/write to the same cache?
I saw in other places that there is a need to sync between the two servers. Any idea how?
Thanks

When you enable distributed processing in WSO2 CEP(not Siddhi) 310 it will use embedded Hazelcast instances to share events between instances and have a shared state. But due to severe performance issues this approach is discouraged and discontinued in the new WSO2 CEP release.
In the new CEP 4.0.0, Apache Storm is used to handle distributed processing. You can refer this sample and guide on how it is done.
Hope this help even though I did not directly address your initial issue.

Related

Apache Camel FTP Client Concurrency

I'm having a problem.
I have an application that I'm deploying twice in two different servers, this application uses the ftp component:
<from uri="ftp://..." />
As I'm deploying it twice (Like this) I'm having concurrency and some files in FTP server are being processed twice or are throwing exceptions (FileNotFoundException) when the other Node process it first.
Is there any solution for this?
Thx.
Yes you can look at setting up those FTP routes in master/slave mode, so only one of them is active at any time. Or you can use a shared idempotent repository as a "lock" so they can only grab a file if they can get an exclusive lock from that repo.
Its covered in the Camel in Action book chapter 17, and chapter 12 as well.
And you can find some details on the Camel website, however not as good docs as the book.

Deploy multiple webapps in parallel with Jetty 9.4.x

This web page suggests its possible to deploy webapps in parallel, using this function:
HandlerList handlerList = createHandlerList(...);
handlerList.setParallelStart(true);
I can't find anything similar in Jetty 9.4.x and Google seems to return little either.
How can I do this with the latest Jetty?
Parallel startup of Handler Collections were removed in...
Jetty 7.6.13.v20130916
Jetty 8.1.14.v20131031
Jetty 9.0.0.v20130308
.. as it was known to cause problems with LifeCycle startup.
The original reason for the parallel start was to improve startup performance.
Since Jetty 9.2.2.v20140723, the jetty-quickstart concepts were introduced that allows for a compile time scan of the webapp that produces a WEB-INF/quickstart-web.xml which allows for static load of the webapp (no bytecode scanning, no annotation scanning, no discovery of the Servlet spec components occur).

JMX monitoring/statistics in Akka application

Are there any built in JMX exposed monitoring/statistics that can be enabled in Akka (Java), besides the Cluster MBean? I have looked at Typesafe Console, but since it requires a license to be used with collecting data from multiple nodes, I was hoping to be able to achieve the same with plain JMX. I have checked the Akka documentation without any luck on this topic.
No - the Cluster JMX support is it.
There are a couple of projects aimed at collecting data from Akka. Both are at very early stages at this point but the code could be a starting point for you.
Eigengo Monitor - http://www.cakesolutions.net/teamblogs/2013/11/01/monitoring-akka/
Kamon - http://kamon.io/
Both are using AspectJ to get the data out of Akka.
Typesafe Console is free to use in non-Production environments, if that works for you.
Try this. I did a pull request with the necessary functionality to Kamon.
After the release of this version (after 0.5.1), all you will need to do to make jmx work - you need to add the module kamon-jmx to project and activate it autostart on configuration.

WSO2 ESB Clustering concept

I am new to WSO2 ESB clustering, actually I'm still learning about it. I still don't understand the concept here.
In my case, I installed WSO2 ESB on 2 servers. My questions are:
1. Were both of the WSO2 ESB working as one application or as two separate applications?
2. If I configure one WSO2 ESB, will the other ESB have the same configuration?
3. If I configure a VFS proxy service the ESB to poll a file from specific directory, will it create a conflict when I poll a file? I think that both of the ESB will poll the same file.
Please enlighten me :) Thanks...
Check my answers inline.
Were both of the WSO2 ESB working as one application or as two separate applications?
In any cluster, applications or servers are working together to provide a high availability to the end users. It will work as one single server (application).
If I configure one WSO2 ESB, will the other ESB have the same configuration?
Yes. You can achieve this with the deployment synchronization. It will make sure all your changes are evenly distributed among other nodes of the cluster.
If I configure a VFS proxy service the ESB to poll a file from specific directory, will it create a conflict when I poll a file? I think that both of the ESB will poll the same file.
No. Since only one server is active at once. This should not be a problem.
You can learn more from the following link:
http://docs.wso2.org/display/CLUSTER420/Clustering+WSO2+Products
Were both of the WSO2 ESB working as one application or as two separate applications?
No, both ESBs are separate applications. The clustering is done mainly to ensure availability and scalability. So even a member in a cluster fails, others continue to operate.
If I configure one WSO2 ESB, will the other ESB have the same configuration?
Each ESB can get the same cluster configuration, but each will be separately identified by the LB that is fronting the cluster. Therefore, each member will get different IP addresses and even they can use different member-port to create cluster.
If I configure a VFS proxy service the ESB to poll a file from specific directory, will it create a conflict when I poll a file? I think that both of the ESB will poll the same file.
Each request is independently handled by separate ESB depending on the load balancer algorithm of the fronting LB. When two threads poll the same file, there can be conflicts. Since VFS transport deals with file operations, there are certain times that these can fail due to unavailability of some resources. In such a case, VFS transport is equipped with the following fault handling mechanism.
If you point the same directory in a clustered environment, both proxy services will try to poll files and cause issues. Therefore if you want to poll files in a clustered environment, best practice is to use inbound endpoints [1]. But if it is necessary to use proxy services you can apply the following property in your proxy, so that the proxy service will only operate in one server. Thus there will not be any conflicts between the two proxy services. Please refer [2] to further clarify this.
<parameter name="transport.vfs.ClusterAware">true</parameter>
[1]-https://docs.wso2.com/display/EI620/File+Inbound+Protocol
[2]-https://docs.wso2.com/display/ESB500/VFS+Transport

Developing supporting services for a webservice

How to develop supporting services for a webservice to monitor the performance of the service and to diagnose the services by means of monitoring the users, memory, database etc.,
Please provide some pointers for developing such services.
Thanks,
Velmurugan R
You should take a look at JMX / MBeans. Mbeans can be used to read attributes from a running system in a standardized way. Or to invoke operations. With JConsole (distributed with Oracle JDK) you can connect to a running JVM and check out all existing MBeans.
http://docs.oracle.com/javase/tutorial/jmx/mbeans/standard.html