title: Best Cache provider for Storm data
body: <p>We are facing a load issue with Storm. We were using Storm state persistence for getting data from memory, to populate a real time report. But there were long GC pauses under heavy load environment.
  Hence we created another service. Storm will be sending data to this service which maintains the in memory data structure. Although the long GC pauses have reduced, we are still not able to scale for a heavier load environment.
  I tried using REDIS caching in the new service. But the write to REDIS under heavy load is very slow. May be due to its Single threaded model.</p>
  <p>Can someone please suggest an effective caching mechanism for same. I checked Memcached but it has limitation on the size of value each key can hold.</p>
  <p>Below are the code changes which I tried:</p>
  <pre><code>**Pom.xml**
  &lt;!-- Spring boot Redis dependency --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-data-redis&lt;/artifactId&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;redis.clients&lt;/groupId&gt;
          &lt;artifactId&gt;jedis&lt;/artifactId&gt;
      &lt;/dependency&gt;
  
  **Bean Configuration**
  @Bean
  RedisTemplate&lt;String, List&lt;Data&gt;&gt; redisTemplate() {
      RedisTemplate&lt;String, List&lt;Data&gt;&gt; redisTemplate = new RedisTemplate&lt;&gt;();
      redisTemplate.setConnectionFactory(new JedisConnectionFactory()());
  } 
  
  **RedisStore abstract class**
  public abstract class RedisStore&lt;T extends BaseEvent&gt; implements EventStoreService&lt;Integer, T&gt;{
  private ValueOperations&lt;String, List&lt;T&gt;&gt; valOperations;
  
  final String type;  
  
  public RedisStore(String type, RedisTemplate&lt;String, List&lt;T&gt;&gt; redisTemplate) {
      this.valOperations = redisTemplate.opsForValue();
      this.type = type;
  }
  
  public void put(Integer id, T elem) {
      List&lt;T&gt; existingElems = valOperations.get(getKey(id));
      if (null == existingElems) {
          existingElems = new ArrayList&lt;&gt;();
      }
      existingElems.add(elem);
      valOperations.set(getKey(id), existingElems);
  }
  }
  </code></pre>