title: Sharing drools RuntimeEnvironment between AWS Lambda's
body: <p>I need to share the RuntimeEnvironment object of <a href="http://www.drools.org/" rel="nofollow noreferrer">Drools</a> (7.8) between different isolated java processes executing within AWS Lambda. The creation of the drools environment takes too much time as it has a large number of rules. This would in turn increase the Lambda execution time. Then main objective is to optimise this performance by avoiding the recreation of environment object, each time a lambda is executed.</p>
  
  <p>I tried keeping the Lambda warm, but it fails when there is a huge load, and concurrent executions are greeted with cold starts. In my case there is always a chance of 100's of concurrent executions, so keeping too many Lambda instances warm, may cause high utilization bills from AWS. So i would want to avoid such an approach.</p>
  
  <p>I also tried storing the KieBase within a Redis Cache(via <a href="https://aws.amazon.com/elasticache/" rel="nofollow noreferrer">Amazon Elasticache</a>) using the <a href="https://redisson.org/" rel="nofollow noreferrer">Redisson</a> plugin, so that the object can be created once and be shared among all Lambda Execution Instances. This approach also didn't prove to be fruitful, as Serializing the KieBase object results in stack-overflow errors.</p>
  
  <p>Is there a way to serialize/de-serialize the KieBase object, without causing StackOverflows or other performance issues, or any other way in which the object can be shared among different Lambda instances.</p>