+Bjoern supports enabling SO_REUSEPORT if it's available on the system (Python's base images use Debian which supports this). This has been enabled by default in this image. What does this do? In short, if an application has terminated for whatever reason (quit, killed, etc) the system may still hold onto the port while it's clearing the buffer out. This process blocks other applications including new instances of the same application from binding to the port during this time (which can be a lengthy process, in some cases up to 2 min). Setting this flag when binding to the port allows other applications to bind to the port during this timeout period. While there is the possibility that it could cause strange behavior, those are _extremely_ rare. Generally speaking, the perception is that enabling this behavior is a good thing at least with regard to performance. However, it should be noted that since this image is not using any kind of supervisor to restart the application if it crashes (I find this is usually best left to the cluster controller so it can just replace the pod), this image probably does not truly make use of it.
0 commit comments