[Checkins] SVN: relstorage/trunk/ Documented cache options and changed tests to disable themselves

Shane Hathaway shane at hathawaymix.org
Sun Oct 18 04:53:09 EDT 2009


Log message for revision 105126:
  Documented cache options and changed tests to disable themselves
  when the necessary database adapter can't be imported.
  

Changed:
  U   relstorage/trunk/README.txt
  U   relstorage/trunk/relstorage/component.xml
  U   relstorage/trunk/relstorage/options.py
  U   relstorage/trunk/relstorage/tests/testmysql.py
  U   relstorage/trunk/relstorage/tests/testoracle.py
  U   relstorage/trunk/relstorage/tests/testpostgresql.py

-=-
Modified: relstorage/trunk/README.txt
===================================================================
--- relstorage/trunk/README.txt	2009-10-18 04:41:53 UTC (rev 105125)
+++ relstorage/trunk/README.txt	2009-10-18 08:53:09 UTC (rev 105126)
@@ -393,29 +393,41 @@
         pack-duty-cycle.  The default is 20 seconds.
 
 ``cache-servers``
-        Specifies a list of memcache servers.  Enabling memcache integration
-        is useful if the connection to the relational database has high
-        latency and the connection to memcache has significantly lower
-        latency.  On the other hand, if the connection to the relational
-        database already has low latency, memcache integration may actually
-        hurt overall performance.
+        Specifies a list of memcached servers. Using memcached with
+        RelStorage improves the speed of frequent object accesses while
+        slightly reducing the speed of other operations.
 
         Provide a list of host:port pairs, separated by whitespace.
-        "127.0.0.1:11211" is a common setting.  The default is to disable
-        memcache integration.
+        "127.0.0.1:11211" is a common setting.  Some memcached modules,
+        such as pylibmc, allow you to specify a path to a Unix socket
+        instead of a host:port pair.
 
+        The default is to disable memcached integration.
+
 ``cache-module-name``
         Specifies which Python memcache module to use.  The default is
-        "memcache", a pure Python module.  There are several alternative
-        modules available through PyPI.  This setting has no effect unless
-        cache-servers is set.
+        "memcache", a pure Python module.  An alternative module is
+        "relstorage.pylibmc_wrapper".  This setting has no effect
+        unless cache-servers is set.
 
 ``cache-prefix``
         The prefix for all keys in the cache.  All clients using a
         database should use the same cache-prefix.  Use this if you use
         a single cache for multiple databases.
 
+``cache-local-mb``
+        RelStorage caches pickled objects in memory, similar to a ZEO
+        cache. This cache is shared between threads. This parameter
+        configures the approximate maximum amount of memory the cache
+        should consume, in megabytes.  It defaults to 10.
 
+``cache-delta-size-limit``
+        This is an advanced option. RelStorage uses a system of
+        checkpoints to achieve a high cache hit rate. This parameter
+        configures how many objects should be stored before creating a
+        new checkpoint. The default is 10000.
+
+
 Adapter Options
 ===============
 

Modified: relstorage/trunk/relstorage/component.xml
===================================================================
--- relstorage/trunk/relstorage/component.xml	2009-10-18 04:41:53 UTC (rev 105125)
+++ relstorage/trunk/relstorage/component.xml	2009-10-18 08:53:09 UTC (rev 105126)
@@ -152,23 +152,24 @@
     </key>
     <key name="cache-servers" datatype="string" required="no">
       <description>
-        Specifies a list of memcache servers.  Enabling memcache integration
-        is useful if the connection to the relational database has high
-        latency and the connection to memcache has significantly lower
-        latency.  On the other hand, if the connection to the relational
-        database already has low latency, memcache integration may actually
-        hurt overall performance.
+        Specifies a list of memcached servers. Using memcached with
+        RelStorage improves the speed of frequent object accesses while
+        slightly reducing the speed of other operations.
 
         Provide a list of host:port pairs, separated by whitespace.
-        "127.0.0.1:11211" is a common setting.  The default is to disable
-        memcache integration.
+        "127.0.0.1:11211" is a common setting.  Some memcached modules,
+        such as pylibmc, allow you to specify a path to a Unix socket
+        instead of a host:port pair.
+
+        The default is to disable memcached integration.
       </description>
     </key>
     <key name="cache-module-name" datatype="string" required="no">
       <description>
         Specifies which Python memcache module to use.  The default is
         "memcache", a pure Python module.  An alternative module is
-        "cmemcache".  This setting has no effect unless cache-servers is set.
+        "relstorage.pylibmc_wrapper".  This setting has no effect
+        unless cache-servers is set.
       </description>
     </key>
     <key name="cache-prefix" datatype="string" required="no">
@@ -178,6 +179,22 @@
         a single cache for multiple databases.
       </description>
     </key>
+    <key name="cache-local-mb" datatype="integer" required="no">
+      <description>
+        RelStorage caches pickled objects in memory, similar to a ZEO
+        cache. This cache is shared between threads. This parameter
+        configures the approximate maximum amount of memory the cache
+        should consume, in megabytes.  It defaults to 10.
+      </description>
+    </key>
+    <key name="cache-delta-size-limit" datatype="integer" required="no">
+      <description>
+        This is an advanced option. RelStorage uses a system of
+        checkpoints to achieve a high cache hit rate. This parameter
+        configures how many objects should be stored before creating a
+        new checkpoint. The default is 10000.
+      </description>
+    </key>
   </sectiontype>
 
   <sectiontype name="postgresql" implements="relstorage.adapter"

Modified: relstorage/trunk/relstorage/options.py
===================================================================
--- relstorage/trunk/relstorage/options.py	2009-10-18 04:41:53 UTC (rev 105125)
+++ relstorage/trunk/relstorage/options.py	2009-10-18 08:53:09 UTC (rev 105126)
@@ -39,7 +39,7 @@
         self.cache_servers = ()  # ['127.0.0.1:11211']
         self.cache_module_name = 'memcache'
         self.cache_prefix = ''
-        self.cache_local_mb = 4
+        self.cache_local_mb = 10
         self.cache_delta_size_limit = 10000
 
         for key, value in kwoptions.iteritems():

Modified: relstorage/trunk/relstorage/tests/testmysql.py
===================================================================
--- relstorage/trunk/relstorage/tests/testmysql.py	2009-10-18 04:41:53 UTC (rev 105125)
+++ relstorage/trunk/relstorage/tests/testmysql.py	2009-10-18 08:53:09 UTC (rev 105126)
@@ -131,6 +131,13 @@
     }
 
 def test_suite():
+    try:
+        import MySQLdb
+    except ImportError, e:
+        import warnings
+        warnings.warn("MySQLdb is not importable, so MySQL tests disabled")
+        return unittest.TestSuite()
+
     suite = unittest.TestSuite()
     for klass in [
             HPMySQLTests,

Modified: relstorage/trunk/relstorage/tests/testoracle.py
===================================================================
--- relstorage/trunk/relstorage/tests/testoracle.py	2009-10-18 04:41:53 UTC (rev 105125)
+++ relstorage/trunk/relstorage/tests/testoracle.py	2009-10-18 08:53:09 UTC (rev 105126)
@@ -139,6 +139,13 @@
     }
 
 def test_suite():
+    try:
+        import cx_Oracle
+    except ImportError, e:
+        import warnings
+        warnings.warn("cx_Oracle is not importable, so Oracle tests disabled")
+        return unittest.TestSuite()
+
     suite = unittest.TestSuite()
     for klass in [
             HPOracleTests,

Modified: relstorage/trunk/relstorage/tests/testpostgresql.py
===================================================================
--- relstorage/trunk/relstorage/tests/testpostgresql.py	2009-10-18 04:41:53 UTC (rev 105125)
+++ relstorage/trunk/relstorage/tests/testpostgresql.py	2009-10-18 08:53:09 UTC (rev 105126)
@@ -127,6 +127,14 @@
     }
 
 def test_suite():
+    try:
+        import psycopg2
+    except ImportError, e:
+        import warnings
+        warnings.warn(
+            "psycopg2 is not importable, so PostgreSQL tests disabled")
+        return unittest.TestSuite()
+
     suite = unittest.TestSuite()
     for klass in [
             HPPostgreSQLTests,



More information about the checkins mailing list