You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by as...@apache.org on 2002/01/18 03:11:32 UTC

cvs commit: jakarta-turbine-stratum/src/conf cache2.ccf cache.ccf

asmuts      02/01/17 18:11:32

  Modified:    src/java/org/apache/stratum/jcs/access TestCacheAccess.java
               src/java/org/apache/stratum/jcs/auxiliary/lateral/socket/tcp
                        LateralCacheTCPListener.java
               src/conf cache2.ccf cache.ccf
  Log:
  Added teh ability to switch between caches in the tester interface.  If you start the tester and tester 2 you can switch 2 to move to testCache2.  i set up testCache2 to use the TCP lateral distribution.  It is very fast.  If you don't want a centralized remote, say if you have only 2 front end servers, then the TCP distribution would be a good choice.
  
  It is also good if you have some background processes that need to expire data on the webservers.
  
  I'm thinging about ading a get to the TCP lateral cache.  This is a major change.  Multiple lateral caches would result in several failures.  We could specify a maximium number of gets, a maximum time to search (requires some sophisticated monitoring), or some sort of simultaneous searching of multiple lateral caches (which may result in too much chatter).  The timeout seems best.  I'll look into it.
  
  TCP failover and recovery is working fine.  May need to add some timeout to the connect, so it won't block if a firewall allows incoming but not outgoing connection to the port.  This is always tricky.
  
  This is a very efficient means of keeping multiple caches in best-bet synchronization.
  
  I'm also thinking of creating a socket remote cache.
  
  Revision  Changes    Path
  1.6       +26 -1     jakarta-turbine-stratum/src/java/org/apache/stratum/jcs/access/TestCacheAccess.java
  
  Index: TestCacheAccess.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-stratum/src/java/org/apache/stratum/jcs/access/TestCacheAccess.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- TestCacheAccess.java	16 Jan 2002 17:04:47 -0000	1.5
  +++ TestCacheAccess.java	18 Jan 2002 02:11:32 -0000	1.6
  @@ -117,7 +117,7 @@
                   // start the local cache witht he appropriate props file
                   GroupCacheManagerFactory.getInstance( args[0] );
   
  -                cache_control = GroupCacheAccess.getGroupAccess( "testCache" );
  +                cache_control = GroupCacheAccess.getGroupAccess( "testCache1" );
   
                   // not necessary if you don't set default element attributes
                   try
  @@ -595,6 +595,30 @@
                               p( "---cloned attr " + num + " in " + String.valueOf( n_end - n_start ) + " millis ---" );
                           }
                       }
  +                    else
  +                        if ( message.startsWith( "switch" ) )
  +                    {
  +                        String numS = message.substring( message.indexOf( " " ) + 1, message.length() );
  +                        try {
  +                        int num = Integer.parseInt( numS.trim() );
  +                        }
  +                        catch ( Exception e )
  +                        {
  +                          p( "usage: switch number" );
  +                          p( "  1 == testCache1" );
  +                        }
  +                        if ( numS == null )
  +                        {
  +                          p( "usage: switch number" );
  +                          p( "  1 == testCache1" );
  +                        }
  +                        else
  +                        {
  +                             cache_control = GroupCacheAccess.getGroupAccess( "testCache" + numS );
  +                             p( "switched to cache = " + "testCache" + numS );
  +                             p( cache_control.toString() );
  +                        }
  +                    }
                   }
   
               }
  @@ -649,6 +673,7 @@
           p( "type 'stats' to get stats" );
           p( "type 'cloneattr num' to clone attr" );
           p( "type 'removeLateralDirect key' to remove lateral" );
  +        p( "type 'switch number' to switch to testCache[number], 1 == testCache1" );
           p( "type 'help' for commands" );
   
       }
  
  
  
  1.4       +5 -4      jakarta-turbine-stratum/src/java/org/apache/stratum/jcs/auxiliary/lateral/socket/tcp/LateralCacheTCPListener.java
  
  Index: LateralCacheTCPListener.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-stratum/src/java/org/apache/stratum/jcs/auxiliary/lateral/socket/tcp/LateralCacheTCPListener.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- LateralCacheTCPListener.java	15 Jan 2002 21:33:31 -0000	1.3
  +++ LateralCacheTCPListener.java	18 Jan 2002 02:11:32 -0000	1.4
  @@ -40,16 +40,17 @@
        *  Description of the Field
        */
       protected final static boolean debug = false;
  -    //true;
  +
       /**
        *  Description of the Field
        */
       protected final static boolean debugcmd = false;
  -    //true;
  +
       /**
        *  Description of the Field
        */
       protected static transient Logger log;
  +
       /**
        *  Description of the Field
        */
  @@ -191,7 +192,7 @@
           }
           getCacheManager();
           ICompositeCache cache = ( ICompositeCache ) cacheMgr.getCache( cb.getCacheName() );
  -        cache.update( cb, false );
  +        cache.update( cb, ICache.REMOTE_INVOKATION );
           //handleRemove(cb.getCacheName(), cb.getKey());
       }
   
  @@ -220,7 +221,7 @@
           // interface limitation here
   
           ICompositeCache cache = ( ICompositeCache ) cacheMgr.getCache( cacheName );
  -        cache.remove( key, cache.REMOTE_INVOKATION );
  +        cache.remove( key, ICache.REMOTE_INVOKATION );
       }
   
   
  
  
  
  1.3       +10 -5     jakarta-turbine-stratum/src/conf/cache2.ccf
  
  Index: cache2.ccf
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-stratum/src/conf/cache2.ccf,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- cache2.ccf	15 Jan 2002 17:59:03 -0000	1.2
  +++ cache2.ccf	18 Jan 2002 02:11:32 -0000	1.3
  @@ -15,10 +15,15 @@
   
   ##############################################################
   ################## CACHE REGIONS AVAILABLE ###################
  -jcs.region.testCache=DC,RC
  -jcs.region.testCache.cacheattributes=org.apache.stratum.jcs.engine.CompositeCacheAttributes
  -jcs.region.testCache.cacheattributes.MaxObjects=1000
  -jcs.region.testCache.cacheattributes.MemoryCacheName=org.apache.stratum.jcs.engine.memory.lru.LRUMemoryCache
  +jcs.region.testCache1=DC,RC
  +jcs.region.testCache1.cacheattributes=org.apache.stratum.jcs.engine.CompositeCacheAttributes
  +jcs.region.testCache1.cacheattributes.MaxObjects=1000
  +jcs.region.testCache1.cacheattributes.MemoryCacheName=org.apache.stratum.jcs.engine.memory.lru.LRUMemoryCache
  +
  +jcs.region.testCache2=DC,LTCP
  +jcs.region.testCache2.cacheattributes=org.apache.stratum.jcs.engine.CompositeCacheAttributes
  +jcs.region.testCache2.cacheattributes.MaxObjects=1000
  +jcs.region.testCache2.cacheattributes.MemoryCacheName=org.apache.stratum.jcs.engine.memory.lru.LRUMemoryCache
   
   # prefered config
   jcs.region.test2=DC
  @@ -58,7 +63,7 @@
   jcs.auxiliary.LTCP=org.apache.stratum.jcs.auxiliary.lateral.LateralCacheFactory
   jcs.auxiliary.LTCP.attributes=org.apache.stratum.jcs.auxiliary.lateral.LateralCacheAttributes
   jcs.auxiliary.LTCP.attributes.TransmissionTypeName=TCP
  -jcs.auxiliary.LTCP.attributes.TcpServers=10.17.1.154:1111
  +jcs.auxiliary.LTCP.attributes.TcpServers=localhost:1110
   jcs.auxiliary.LTCP.attributes.TcpListenerPort=1111
   
   jcs.auxiliary.LTCP2=org.apache.stratum.jcs.auxiliary.lateral.LateralCacheFactory
  
  
  
  1.4       +10 -5     jakarta-turbine-stratum/src/conf/cache.ccf
  
  Index: cache.ccf
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-stratum/src/conf/cache.ccf,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- cache.ccf	17 Jan 2002 00:19:37 -0000	1.3
  +++ cache.ccf	18 Jan 2002 02:11:32 -0000	1.4
  @@ -17,10 +17,15 @@
   ##############################################################
   ################## CACHE REGIONS AVAILABLE ###################
   # Regions preconfirgured for caching
  -jcs.region.testCache=DC,RFailover
  -jcs.region.testCache.cacheattributes=org.apache.stratum.jcs.engine.CompositeCacheAttributes
  -jcs.region.testCache.cacheattributes.MaxObjects=1000
  -jcs.region.testCache.cacheattributes.MemoryCacheName=org.apache.stratum.jcs.engine.memory.lru.LRUMemoryCache
  +jcs.region.testCache1=DC,RFailover
  +jcs.region.testCache1.cacheattributes=org.apache.stratum.jcs.engine.CompositeCacheAttributes
  +jcs.region.testCache1.cacheattributes.MaxObjects=1000
  +jcs.region.testCache1.cacheattributes.MemoryCacheName=org.apache.stratum.jcs.engine.memory.lru.LRUMemoryCache
  +
  +jcs.region.testCache2=DC,LTCP
  +jcs.region.testCache2.cacheattributes=org.apache.stratum.jcs.engine.CompositeCacheAttributes
  +jcs.region.testCache2.cacheattributes.MaxObjects=1000
  +jcs.region.testCache2.cacheattributes.MemoryCacheName=org.apache.stratum.jcs.engine.memory.lru.LRUMemoryCache
   
   # prefered config
   jcs.region.test2=DC,RFailover
  @@ -87,7 +92,7 @@
   jcs.auxiliary.LTCP.attributes=org.apache.stratum.jcs.auxiliary.lateral.LateralCacheAttributes
   jcs.auxiliary.LTCP.attributes.TransmissionTypeName=TCP
   jcs.auxiliary.LTCP.attributes.TcpServers=localhost:1111
  -jcs.auxiliary.LTCP.attributes.TcpListenerPort=1111
  +jcs.auxiliary.LTCP.attributes.TcpListenerPort=1110
   
   jcs.auxiliary.LTCP2=org.apache.stratum.jcs.auxiliary.lateral.LateralCacheFactory
   jcs.auxiliary.LTCP2.attributes=org.apache.stratum.jcs.auxiliary.lateral.LateralCacheAttributes
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: cvs commit: jakarta-turbine-stratum/src/conf cache2.ccf cache.ccf

Posted by Jon Scott Stevens <jo...@latchkey.com>.
on 1/17/02 6:11 PM, "asmuts@apache.org" <as...@apache.org> wrote:

> +                    else
> +                        if ( message.startsWith( "switch" ) )
> +                    {
> +                        String numS = message.substring( message.indexOf( " "
> ) + 1, message.length() );
> +                        try {
> +                        int num = Integer.parseInt( numS.trim() );
> +                        }
> +                        catch ( Exception e )
> +                        {
> +                          p( "usage: switch number" );
> +                          p( "  1 == testCache1" );
> +                        }
> +                        if ( numS == null )
> +                        {
> +                          p( "usage: switch number" );
> +                          p( "  1 == testCache1" );
> +                        }
> +                        else
> +                        {
> +                             cache_control = GroupCacheAccess.getGroupAccess(
> "testCache" + numS );
> +                             p( "switched to cache = " + "testCache" + numS
> );
> +                             p( cache_control.toString() );
> +                        }
> +                    }

Formatting.

-jon

-- 
Standard rules apply: Ask any questions, and you get the job. ;-)


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>