title: Axon Server auto-scaling split/merge delay
body: <p>I am implementing auto-scaling in an application using Axon Server, and running in k8s.</p>
  
  <p>I have created ReST endpoints in the application itself, which look at the local configuration (for processors and thread counts) and then speak to the Axon Server ReST API in order to split/merge the processors appropriately. The intent being to use container lifecycle hooks to trigger them.</p>
  
  <p>As a result, if a new instance (pod) of an application is launched, configured for 2 threads on ProcessorA, then my code will make 2 requests to the <code>/v1/components/blah/processors/ProcessorA/segments/split?context=default</code> endpoint on the server. This is in order to make full use of the 2 new threads.</p>
  
  <p>Likewise, when the pod is shut down, it makes 2 similar requests to the merge endpoint on the server.</p>
  
  <p>When scaling up I see the processor split twice, as expected. However, on shutdown I don't see the merge twice unless I put a long (5s) wait between requests. This isn't likely to be particularly stable, so I'm wondering if there's something else I need to be doing.</p>
  
  <p>Perhaps I ought to request the merge, then loop waiting for it to occur, then request another. This seems like it's going to be excessively slow.</p>
  
  <p>There was another question on SO somewhat related, <a href="https://stackoverflow.com/questions/55121228/automatically-scale-axons-tracking-event-processors">Automatically scale Axon&#39;s tracking event processors</a>, where Steven commented that there was no inbuilt auto-scaling in Axon Server at that point in time. I've not seen anything in more recent times either.</p>