From 986408d67a8552e15e505edb6c7b4ff15251692e Mon Sep 17 00:00:00 2001 From: Kristina Chodorow Date: Thu, 18 Aug 2011 19:37:11 +0000 Subject: [PATCH] added MongoPool functions git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@315150 c90b9560-bf6c-de11-be94-00142212c4b1 --- reference/mongo/misc.xml | 1 + reference/mongo/mongo/getpoolsize.xml | 18 +++- reference/mongo/mongo/pooldebug.xml | 7 ++ reference/mongo/mongo/setpoolsize.xml | 33 ++++--- reference/mongo/mongopool.xml | 75 ++++++++++++++ reference/mongo/mongopool/getsize.xml | 96 ++++++++++++++++++ reference/mongo/mongopool/info.xml | 137 ++++++++++++++++++++++++++ reference/mongo/mongopool/setsize.xml | 122 +++++++++++++++++++++++ 8 files changed, 471 insertions(+), 18 deletions(-) create mode 100644 reference/mongo/mongopool.xml create mode 100644 reference/mongo/mongopool/getsize.xml create mode 100644 reference/mongo/mongopool/info.xml create mode 100644 reference/mongo/mongopool/setsize.xml diff --git a/reference/mongo/misc.xml b/reference/mongo/misc.xml index b7f3a432eb..30f3c83ad2 100644 --- a/reference/mongo/misc.xml +++ b/reference/mongo/misc.xml @@ -6,5 +6,6 @@ Miscellaneous &reference.mongo.mongolog; + &reference.mongo.mongopool; diff --git a/reference/mongo/mongo/getpoolsize.xml b/reference/mongo/mongo/getpoolsize.xml index 5c23ce046a..c0005e2e13 100644 --- a/reference/mongo/mongo/getpoolsize.xml +++ b/reference/mongo/mongo/getpoolsize.xml @@ -6,20 +6,28 @@ Mongo::getPoolSize Get pool size for connection pools - + &reftitle.description; public static intMongo::getPoolSize + + + This feature has been DEPRECATED as of version + 1.2.3. Relying on this feature is highly discouraged. Please use + MongoPool::getSize instead. + + + - + &reftitle.parameters; &no.function.parameters; - + &reftitle.returnvalues; @@ -62,7 +70,7 @@ var_dump(Mongo::poolDebug()); - + &reftitle.seealso; @@ -73,7 +81,7 @@ var_dump(Mongo::poolDebug()); - + &reftitle.examples; <function>Mongo::setPoolSize</function> example - If you set the pool size to n and then create - n connections, attempting to create an - n+1st connection will throw a + If you set the pool size to n and then create + n connections, attempting to create an + n+1st connection will throw a MongoConnectionException. @@ -87,9 +94,9 @@ Stack trace: - - - + + + &reftitle.seealso; @@ -99,7 +106,7 @@ Stack trace: The connection documentation. - + + + + + The MongoPool class + MongoPool + + + + +
+ &reftitle.intro; + + In version 1.2.0 of the driver, built-in connection pooling was introduced. + This class gives you some control and information about pooling. + + + + The functions in this class were originally static members of + Mongo. It is highly recommended that you use these + functions in the future, as the static Mongo + functions are considered deprecated. + + +
+ + +
+ &reftitle.classsynopsis; + + + + MongoPool + + + + + MongoPool + + + + + &Methods; + + + + +
+
+ + &reference.mongo.entities.mongopool; + +
+ + diff --git a/reference/mongo/mongopool/getsize.xml b/reference/mongo/mongopool/getsize.xml new file mode 100644 index 0000000000..74f8923fb3 --- /dev/null +++ b/reference/mongo/mongopool/getsize.xml @@ -0,0 +1,96 @@ + + + + + + MongoPool::getSize + Get pool size for connection pools + + + + &reftitle.description; + + public static intMongoPool::getSize + + + + + + &reftitle.parameters; + &no.function.parameters; + + + + &reftitle.returnvalues; + + Returns the current pool size. + + + + &reftitle.examples; + + Changing pool size + + This returns the default pool size, sets a new pool size, then prints the + new pool size and the pool debugging information. Note that changing the + pool size only affects new connection pools, it does not change old ones. + + + +]]> + + + + + + &reftitle.seealso; + + + MongoPool::setSize + MongoPool::info + The connection documentation. + + + + + + diff --git a/reference/mongo/mongopool/info.xml b/reference/mongo/mongopool/info.xml new file mode 100644 index 0000000000..679e830ca1 --- /dev/null +++ b/reference/mongo/mongopool/info.xml @@ -0,0 +1,137 @@ + + + + + + MongoPool::info + Returns information about all connection pools. + + + + &reftitle.description; + + public arrayMongoPool::info + + + + + Returns an array of information about all connection pools. + + + + + &reftitle.parameters; + &no.function.parameters; + + + + &reftitle.returnvalues; + + Each connection pool has an identifier, which starts with the host. For each + pool, this function shows the following fields: + + + + in use + + + + The number of connections currently being used by + Mongo instances. + + + + + + in pool + + + + The number of connections currently in the pool (not being used). + + + + + + remaining + + + + The number of connections that could be created by this pool. For + example, suppose a pool had 5 connections remaining and 3 connections in + the pool. We could create 8 new instances of + Mongo before we exhausted this pool (assuming no + instances of Mongo went out of scope, returning + their connections to the pool). + + + A negative number means that this pool will spawn unlimited connections. + + + Before a pool is created, you can change the max number of connections by + calling Mongo::setPoolSize. Once a pool is showing + up in the output of this function, its size cannot be changed. + + + + + + total + + + + The total number of connections allowed for this pool. This should be + greater than or equal to "in use" + "in pool" (or -1). + + + + + + timeout + + + + The socket timeout for connections in this pool. This is how long + connections in this pool will attempt to connect to a server before + giving up. + + + + + + waiting + + + + If you have capped the pool size, workers requesting connections from + the pool may block until other workers return their connections. This + field shows how many milliseconds workers have blocked for connections to + be released. If this number keeps increasing, you may want to use + MongoPool::setSize to add more connections to your + pool. + + + + + + + + diff --git a/reference/mongo/mongopool/setsize.xml b/reference/mongo/mongopool/setsize.xml new file mode 100644 index 0000000000..b4e12ef775 --- /dev/null +++ b/reference/mongo/mongopool/setsize.xml @@ -0,0 +1,122 @@ + + + + + + MongoPool::setSize + Set the size for future connection pools. + + + + &reftitle.description; + + public static boolMongoPool::setSize + intsize + + + + Sets the max number of connections new pools will be able to create. + + + + + &reftitle.parameters; + + + + + size + + + + The max number of connections future pools will be able to create. + Negative numbers mean that the pool will spawn an infinite number of + connections. + + + + + + + + + &reftitle.returnvalues; + + Returns the former value of pool size. + + + + + + &reftitle.examples; + + + <function>Mongo::setPoolSize</function> example + + If you set the pool size to n and then create + n connections, attempting to create an + n+1st connection will throw a + MongoConnectionException. + + + +]]> + + &example.outputs.similar; + +__construct() +#1 {main} + thrown in /path/to/php/script.php on line 10 +]]> + + + + + + + + &reftitle.seealso; + + + MongoPool::getSize + MongoPool::info + The connection documentation. + + + + +