JCS: How to access cache in two different applications running in same server - jcs

jcs: I have two applications running in Glassfish. How do I retrieve cache stored in one application to another application

You could use a shared auxiliary region cache (disk, jdbc, lateral) with the same coordinates (configs).
Cache elements from application A will be available on application B when you check it or get it from shared cache.
http://commons.apache.org/proper/commons-jcs/JCSPlugins.html

Related

how to directly access appfabric cache without proxy?

Start to learn and use appfabric cache.
From the whitepaper, http://msdn.microsoft.com/en-us/library/gg186017%28v=azure.10%29.aspx, it says:
Bulk get calls result in better network utilization.Direct cache access is much faster than proxies (ASP.NET, WCF).
I am not sure what this means. What is a proxy in appfabric world?
We do websites base on asp.net/mvc, so if we write some logic to access our abpfabric cluster, it will be called from asp.net/mvc code?
Many Thanks
If you look at the document refernced by that page it explains what is meant by caching:
In some cases, the cache client is wrapped and accessed via a proxy
with additional application or domain logic. Oftentimes, performance
of such applications is much different from the Windows Server
AppFabric Cache cluster itself. The goal of the tests in this category
is to show performance of a middle tier application with additional
logic and compare it with performance of direct access to the cache.
To accomplish the goal, a simple WCF application was implemented that
provided access to the cache and contained additional logic of
populating the cache from an external data source if the requested
object is not yet in the cache.
The document contains details on how this affected performance, but if you need more detail the source code used is available.
Using the DataCacheFactory (and/or AppFabric Session provider) from your MVC site will access the cache cluster directly, once you've granted access to the Application Pool user.

C++ InMemory Cache Library

we have an application which utilizes a UDP service , and observe that 75% of calls to this UDP service is repeated.
Hence would wish to apply an In-Memory Cache , so as to avoid the costly network call and improve the application's turn-around time.
Never used caching before , hence any pointers on suitable cache libraries in C++/Unix environ would greatly help.
Also would like to share this cache across multiple processes.
The cache is required to store key value pairs of string type.
Have a look at redis, it's a noSQL key-value database. Here you have an interactive tutorial. We use it in several of our applications successfully.
Gemfire (no relation) is a commercial distributed caching system. Servers are written in Java but native support exists for C++ (among others).

Synchronize Infinispan cache entries with database

I want to know whether I can use Infinispan for cached data synchronization with Oracle database. This is my scenario. I have two main applications. One is highly concurrent use app and the second is used as admin module. Since it is highly concurrent I want to reduce database connections (Load the entities into cache (read write enable) and use it from this place without calling database). But meantime I want to update database according to the cache changes because admin module is using database directly. Can that update process (cache to database) handle in entity level without involving application? Please let me know whether Infinispan supports this scenario or not. If supports please share ideas.
Yes, it is possible. Infinispan supports this use case.
This should be simple configuration "problem" only. All you need to use is properly configured CacheStore with passivation disabled. It will keep your cache (used by highly concurrent application) synchronized with database.
What does it exactly cause?
When passivation is disabled, whenever an element is modified, added
or removed, then that modification is persisted in the backend store
via the cache loader. There is no direct relationship between eviction
and cache loading. If you don't use eviction, what's in the persistent
store is basically a copy of what's in memory.
By memory is meant a cache here.
If you want to know even more about this and about other interesting options please see: https://docs.jboss.org/author/display/ISPN/Cache+Loaders+and+Stores#CacheLoadersandStores-cachepassivation
Maybe it's worth to consider aforementioned eviction. Whether to disable or enable it. It depends mainly on load generated by your highly concurrent application.
Actually, this only works when you use Infinispan in the same cluster for the admin module. If you load A in memory with Infinispan, change A to something else in the database directly with the admin module, then Infinispan will not know A has been updated.

AppFabric localcache

I am using AppFabric caching in one of my projects. I understand that the cache can be made available server only or it can have a local version as well (I assume this is done by instantiating the DataCacheLocalCacheProperties class and assign this to the DataCacheFactoryConfiguration's properties) - please correct me if I am wrong. I also assume that if a Get is done when a localcache is enabled, the object will be retrieved from the cache server if it is not available locally.
But, what is the case of a Put? When I have a localcache enabled, a Put that I do will update the cache server for the specified key? If yes, then how will this value be reflected in the localcache? Or, it just updates the localcache?
Thanks in advance!
Joeseph,
Yes you can use local cache to store objects in-memory at the client. Local caching is generally used to stored objects that don't change frequently. The helps with the latency costs associated with the round trip to the cache server(s).
Now coming back to your questions:-
1- You can initiate local client cache with xml configuration as well. http://msdn.microsoft.com/en-us/library/ee790880.aspx
2- When you do a Get if the cache item is not available in the local cache then it is fetched from the Cache Server(s).
3- Put always goes to the Cache Server(s).
4- Local Cache has "sync" properties that allow it to be synced with the server cache either through a) a 'timeout' value (such that once the ttl expires the object will be updated based on the server cache) or
b) Cache notifications (such that the clients are notified everytime the cache is updated on the sever) - visit http://msdn.microsoft.com/en-us/library/ee808091.aspx for more details.
HTH.
cheers,
//hr/
http://www.hammadrajjoub.net
Well AppFabrics local cache may have problems when an application updates the main cache server and if the updated items copy resides on a local cache for another application then that copy is essentially stale and needs to be evicted. I think AppFabric requires the client application to have its local cache synchronized with the main cache. This is not feasible most of the times. NCache is one of those caching products that keeps the "client" or local caches synchronized with the main cache at all times. For more information please read this:
http://www.alachisoft.com/ncache/

Is it a bad idea for multiple ColdFusion applications to use the same client variable store?

We have two ColdFusion applications that share a common database. There are three instances of each application. (One instance of each application runs on each of three servers.)
I can see that the three instances of a given application should share a client variable store. (Load-balancing can cause a single user session to bounce between the three instances.) My question is: Is there any danger to having all instances of both applications share the same data store? Or should only one application be pointing at a given data store?
You can use the same client data store. The CDATA table has an 'app' column that stores the coldfusion application name. That column will keep your data unique to each application.
I'm working at an enterprise level ColdFusion shop with multiple CF applications running on the same server that are all pointed at the same client variable store. The only concern within the organization is how the client variable store affects regular backups, and that falls under the data team's purview. We don't have any problems with the different apps actually using the same client variable storage.
Related, from the ColdFusion documentation:
Some browsers allow only 20 cookies to
be set from a particular host.
ColdFusion uses two of these cookies
for the CFID and CFToken identifiers,
and also creates a cookie named
cfglobals to hold global data about
the client, such as HitCount,
TimeCreated, and LastVisit. This
limits you to 17 unique applications
per client-host pair.
I guess this deals more with how many applications you actually run rather than whether you have them all share the same client data store, but it does suggest that there may be some kind of hard limit on the total number of apps you can run at once, although I'd recommend splitting across hosts (or just using a different domain name) if you're planning on more than 16 apps!
As Eric stated above, running multiple apps off of one datasource is fine. What I would warn you is that these databases can fill up fast if you're not careful to block spiders and search engines from using them. Because CF creates client variables on each request for a new session, a search engine will get a new one every time because it never sends its old credentials/cookies so CF thinks it's a new user who needs a new client variable set. Also, be absolutely certain to check "Disable global client variable updates" in CF admin. This will save you a lot of unnecessary overhead.
I would think that multiple applications sharing the same data store would open up the possibility of users from one application having access to the other applications. While it may not be likely, the possibility could exist. (I don't have any facts to back that up, it just seems like a logical conclusion).
The question is, are you comfortable with that possibility, or do you have to absolutely make sure each application is secure?