Skip to content

Commit b098ca2

Browse files
authored
[GEOS-12049]: Removing inMemory caching (#1474)
1 parent 2e6f20f commit b098ca2

File tree

28 files changed

+0
-4086
lines changed

28 files changed

+0
-4086
lines changed

documentation/en/user/source/configuration/storage.rst

Lines changed: 0 additions & 218 deletions
Original file line numberDiff line numberDiff line change
@@ -255,9 +255,6 @@ a thorough assessment of costs associated to seeding and serving caches**. Yet w
255255
the bigger the size difference between two identical caches on S3 vs a regular file system. The S3 cache takes less space because the actual space used for each
256256
tile is not padded to a file system block size. For example, the ``topp:states`` layer seeded up to zoom level 10 for EPSG:4326 with png8 format takes roughly
257257
240MB on an Ext4 file system, and about 21MB on S3.
258-
* Use in-memory caching. When serving S3 tiles from GeoWebcache, you can greately reduce the number of GET requests to S3 by configuring an in-memory cache as
259-
described in the "In-Memory caching" section bellow. This will allow for frequently requested tiles to be kept in memory instead of retrieved from S3 on each
260-
call.
261258

262259
The following is an example OpenLayers 3 HTML/JavaScript to set up a map that fetches tiles from a pre-seeded geowebcache layer directly from S3. We're using the typical
263260
GeoServer ``topp:states`` sample layer on a fictitious ``my-geowebcache-bucket`` bucket, using ``test-cache`` as the cache prefix, png8 tile format, and EPSG:4326 CRS.
@@ -636,221 +633,6 @@ The *layer* parameter identifies the layer whose associated blob store content s
636633

637634
This are the only valid combinations of this parameters other combinations will ignore some of the provided parameters or will throw an exception.
638635

639-
In-Memory caching
640-
-----------------
641-
642-
Default **blobstore** can be changed with a new one called **MemoryBlobStore**, which allows in memory tile caching. The **MemoryBlobStore** is a wrapper of a **blobstore**
643-
implementation, which can be the default one(*FileBlobStore*) or another one. For using the new **blobstore** implementation, the user have to
644-
modify the **blobstore** bean associated to the **gwcStorageBroker** bean (inside the Application Context file *geowebcache-core-context.xml*) by setting *gwcMemoryBlobStore*
645-
instead of *gwcBlobStore*.
646-
647-
The configuration of a MemoryBlobStore requires a *blobstore* to wrap and a **CacheProvider** object. This one provides the caching mechanism for saving input data in memory.
648-
User can define different caching objects but can only inject one of them inside the **MemoryBlobStore**. More information about the **CacheProvider** can be found in the next section.
649-
650-
An example of MemoryBlobStore configuration can be found beow:
651-
652-
.. code-block:: xml
653-
654-
<bean id="gwcMemoryBlobStore" class="org.geowebcache.storage.blobstore.memory.MemoryBlobStore" destroy-method="destroy">
655-
<property name="store" ref="gwcBlobStore" />
656-
<!-- "cacheProviderName" is optional. It is the name of the bean associated to the cacheProvider object used by this MemoryBlobStore-->
657-
<property name="cacheBeanName" value="cacheProviderName" />
658-
<!-- "cacheProvider" is optional. It is the Reference to a CacheProvider bean in the application context. -->
659-
<property name="cacheProvider" ref="ExampleCacheProvider" />
660-
</bean>
661-
662-
.. note:: Note that *cacheProviderName*/*cacheProvider* cannote be used together, if a *cacheProvider* is defined, the *cacheProviderName* is not considered. If *cacheProviderName*/*cacheProvider* are not defined, the **MemoryBlobStore** will internally search for a suitable **CacheProvider**.
663-
664-
CacheProvider configuration
665-
+++++++++++++++++++++++++++
666-
667-
A **CacheProvider** object should be configured with an input object called **CacheConfiguration**. **CacheConfiguration** parameters are:
668-
669-
* *hardMemoryLimit* : which is the cache size in Mb
670-
* *policy* : which can be LRU, LFU, EXPIRE_AFTER_WRITE, EXPIRE_AFTER_ACCESS, NULL
671-
* *evitionTime* : which is the cache eviction time in seconds
672-
* *concurrencyLevel* : which is the cache concurrency level
673-
674-
These parameters must be defined as properties in the **cacheConfiguration** bean in the Spring Application Context (like *geowebcache-core-context.xml*).
675-
676-
At the time of writing there are two implementations of the **CacheProvider** interface:
677-
678-
* **GuavaCacheProvider**
679-
* **HazelcastCacheProvider**
680-
681-
GuavaCacheProvider
682-
``````````````````````
683-
**GuavaCacheProvider** provides local in-memory caching by using a `Guava <https://code.google.com/p/guava-libraries/wiki/CachesExplained>`_ *Cache* for storing the various GWC Tiles locally on the machine. For configuring a **GuavaCacheProvider**
684-
the user must create a new bean in the Application Context file (like *geowebcache-core-context.xml*) and then add a reference to a **CacheConfiguration** instance.
685-
686-
Here is an example of configuration:
687-
688-
.. code-block:: xml
689-
690-
<bean id="cacheConfiguration" class="org.geowebcache.storage.blobstore.memory.CacheConfiguration">
691-
<property name="hardMemoryLimit" value="64"/> <!-- 64 Mb -->
692-
<property name="policy" value="EXPIRE_AFTER_ACCESS"/> <!-- Cache Eviction Policy is EXPIRE_AFTER_ACCESS. Other values are EXPIRE_AFTER_WRITE, NULL(LRU eviction based on cache size) -->
693-
<property name="evitionTime" value="240"/> <!-- Eviction time is 240 seconds -->
694-
<property name="concurrencyLevel" value="4"/> <!-- Concurrency Level of the cache is 4 -->
695-
</bean>
696-
697-
<bean id="guavaCacheProvider" class="org.geowebcache.storage.blobstore.memory.guava.GuavaCacheProvider">
698-
<property name="configuration" ref="cacheConfiguration"/> <!-- Setting of the configuration -->
699-
</bean>
700-
701-
702-
HazelcastCacheProvider
703-
``````````````````````
704-
**HazelcastCacheProvider** is useful for implementing distributed in memory caching for clustering. It internally uses `Hazelcast <http://docs.hazelcast.org/docs/3.3/manual/html/>`_ for handling distributed caching.
705-
The **HazelcastCacheProvider** configuration requires another object called **HazelcastLoader**. This object accepts an Hazelcast instance or loads a file called *hazelcast.xml* from a proper directory defined
706-
by the property "hazelcast.config.dir". If none of them is present, the CacheProvider object cannot be used.
707-
708-
The user must follow these rules for configuring the Hazelcast instance:
709-
710-
#. The Hazelcast configuration requires a Map object with name *CacheProviderMap*
711-
#. Map eviction policy must be *LRU* or *LFU*
712-
#. Map configuration must have a fixed size defined in Mb
713-
#. Map configuration must have **USED_HEAP_SIZE** as *MaxSizePolicy*
714-
715-
Here the user can find both examples:
716-
717-
* From *hazelcast.xml*:
718-
719-
.. code-block:: xml
720-
721-
<hazelcast xsi:schemaLocation="http://www.hazelcast.com/schema/config hazelcast-config-2.3.xsd"
722-
xmlns="http://www.hazelcast.com/schema/config"
723-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
724-
<group>
725-
<name>cacheCluster</name>
726-
<password>geoserverCache</password>
727-
</group>
728-
729-
<network>
730-
<!--
731-
Typical usage: multicast enabled with port auto-increment enabled
732-
or tcp-ip enabled with port auto-increment disabled. Note that you
733-
must choose between multicast and tcp-ip. Another option could be
734-
aws, but will not be described here.
735-
736-
-->
737-
<port auto-increment="false">5701</port>
738-
<join>
739-
<multicast enabled="false">
740-
<multicast-group>224.2.2.3</multicast-group>
741-
<multicast-port>54327</multicast-port>
742-
</multicast>
743-
<tcp-ip enabled="true">
744-
<interface>192.168.1.32</interface>
745-
<interface>192.168.1.110</interface>
746-
</tcp-ip>
747-
</join>
748-
</network>
749-
<map name="CacheProviderMap">
750-
<eviction-policy>LRU</eviction-policy>
751-
<max-size policy="USED_HEAP_SIZE">16</max-size>
752-
</map>
753-
754-
</hazelcast>
755-
756-
And the related application context will be:
757-
758-
.. code-block:: xml
759-
760-
<bean id="HazelCastLoader1"
761-
class="org.geowebcache.storage.blobstore.memory.distributed.HazelcastLoader">
762-
</bean>
763-
764-
<bean id="HazelCastCacheProvider1"
765-
class="org.geowebcache.storage.blobstore.memory.distributed.HazelcastCacheProvider">
766-
<constructor-arg ref="HazelCastLoader1" />
767-
</bean>
768-
769-
.. note:: Remember that in this case the user must define the *hazelcast.config.dir* property when starting the application.
770-
771-
* From application context (See Hazelcast documentation for more info):
772-
773-
.. code-block:: xml
774-
775-
<hz:hazelcast id="instance1">
776-
<hz:config>
777-
<hz:group name="dev" password="password" />
778-
<hz:network port="5701" port-auto-increment="true">
779-
<hz:join>
780-
<hz:multicast enabled="true" multicast-group="224.2.2.3"
781-
multicast-port="54327" />
782-
<hz:tcp-ip enabled="false">
783-
<hz:members>10.10.1.2, 10.10.1.3</hz:members>
784-
</hz:tcp-ip>
785-
</hz:join>
786-
</hz:network>
787-
<hz:map name="CacheProviderMap" max-size="16" eviction-policy="LRU"
788-
max-size-policy="USED_HEAP_SIZE" />
789-
</hz:config>
790-
</hz:hazelcast>
791-
792-
<bean id="HazelCastLoader1"
793-
class="org.geowebcache.storage.blobstore.memory.distributed.HazelcastLoader">
794-
<property name="instance" ref="instance1" />
795-
</bean>
796-
797-
<bean id="HazelCastCacheProvider1"
798-
class="org.geowebcache.storage.blobstore.memory.distributed.HazelcastCacheProvider">
799-
<constructor-arg ref="HazelCastLoader1" />
800-
</bean>
801-
802-
Optional configuration parameters
803-
``````````````````````````````````
804-
In this section are described other available configuration parameters to configure:
805-
806-
* Cache expiration time:
807-
808-
.. code-block:: xml
809-
810-
<map name="CacheProviderMap">
811-
...
812-
813-
<time-to-live-seconds>0</time-to-live-seconds>
814-
<max-idle-seconds>0</max-idle-seconds>
815-
816-
</map>
817-
818-
Where *time-to-live-seconds* indicates how many seconds an entry can stay in cache and *max-idle-seconds* indicates how many seconds an entry may be not accessed before being evicted.
819-
820-
* Near Cache.
821-
822-
.. code-block:: xml
823-
824-
<map name="CacheProviderMap">
825-
...
826-
<near-cache>
827-
<!--
828-
Same configuration parameters of the Hazelcast Map. Note that size indicates the maximum number of
829-
entries in the near cache. A value of Integer.MAX_VALUE indicates no limit on the maximum
830-
size.
831-
-->
832-
<max-size>5000</max-size>
833-
<time-to-live-seconds>0</time-to-live-seconds>
834-
<max-idle-seconds>60</max-idle-seconds>
835-
<eviction-policy>LRU</eviction-policy>
836-
837-
<!--
838-
Indicates if a cached entry can be evicted if the same value is modified in the Hazelcast Map. Default is true.
839-
-->
840-
<invalidate-on-change>true</invalidate-on-change>
841-
842-
<!--
843-
Indicates if local entries must be cached. Default is false.
844-
-->
845-
<cache-local-entries>false</cache-local-entries>
846-
</near-cache>
847-
848-
</map>
849-
850-
Near Cache is a local cache for each cluster instance which is used for caching entries in the other cluster instances. This behaviour avoids to request those entries each time by executing a remote call. This feature could be helpful in order to improve Hazelcast Cache performances.
851-
852-
.. note:: A value of *max-size* bigger or equal to Integer.MAX_VALUE cannot be used in order to avoid an uncontrollable growth of the cache size.
853-
854636
OpenStack Swift (Swift) Blob Store
855637
+++++++++++++++++++++++++++++++++++++++++++++
856638

documentation/en/user/source/rest/index.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ This section will discuss the GeoWebCache REST API.
1515
seed.rst
1616
diskquota.rst
1717
masstruncate.rst
18-
statistics.rst
1918

2019

2120

documentation/en/user/source/rest/statistics.rst

Lines changed: 0 additions & 72 deletions
This file was deleted.

documentation/en/user/source/webinterface/status.rst

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,3 @@ Runtime statistics
3030

3131
The Status page displays basic runtime statistics including: uptime; how many requests have been made; total and peak throughput and statitics over intervals of 3, 15, and 60 seconds.
3232

33-
In Memory Cache statistics
34-
--------------------------
35-
36-
If the **blobstore** object used is an instance of **MemoryBlobStore**, the user can find a new section called *In Memory Cache statistics*, containing the statistics of the cache used
37-
by the **blobstore**. Note that these statistics are related to the local entries, even in case of distributed in-memory caching.

0 commit comments

Comments
 (0)