Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are some pros and cons of parallel podManagementPolicy over OrderedReady podManagementPolicy in StatefulSets?

I have recently updated podManagementPolicy field in my StatefulSet from default(OrderedReady) to Parallel.

  • It has significantly reduced the scale-up and scale-down time.
  • I have not seen any downsides of this change as of now, but I am worried if there can be any scenario where it might create problems for me?

I wanted to know if there is any case where i can face any issue?

like image 780
himanshu Avatar asked Jul 30 '20 10:07

himanshu


1 Answers

I would like to expand on this topic a bit.

The OrderedReady pod management behaves as follows:

  • For a StatefulSet with N replicas, when Pods are being deployed, they are created sequentially, in order from {0..N-1}.

  • When Pods are being deleted, they are terminated in reverse order, from {N-1..0}.

  • Before a scaling operation is applied to a Pod, all of its predecessors must be Running and Ready.

  • Before a Pod is terminated, all of its successors must be completely shutdown.

While the Parallel pod management:

tells the StatefulSet controller to launch or terminate all Pods in parallel, and to not wait for Pods to become Running and Ready or completely terminated prior to launching or terminating another Pod. This option only affects the behavior for scaling operations. Updates are not affected.

Theoretically you will not face any downtime while updating your app as parallel strategy only affects the scaling operations. As already said by Jonas it is hard to foresee the potential consequences without knowing much about your app and architecture. But generally it is safe to say that if your app's instances does not depend on each other (and thus does not have to wait for each pod to be Running and Ready) the parallel strategy should be safe and quicker than the OrderedReady one. However, if you possibly face any issues with your StatefulSet in the future and would like to analyze it from the Kubernetes side, these official docs might be helpul for you.

like image 95
Wytrzymały Wiktor Avatar answered Sep 22 '22 19:09

Wytrzymały Wiktor