This is a created article in which the information may have evolved or changed.
Go Commons pool is a universal go language object pooling, rewritten based on the Java version of the Apache Commons pool. Go Commons Pool implements the main features of the Java version, overwriting most of the Java version of the test case, testing coverage of 90%, performance test results and Java version of the similar, already can be used in production environment, so release 1.0 version.
Go Commons pool retains the main features of the Java version, including:
- Custom Pooledobjectfactory.
- Rich set options to precisely control the life cycle of an object. See Objectpoolconfig for details.
- Whether the object pool is LIFO (last-in-first-out) or FIFO (first-out)
- Capacity control of the object pool
- Validation configuration for Object Pool objects
- Whether the object is blocked and the maximum wait time configuration is obtained
- Object Pool Object recycle mechanism configuration (Support background timer task detection recycle)
- Discard mechanism configuration for object pool objects (primarily used to prevent object pool object from being returned after loan, resulting in object disclosure)
However, the following Apache Commons pool features are not included:
- Keyedobjectpool implementation
- Proxiedobjectpool implementation
- Statistical functions of the object pool
Go Commons pool is the main application scenario is a variety of connection pools, the current go under the various caches or databases (such as redis/memcached) have implemented a less well-functioning connection pool (such as missing timeout settings, etc.), if the Go Commons The pool can support richer settings.
Summary of the concurrency problems of Go language encountered in the rewriting process can be found in the blog Golang multithreaded programming problem summary.