Downsize PerThreadCache from 50 to 25

At Google, we still see a very small number of occasional crashes with
the list projects endpoint. Cutting down the limit of the cache from 50
to 25 will most likely get rid of even the small number of remaining
crashes.

The number 50 was chosen arbitrarily in the first place and the
intention was to change the number based on the experiences we make with
it.

Change-Id: I694769075b5be6b3b4076e89c2b39307f897c3d6
This commit is contained in:
Patrick Hiesel
2018-06-11 10:43:59 +02:00
parent d7156aeaf6
commit 0e69d16a37

View File

@@ -51,11 +51,11 @@ import java.util.function.Supplier;
public class PerThreadCache implements AutoCloseable {
private static final ThreadLocal<PerThreadCache> CACHE = new ThreadLocal<>();
/**
* Cache at maximum 50 values per thread. This value was chosen arbitrarily. Some endpoints (like
* Cache at maximum 25 values per thread. This value was chosen arbitrarily. Some endpoints (like
* ListProjects) break the assumption that the data cached in a request is limited. To prevent
* this class from accumulating an unbound number of objects, we enforce this limit.
*/
private static final int PER_THREAD_CACHE_SIZE = 50;
private static final int PER_THREAD_CACHE_SIZE = 25;
/**
* Unique key for key-value mappings stored in PerThreadCache. The key is based on the value's