[FEATURE] Size of JSONFactory.CACHE_ITEMS[] should be configurable
- Dominant language
- Java
- Stars
- 4.4k
- Forks
- 613
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 6
Description
Currently `JSONFactory.CACHE_ITEMS[]` is fixed to `16` elements. When multiple threads (>16) does json serialization / deserialization in parallel, many of threads needs to allocate its own byte[] buffer due to the buffer being in use by other threads.
Create API to configure the capacity of `JSONFactory.CACHE_ITEMS[]` so that applications with many concurrent threads can increase the capacity of `CACHE_ITEMS`.
Example:
```java
JSON.configBufferCacheItems(int noOfCacheItems);
```
On a side note, default fixed cache size of `16` elements is too low. It should be increased to minimum of `32 / 48 / 64`.
Contributor guide
Research direction
Start by tracing JSONFactory.CACHE_ITEMS[] and the public JSON entry point mentioned in the issue, JSON.configBufferCacheItems(int noOfCacheItems). Check how the cache is initialized and used during parallel serialization and deserialization. Done means applications can configure the cache capacity and the default capacity is updated as agreed, with coverage for the configured behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend-api-design, performance
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100