I have an application deployed in Jboss AS 7 running on multiple nodes across different servers and I am trying to use infinispan 5.2 for caching data. The problem is that the cache value is not being replicated across different servers, it is accessible only from the same node.
The configuration used for caching is given here
<cache-container name="cluster" aliases="ha-partition" default-cache="cache" jndi-name="java:jboss/infinispan/container/cluster">
<transport lock-timeout="10000"/>
<distributed-cache name="cache" mode="SYNC" start="EAGER" batching="false">
<locking isolation="REPEATABLE_READ"/>
<eviction strategy="LIRS" max-entries="1000"/>
<expiration lifespan="300000" />
</distributed-cache>
</cache-container>
I have also tried using replicated-cache instead of distributed-cache.
The tag is defined in my web.xml.
I was with a problem like yours.
This article from Abhishek Mathur helped me to solve that.
I donĀ“t know what type of data do you want to replicate, I want to replicate http session and the article work for me.
Related
We currently have a 5-node infinispan server cluster running in production and it is able to handle up to 2 thousand requests per second. Our desire is to have the cache scale linearly, up 10x or more. In our stress tests, our app servers start getting SocketTimeoutExceptions from infinspan after 30 minutes under planned future load.
Our most active cache runs in distributed mode with 2 owners and 20 segments. One of the bottlenecks appear to be with our pub/sub system using the remote event listeners. Basically whenever a cache entry is modified, our remote event listeners get notified, who then in turn respond to long-polling requests. The remote event listeners are running in Java servlets on tomcat.
About a month ago, we ran into the issue found HERE
and after patching infinispan server with an increased event queue size (now at 1 million) we were able to scale up quite far, just not as much as we'd like.
In terms of actual errors on the server, what we see are things like:
ERROR [org.infinispan.interceptors.InvocationContextInterceptor] (pool-6-thread-1) ISPN000136: Error executing command RemoveExpiredCommand, writing keys [[B0x033e183537626430..[27]]: org.infinispan.util.concurrent.TimeoutExcepti
on: ISPN000299: Unable to acquire lock after 30 seconds for key [B0x033e183537626430..[27] and requestor CommandUUID{address=XYZ, id=851936}. Lock is held by CommandUUID{address=XYZ, id=851819}
And below is the cache config:
<subsystem xmlns="urn:infinispan:server:core:8.2" default-cache-container="clustered">
<cache-container name="clustered" default-cache="default" statistics="true">
<transport lock-timeout="60000" />
<distributed-cache name="default" mode="SYNC" segments="20" owners="2" remote-timeout="30000" start="EAGER">
<locking acquire-timeout="30000" concurrency-level="10000" striping="false"/>
<transaction mode="NONE"/>
<expiration lifespan="86400000" max-idle="900000" interval="60000"/>
<eviction strategy="LIRS" size="1000000"/>
</distributed-cache>
<distributed-cache name="gameStateCache" mode="SYNC" remote-timeout="30000" start="EAGER">
<locking acquire-timeout="30000" concurrency-level="10000" striping="false"/>
<expiration lifespan="86400000" max-idle="900000" interval="60000"/>
<eviction strategy="LIRS" size="1000000"/>
</distributed-cache>
</cache-container>
</subsystem>
Is anyone aware of high-load issues with the remote event listener system or perhaps suggest alternative configuration?
Cheers,
Brian
Does anybody know how to declare a datsource that can only be accessed via an ssl encrypted connection in wildfly?
In an existing client application this is done by declaring the connection URL accordingly (e.g. jdbc:hsqldb:hsqls://servername:4444/DBName) and adding a keystore with the certificate to the classpath.
I am new to wildfly and I could not find a possibility to declare a datasource accordingly in wildfly or a documentation how this could be done.
I am using ubuntu 14.04, wildfly 8.1 and java 8.
Any help would be really appreciated.
Best regards,
Lutz
You need just configure your database to support SSL and provide proper connection-url in datasource (and add certificate to keystore).
Here is mine example configuration to postgresl with SSL encrypted connection which I use:
<datasource jndi-name="java:jboss/datasources/dbname" pool-name="poolname">
<connection-url>jdbc:postgresql://serveraddress:5432/dbname?ssl=true</connection-url>
<driver-class>org.postgresql.Driver</driver-class>
<driver>postgresql-jdbc41</driver>
<security>
<user-name>user</user-name>
<password>password</password>
</security>
<validation>
<check-valid-connection-sql>SELECT 1</check-valid-connection-sql>
</validation>
</datasource>
<drivers>
<driver name="postgresql-jdbc41" module="org.postgres">
<driver-class>org.postgresql.Driver</driver-class>
</driver>
</drivers>
thanks for your feedback. Because I am currently working with a self signed certificate I had to add my certificate to the java keystore. After that it worked just fine. Saved my day :-) cheers, Lutz
We are using Infinispan for caching on Tomcat 7.0. We found that Infinispan making UDP requests for multicasting without JGroups and cluster configuration. We observed Infinispan jar itself contains jgroups-udp.xml. But we are not referring it no where. Is infinispan by default uses UDP protocol for multi/uni casting the messages?
The cache configuration file we used is here.
<infinispan
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:infinispan:config:5.3 http://www.infinispan.org/schemas/infinispan-config-5.3.xsd"
xmlns="urn:infinispan:config:5.3">
<global>
<globalJmxStatistics enabled="true"/>
</global>
<namedCache name="FORMS">
<jmxStatistics enabled="true"/>
<eviction strategy="LIRS" maxEntries="1000" />
<expiration lifespan="86400000" /><!-- Setting expiration to 1 day -->
</namedCache>
</infinispan>
I need to form a infinispan cluster in distributed mode. This cache is used for storing session data. Currently I am using tomcatInfinispanSessionManager developed by Manik from Jboss team.
I have created the infinispan xml in distributed mode and using two tomcats for testing. Using apache as a load balancer. Each machine has its own copy of infinispan cache entry. When any of the tomcat is shut down the session is retrieved from other infinispan cache.
My question is: how to make this cache entry into an infinispan server (either using hotrod/memcached) that is running on a separate machine?
If you add a remote cache loader to the cache configuration you have, it'll back up the data in a remote Hot Rod server, assuming you configure the IP:Port address of the Hot Rod server(s) correctly.
However, if you're trying to cluster your session data, I'd highly recommend you download JBoss EAP 6.1, which comes with Infinispan-based cluster-ready session data storage out of the box. The session cache can still be configured with a remote cache loader too, but the configuration will be slightly different since it uses JBoss EAP configuration format.
I am using ispn 5.1 version and started the server in hotrod mode. My cache config xml is as follows.
<?xml version="1.0" encoding="UTF-8"?>
<infinispan xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:infinispan:config:5.3 http://www.infinispan.org/schemas/infinispan-config-5.3.xsd
urn:infinispan:config:remote:5.3 http://www.infinispan.org/schemas/infinispan-cachestore-remote-config-5.3.xsd"
xmlns="urn:infinispan:config:5.3" xmlns:remote="urn:infinispan:config:remote:5.3">
<global>
<transport clusterName="tomcatSession">
<properties>
<property name="configurationFile"
value="E:/Software/apache-tomcat-7.0.34/conf/jgroups.xml">
</property>
</properties>
</transport>
<globalJmxStatistics enabled="true" />
</global>
<namedCache name="tc_session_ispn-sess-mgr">
<clustering mode="distribution">
<l1 enabled="true" lifespan="600000" />
</clustering>
<loaders>
<remoteStore xmlns="urn:infinispan:config:remote:5.3"
fetchPersistentState="false" ignoreModifications="false"
purgeOnStartup="false" remoteCache="myCache" rawValues="true">
<servers>
<server host="10.145.4.172" port="11222" />
</servers>
<connectionPool maxActive="10" exhaustedAction="CREATE_NEW" />
<async enabled="true" />
</remoteStore>
</loaders>
</namedCache>
</infinispan>
While using this cache config xml I am gettong the following exception
Exception in thread "main" org.infinispan.config.ConfigurationException: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[39,104]
Message: Unexpected element '{urn:infinispan:config:remote:5.3}remoteStore' encountered
at org.infinispan.configuration.parsing.Parser.parse(Parser.java:168)
at org.infinispan.configuration.parsing.Parser.parse(Parser.java:130)
at org.infinispan.manager.DefaultCacheManager.<init>(DefaultCacheManager.java:368)
at org.infinispan.manager.DefaultCacheManager.<init>(DefaultCacheManager.java:340)
at org.infinispan.manager.DefaultCacheManager.<init>(DefaultCacheManager.java:327)
Kindly correct me if I am wrong and suggest how to proceed further?
I'm looking for a solution similar to this:
httpOnly Session Cookie + Servlet 3.0 (e.g. Glassfish v3)
I want to turn the HTTP headers: http-only and Secure off so that authentication with https carries across to http requests.
However,
1 Relating to the other post. I am not using servlet 3.0. I may be willing to try to use servlet 3.0 if there was decent documentation somewhere on how to migrate an intellij project from serverl 2.5 to 3.0. It does not seem obvious how to use this. Changing my maven pom to javax.servlet 3.0 and then editing my web.xml version to 3.0 doesn't work. Gives a facet-error on the 3.0 version. Sigh.
This is my primary approach to solve this. I edited domains/domain1/config for default-web.xml and domain.xml to what I thought would work but it doesn't. Oracle's documentation does not seem very clear to me on this.
domain.xml
<web-container>
<session-config>
<session-manager>
<manager-properties></manager-properties>
<store-properties></store-properties>
</session-manager>
<session-properties>
<property name="cookieSecure" value="false"></property>
<property name="cookieHttpOnly" value="false"></property>
</session-properties>
</session-config>
</web-container>
....
<configs>
<config name="server-config">
<http-service sso-enabled="true">
<access-log></access-log>
<virtual-server id="server" sso-cookie-secure="false" sso-cookie-http-only="false" network-listeners="http-listener-1,http-listener-2"></virtual-server>
<virtual-server id="__asadmin" sso-cookie-http-only="false" network-listeners="admin-listener"></virtual-server>
</http-service>
default-web.xml
<session-config>
<session-timeout>60</session-timeout>
<cookie-config>
<http-only>false</http-only>
<secure>false</secure>
</cookie-config>
<cookie-properties>
<property name="cookieSecure" value="false" />
<property name="cookieHttpOnly" value="false" />
</cookie-properties>
<tracking-mode>COOKIE</tracking-mode>
</session-config>
Okay I feel a bit stupid but I generally have never written to a specific container before to make sure that my code was portable across containers. However, after some research, I discovered that you can put a WEB-INF/glassfish-web.xml file that looks like this to control your security cookie setting for each WAR file under glassfish.
http://blogs.oracle.com/jluehe/entry/ow_to_configure_the_security
<?xml version="1.0" encoding="UTF-8"?>
<glassfish-web-app>
<session-config>
<cookie-properties>
<b><property name="cookieSecure" value="[true|false|dynamic]"/></b>
</cookie-properties>
</session-config>
</glassfish-web-app>